dannybloe wrote:I think that such a script won't do you any good on the long run. The thing is that this 60% threshold varies from day to day. A while ago I had a hygrostat that was supposed to switch on the fan when a certain amount of humidity was registered in the bathroom but I ended up adjusting this threshold almost every day. On a rainy day it was different than on a cold winter's day. I ditched the hygrostat and created the script
https://www.domoticz.com/wiki/Humidity_control. That registers a relative rise in humidity level and tries to dehumidify to the level just before the rise. Works like a charm. But you need a humidity sensor of course.
hello,
I have edit my script. If the humidity is above 65%, the fan wil turn on for 10 minutes. The script does this once per hour
Code: Select all
t1 = os.time()
s = otherdevices_lastupdate['Fan']
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
commandArray = {}
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = (os.difftime (t1, t2))
if devicechanged['Badkamer_Humidity'] ~= nil then
print("luchtvochtigheid in de Badkamer update: " .. devicechanged['Badkamer_Humidity'] .. " Fan:" .. otherdevices['Fan'])
if (devicechanged['Badkamer_Humidity'] >= 65) then
if (otherdevices['Fan'] == 'Off' and difference > 3600 and difference < 3660) then
print("luchtvochtigheid in de Badkamer is groter dan 65%, zet ventilator aan. ")
commandArray['Fan']='On FOR 10'
end
end
end
return commandArray
But thanks for your replay, I'm going to see how the Humidity control script works and maybe I'm going to use that script