I want to start my mechanical ventilation by temp and/or humidity.
Right now i use a temp sensor and if a threshold is reached the fan starts.
But that also means that this happens when i turn on the hot water for washing hands.
I want to turn the ventilation on after a couple of minutes.
So if temp > 45 degrees for 5 minutes then ......
But 'for' is only used in a commandarray while i want it to use in a devicechanged or othervalues.
How do i do this or is it even possible?
How to check is devices is changed for a couple of minutes within LUA?
Moderator: leecollings
-
- Posts: 79
- Joined: Thursday 23 October 2014 22:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: How to check is devices is changed for a couple of minutes within LUA?
I've tried a few different ways of managing timers but in the end I've always come back to using the user variables to keep track of time.
Create a ventilation_timer variable set to 0. Have a timer script that checks if the temp is > 45 and adds one to the count (timer scripts are checked every minute). If the count is greater than 5 then turn the switch on. If the temp drops below 45 then reset the count to zero.
Something roughly like this... (the temp sensor stuff is definitely wrong.. this is just for illustration)
Hope this helps.
Create a ventilation_timer variable set to 0. Have a timer script that checks if the temp is > 45 and adds one to the count (timer scripts are checked every minute). If the count is greater than 5 then turn the switch on. If the temp drops below 45 then reset the count to zero.
Something roughly like this... (the temp sensor stuff is definitely wrong.. this is just for illustration)
Code: Select all
if ( otherdevices[tempsensor]> 45) then
--the sensor is over 45, so add 1 to our timer
commandArray['Variable:ventilation_timer']= tostring(uservariables["ventilation_timer"] + 1)
else
--the sensor is under 45, so reset our timer
commandArray['Variable:ventilation_timer']=0
end
if ( uservariables["ventilation_timer"]> 5) then
commandArray['Ventilation System']='On'
else
commandArray['Ventilation System']='Off'
end
- bizziebis
- Posts: 182
- Joined: Saturday 19 October 2013 14:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8805
- Location: The Netherlands
- Contact:
Re: How to check is devices is changed for a couple of minutes within LUA?
I use this script for over a year now: http://www.domoticz.com/wiki/Humidity_control
Does everything you want.
Setting a fixed temperature or humidity to trigger the fan is not always convenient. This script will do better
Does everything you want.
Setting a fixed temperature or humidity to trigger the fan is not always convenient. This script will do better

-
- Posts: 191
- Joined: Wednesday 26 November 2014 18:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: How to check is devices is changed for a couple of minutes within LUA?
Thanks both,
I used the variable option as i already have a script using another variable to see if there is used a manual switch or not.
Bizziebis, i like the script but i already have a different script.
Maybe in the future as i really like it.
I used the variable option as i already have a script using another variable to see if there is used a manual switch or not.
Bizziebis, i like the script but i already have a different script.
Maybe in the future as i really like it.
Who is online
Users browsing this forum: No registered users and 1 guest