after updating to domoticz 2021.1 from 2020.1 something seems to be changed.
i have the script listed below, it does the following:
i have a gate, which has a dry contact relay for activating it, and a reed switch for detecting when the gate is open or closed, for when it is used with the built in code pad or remote.
now, i wanted to combine that input and output into one switch which could tell the state of the gate and open/close it according to the current state, so when i was comming home i could see if it was already open or closed and activate when necessary with the same switch.
but this script broke with the last update of domoticz.
it seems that te .silent() function no longer works.
the behaviour i am seeing is that when the gate is activated and it goes far enough that it changes the state of te reed switch, it activates again which initiates the stop function and i end up with a gate that is half open/half closed.
there is also a function built in to the script which automatically closes the gate at 22.00 and between 22.00 and 04.00 it closes again after 5 minutes and on sunday it also closes after 5 minutes.
i hope someone can help me to fix the script and restore the functionality.
the script that is currently broken but worked before:
Code: Select all
return {
on ={
devices ={
'Hek',
'Status hek'
},
timer={
'every 5 minutes'
}
},
execute = function(dz, device)
local hek = dz.devices("Hek")
local status = dz.devices("Status hek")
local activate = dz.devices("Activeer hek")
local zondag = dz.devices("Zondag")
if hek.state == "Off" and status.lastUpdate.secondsAgo > 5 then
activate.switchOn()
elseif hek.state == "On" and status.lastUpdate.secondsAgo > 5 then
activate.switchOn()
elseif status.state == "Off" and hek.state == "Off" and hek.lastUpdate.secondsAgo > 5 then
hek.switchOn().silent()
elseif status.state == "On" and hek.state == "On" and hek.lastUpdate.secondsAgo > 5 then
hek.switchOff().silent()
end
if (dz.time.matchesRule("at 22:00-04:00") or zondag.state == "On") and hek.state == "On" and hek.lastUpdate.minutesAgo > 5 then
hek.switchOff()
end
end
}