Basic script. Where am I going wrong
Posted: Wednesday 03 January 2018 10:35
I am very new to scripting and learning as I go. What I am trying to achieve.......
When "Dusk Dawn Sensor" is On and "Hall Lamp Wall Switch" is Off switch "Hall Lamp Socket" On.
The script runs and shows no errors but the Hall Lamp Socket does not switch on and is not triggered in the script.
Where am I going wrong.
When "Dusk Dawn Sensor" is On and "Hall Lamp Wall Switch" is Off switch "Hall Lamp Socket" On.
The script runs and shows no errors but the Hall Lamp Socket does not switch on and is not triggered in the script.
Where am I going wrong.
Code: Select all
return {
active = true,
on = {
devices = {
'Hall Lamp Wall Switch',
'Dusk Dawn Sensor',
'Hall Lamp Socket'
},
},
execute = function(domoticz, device)
if ((device.name == 'Dusk Dawn Sensor' and device.state == 'On')
and (device.name == 'Hall Lamp Wall Switch' and device.state == 'Off')) then
domoticz.devices('Hall Lamp Socket').switchOn()
end
end
}