Code: Select all
return {
on = {
timer = { 'every 5 minutes' },
devices = { 'myDetector' }
},
execute = function(domoticz, item)
if (item.isTimer) then
-- the timer was triggered
domoticz.devices('myLamp').switchOff()
elseif (item.isDevice and item.active) then
-- it must be the detector
domoticz.devices('myLamp').switchOn()
end
end
}
Code: Select all
[code]return {
on = {
timer = { 'every 5 minutes' },
devices = { 'myDetector_1', 'myDetector_2' }
},
execute = function(domoticz, item)
if (item.isTimer) then
-- the timer was triggered
domoticz.devices('myLamp').switchOff()
elseif (item.isDevice and device is myDetector_1) then -- here I want to know which device it is
-- it must be the detector
domoticz.devices('myLamp_1').switchOn()
elseif (item.isDevice and device is myDetector_2) then -- here I want to know which device it is
-- it must be the detector
domoticz.devices('myLamp_2').switchOn()
end
end
}
How can I know which device activated the script?