trigger.Info.trigger with devices

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Gravityz
Posts: 652
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2025.1
Location: Netherlands
Contact:

trigger.Info.trigger with devices

Post by Gravityz »

Does trigger.Info.trigger also work with devices?
if not i surely hope something will be implemented to check which device triggered an event

another way to check which device triggered an event is to do a device.name==(' ddddd')
problem with this is if you have a long list of devices you will have to name them al to check
wildcards do not work with the check (while they do work with the device trigger list)
also you can only check if a device.name is the same.
would be nice to do a check if the device.name is NOT EQUAL



i am trying to figur out which device triggered the event but it seems that trigger.Info.trigger does not work with devices
return {
active = true,
on = {
Devices = {
'deviceA',
'deviceB'
}
},
execute = function(domoticz, devices, triggerInfo)
-- external light switch name

if (triggerInfo.trigger == 'deviceA') then
external_light.switchOn()
else
external_light.switchOff()
end
end
}
Last edited by Gravityz on Friday 17 November 2017 11:26, edited 1 time in total.
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: trigger.Info.trigger with devices

Post by emme »

Code: Select all

execute = function(domoticz, devices, triggerInfo)
                     |          |        \-------- Table for time trigger script
                     |          |
                     |          \----------------- Table with single device/variable that trigger the script
                     |
                      \---------------------------- Entire Domoticz table
so you can use devices.name instead ;)
The most dangerous phrase in any language is:
"We always done this way"
Gravityz
Posts: 652
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: trigger.Info.trigger with devices

Post by Gravityz »

ok i understand

i was thinking to difficult
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest