The lamp itself is called "Overloop lamp" and the switch is called "Overloop lamp slave"
I would like to have the state of both devices synchronized.
I use this script, and it works fine.
Code: Select all
return {
active = true,
-- active = false,
on = {
devices = { "Overloop lamp slave", "Overloop lamp" }
},
execute = function(domoticz, mySwitch)
if mySwitch.name == "Overloop lamp" then
if (mySwitch.state == 'On') then
domoticz.devices("Overloop lamp slave").switchOn().checkFirst().silent()
else
domoticz.devices("Overloop lamp slave").switchOff().checkFirst().silent()
end
elseif mySwitch.name == "Overloop lamp slave" then
if (mySwitch.state == 'On') then
domoticz.devices("Overloop lamp").switchOn().checkFirst().silent()
else
domoticz.devices("Overloop lamp").switchOff().checkFirst().silent()
end
end
end
}
How can this be prevented / solved.
Code: Select all
2019-03-16 09:48:29.525 Status: User: Admin initiated a switch command (819/Overloop lamp/On)
2019-03-16 09:48:30.105 (RFXCOM) Lighting 2 (Overloop lamp slave)
2019-03-16 09:48:30.273 (RFXCOM) Lighting 2 (Overloop lamp slave)
2019-03-16 09:48:30.067 Status: dzVents: Info: ------ Start external script: slave overloop.lua: Device: "Overloop lamp (Zigbee)", Index: 819
2019-03-16 09:48:30.071 Status: dzVents: Info: ------ Finished slave overloop.lua
2019-03-16 09:48:30.073 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2019-03-16 09:48:30.239 Status: dzVents: Info: ------ Start external script: slave overloop.lua: Device: "Overloop lamp (Zigbee)", Index: 819
2019-03-16 09:48:30.243 Status: dzVents: Info: ------ Finished slave overloop.lua
2019-03-16 09:48:30.244 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2019-03-16 09:48:30.411 Status: dzVents: Info: ------ Start external script: slave overloop.lua: Device: "Overloop lamp (Zigbee)", Index: 819
2019-03-16 09:48:30.415 Status: dzVents: Info: ------ Finished slave overloop.lua