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?