skip dzvents action at domoticz startup
Posted: Saturday 16 November 2024 23:44
Version: Domoticz 2024.7 (build 16325)
Platform: DietPi 9.8.0 on Odroid C4
Plugin/Hardware: Generic sysfs GPIO, MQTT Auto Discovery Client Gateway with LAN interface, Satel Integra via LAN interface, Open Weather Map, Evohome via Web API, Kodi Media Server, Dummy (Does nothing, use for virtual switches only) .
Description: Hello all.
I did a script that turns on the entrance light when my satel integra is deactivate at nighttime or my blinds are closed. Here the code:
My goal is to prevent the light on at domoticz start, but this doesn't work. Light is always turned on as the "contatore" variable seems ignored.
What I'm doing wrong? Is there a better way to skip the first trigger at domoticz start?
Platform: DietPi 9.8.0 on Odroid C4
Plugin/Hardware: Generic sysfs GPIO, MQTT Auto Discovery Client Gateway with LAN interface, Satel Integra via LAN interface, Open Weather Map, Evohome via Web API, Kodi Media Server, Dummy (Does nothing, use for virtual switches only) .
Description: Hello all.
I did a script that turns on the entrance light when my satel integra is deactivate at nighttime or my blinds are closed. Here the code:
Code: Select all
return {
on = {
devices = { 'Satel INTEGRA' }
},
data = {
contatore = { initial = 0 }
},
execute = function(domoticz, device)
if (device.inActive and domoticz.data.contatore == 1) then
local tapparelle = domoticz.devices('Tapparella cucina').level +
domoticz.devices('Tapparella sala').level +
domoticz.devices('Tapparella bagno SX').level +
domoticz.devices('Tapparella bagno DX').level +
domoticz.devices('Tapparella cameretta').level +
domoticz.devices('Tapparella camera da letto').level
if (domoticz.time.matchesRule('at civilnighttime') or tapparelle == 0) then
if domoticz.devices('Plafoniera corridoio').inActive then
domoticz.devices('Plafoniera corridoio').dimTo(100).forMin(5)
end
end
end
domoticz.data.contatore = 1
end
}
What I'm doing wrong? Is there a better way to skip the first trigger at domoticz start?