Code: Select all
local ESP1_Lux = 111
return {
on = {
devices = {[ESP1_Lux] = {'between 06:00 and 16:00', 'every 3 minutes'}}
},
execute = function(domoticz)
--domoticz.devices(ESP1_Lux).dump()
domoticz.log(domoticz.devices(ESP1_Lux).lux)
if domoticz.devices(ESP1_Lux).lux < 160 and
(domoticz.time.hour >= 16 and domoticz.time.hour <= 23) and
domoticz.variables('IsDarkLux').value == 0 then
domoticz.devices(IsDonkerS).switchOn()
domoticz.variables('IsDarkLux').set(1)
end
if domoticz.devices(ESP1_Lux).lux > 170 and
(domoticz.time.hour >= 16 and domoticz.time.hour <= 23) and
domoticz.variables('IsDarkLux').value == 1 then
domoticz.devices(IsDonkerS).switchOff()
domoticz.variables('IsDarkLux').set(0)
end
if domoticz.devices(ESP1_Lux).lux < 120 and
(domoticz.time.hour >= 4 and domoticz.time.hour < 16) and
domoticz.variables('IsDarkLux').value == 0 then
domoticz.devices(IsDonkerS).switchOn()
domoticz.variables('IsDarkLux').set(1)
end
if domoticz.devices(ESP1_Lux).lux > 130 and
(domoticz.time.hour >= 4 and domoticz.time.hour < 16) and
domoticz.variables('IsDarkLux').value == 1 then
domoticz.devices(IsDonkerS).switchOff()
domoticz.variables('IsDarkLux').set(0)
end
end
}
Code: Select all
2018-02-05 19:21:21.975 dzVents: Info: Handling events for: "Lux sensor Esp", value: "0.00"
2018-02-05 19:21:21.976 dzVents: Info: ------ Start internal script: dzV_Check_Lux: Device: "Lux sensor Esp (Dummy)", Index: 111
2018-02-05 19:21:21.976 dzVents: Info: 0
2018-02-05 19:21:21.976 dzVents: Info: ------ Finished dzV_Check_Lux
2018-02-05 19:24:22.134 dzVents: Info: Handling events for: "Lux sensor Esp", value: "0.00"
2018-02-05 19:24:22.134 dzVents: Info: ------ Start internal script: dzV_Check_Lux: Device: "Lux sensor Esp (Dummy)", Index: 111
2018-02-05 19:24:22.134 dzVents: Info: 0
2018-02-05 19:24:22.135 dzVents: Info: ------ Finished dzV_Check_Lux
2018-02-05 19:27:22.306 dzVents: Info: Handling events for: "Lux sensor Esp", value: "0.00"
2018-02-05 19:27:22.306 dzVents: Info: ------ Start internal script: dzV_Check_Lux: Device: "Lux sensor Esp (Dummy)", Index: 111
2018-02-05 19:27:22.306 dzVents: Info: 0
2018-02-05 19:27:22.307 dzVents: Info: ------ Finished dzV_Check_Lux