I mentioned before that I looked at the logging and it shows as expected.
If I had any behavior like On-Off-On then I would have noticed, because then the garden would be soaked with water the next day.
First you write that the logging still shows On-Off-On behavior, and then you write "it's not possible to find out in 20 minutes because about 80% of the time it's first time right On or Off"
Change the code to:
Code: Select all
local SENSOR = 'Buitenkraan'
return {
on = {
timer = { 'every 3 minutes' },
devices = { SENSOR },
},
logging = {
marker = 'WOOX',
level = domoticz.LOG_DEBUG,
},
execute = function(dz, item)
if item.isTimer then
if dz.devices(SENSOR).active then
dz.devices(SENSOR).switchOff().afterMin(1)
else
dz.devices(SENSOR).switchOn().forMin(1)
end
elseif item.isDevice then
dz.log(SENSOR..' state is: '..item.state, dz.LOG_INFO)
end
end
}