triggering an "if"
Posted: Saturday 22 December 2018 21:41
Hi,
In the following simple script the second "if" doesn't work.
I can trigger the first if when I push the "wall button 1" (GPIO), then I want to check wether the light is on or off and this doesn't work.
Or maybe there is another way to do this?
Thanks,
Arek
In the following simple script the second "if" doesn't work.
Code: Select all
return {
on = {
devices = {
'wall button 1',
'sleepingroom light'
}
},
execute = function(domoticz, device)
if ((device.name == 'wall button 1' and device.changed)) then
if ((device.name == 'sleepingroom light' and device.state == "Off")) then
domoticz.log('Light will wee turned on ')
end
end
end
}
Or maybe there is another way to do this?
Thanks,
Arek