1x rooted toon thermostat
1x raspberry pi 4b running raspbian buster and latest domoticz
1x rflink (arduino mega with 433mhz)
1x presence script to scan the mobile phones and set a switch to on/off in domoticz
1x toon script from internet to have all switches and information.
I have a dzscript what is putt together from different scripts and inputs from other website, but its still not working like a want it to be.
The idee is when both mobile phones are away toon is switched to away setting (setpoint 10) and if one or both are at home it will set to setpoint 30.
Only running between time settings and only in winter months.
The problem is it will run even after the running time(19.59-06.59) , and it will switch back to home(after 1 min if someone is home) if the option comfort (setpoint 40) or sleeping (20) is active.
Can someone help me with the correct script, below is what i have now.
Code: Select all
return {
on = {
-- timer riggers
timer = {
-- timer triggers.. if one matches with the current time then the script is executed
domoticz.time.matchesRule ('in week -14, 43-')
domoticz.time.matchesRule('every minute on mon,tue,thu,fri at 07:01-19:59')
domoticz.time.matchesRule('every minute on sat,sun at 08:01-19:59')
function(domoticz)
-- return true or false
end
},
devices = {8, 9}, -- Zet hier de IDX'en neer van jullie telefoonswitches
},
logging = {
level = domoticz.LOG_INFO,
marker = "Telefoonscript"
},
execute = function(domoticz, device)
local telefoon1 = domoticz.devices(8) -- nummer invullen van telefoons net als bij On
local telefoon2 = domoticz.devices(9) -- idem als bij telefoon1
toon = domoticz.devices(14) -- nummer invullen van je Toon
if(telefoon1.state == "Off" and telefoon2.state == "Off") then
toon.switchSelector(10) -- aanpassen naar de juiste waarde voor Weg in de toon
domoticz.log('Iedereen is weg, Toon wordt geschakeld naar Weg.')
else
if(telefoon1.state == "On" or telefoon2.state == "On") then
toon.switchSelector(30) -- aanpassen naar de juiste waarde voor Thuis in de toon
domoticz.log('Iemand is thuis, Toon wordt geschakeld naar Thuis.')
else
domoticz.log('Er is nog iemand thuis, Toon wordt niet geschakeld naar Weg.')
end
end
end
}