Help wanted with ventilation script
Posted: Tuesday 30 October 2018 22:18
Hi,
I'm new to dzVent scripting and thought to setup a ventilation script.
Unfortunately it is not as easy as I thought
I have a ventilation box with multiple levels which I can control wit a selector switch in domoticz.
The actual state of the box is sent to domoticz using ESPEasy.
What I'm trying to achieve is the following:
between 07:00 and 22:00 (daytime) the ventilation box may run at a higher speed (switch level 10) and if the humidity rises above 60 % it is supposed to run at switch level 30.
Between 22:00 and 07:00 (nighttime) the ventilation box must run at a lower speed (switch level 00) and if the hunidity rises above 60% it is supposed to run at switch level 10.
I've searched the wiki and tried to use examples. So far I created the following script, but is does not work as expected.
It only seems to run the daytime part. I'm probably overthinking this and missing something (for me not so) obvious.
Can you guys give me som pointers ?
Thanks.
I'm new to dzVent scripting and thought to setup a ventilation script.
Unfortunately it is not as easy as I thought

I have a ventilation box with multiple levels which I can control wit a selector switch in domoticz.
The actual state of the box is sent to domoticz using ESPEasy.
What I'm trying to achieve is the following:
between 07:00 and 22:00 (daytime) the ventilation box may run at a higher speed (switch level 10) and if the humidity rises above 60 % it is supposed to run at switch level 30.
Between 22:00 and 07:00 (nighttime) the ventilation box must run at a lower speed (switch level 00) and if the hunidity rises above 60% it is supposed to run at switch level 10.
I've searched the wiki and tried to use examples. So far I created the following script, but is does not work as expected.
It only seems to run the daytime part. I'm probably overthinking this and missing something (for me not so) obvious.
Can you guys give me som pointers ?
Thanks.
Code: Select all
return {
on = {
timer = {'every minute'}
},
execute = function(domoticz, timer)
if (domoticz.time.hour >=7 and domoticz.time.hour <22) then
domoticz.log('het is overdag')
if domoticz.devices('Thermo Badkamer').humidity >= 60 then
domoticz.log('Het is vochtig op de badkamer!', domoticz.LOG_INFO)
if domoticz.devices('Ventilatie').switchSelector < 40 then
domoticz.log('Er is geen timer ingesteld', domoticz.LOG_INFO)
domoticz.devices('Ventilatie').switchSelector(20)
end
if domoticz.devices('Thermo Badkamer').humidity <= 60 then
domoticz.log('Het is niet (meer)vochtig op de badkamer!', domoticz.LOG_INFO)
domoticz.devices('Ventilatie').switchSelector(10)
end
elseif (domoticz.time.hour >=22 and domoticz.time.hour <7) then
domoticz.log('het is avond/nacht')
if domoticz.devices('Thermo Badkamer').humidity >= 60 then
domoticz.log('Het is vochtig op de badkamer!', domoticz.LOG_INFO)
if domoticz.devices('Ventilatie').switchSelector < 40 then
domoticz.log('Er is geen timer ingesteld', domoticz.LOG_INFO)
domoticz.devices('Ventilatie').switchSelector(10)
end
if domoticz.devices('Thermo Badkamer').humidity <= 60 then
domoticz.log('Het is niet (meer) vochtig op de badkamer!', domoticz.LOG_INFO)
domoticz.devices('Ventilatie').switchSelector(00)
end
end
end
end
end
}