Hi
Ive got some trouble configure the fan automation. I would like to change the ventilator to 2 when the bathroom humidity is above 50% but for 30 min max.
When it’s 7 pm it needs to set back to the lowest point (1).
But how can I avoid this scenario: when it triggers at 6:45 pm for instance, it changes to level 2 but it cant continue after 7 pm > then it must change back to level 1. The same applies for every time before 7 pm. So before 7 pm its allowed to use level 2, after its not
Hi, thx for the advice! I will test it in the upcoming days.
One question, when I want to add more triggers in the future. Do I need to define it twice like you did with the bathroom trigger?
Or did you do that only for defining the variables
And this line
level: "{{ iif(now().hour < 7, 2, 1) }}"
The 7 stands for 7 pm I guess? And the 1 and 2 for the fan level?
The automation has three triggers and one service call that sets the fan’s preset_mode. Each trigger has a level variable that is used to set the preset_mode’s value to either 1 or 2.
Time Trigger
At 19:00 it sets preset_mode to 1.
Numeric State Trigger
When the humidity increases and crosses the threshold value of 50, it sets preset_mode to 2 if the hour is before 19 otherwise it sets it to 1.
Numeric State Trigger
When the humidity increases and crosses the threshold value of 50, and stays above 50 for at least 30 minutes, it sets preset_mode to 1.
The 7 is a mistake I made and should be 19 (I have corrected the example).
hmm I get some unexpected run results. It looks like it’s not filling in the variable, it’s empty (the preset_mode) and that’s why it’s failing I guess.
I changed the automation slightly, because 1 needed to be low and 2 medium.
In that case, you need to delimit the two words with quotes to indicate they are strings. Otherwise they’ll be interpreted as the names of (non-existent) variables.
Hi @123 I have seen some strange behavior in the latest updated automation.
It triggers and sets to medium at times I don’t expect. Before 7 pm can be any time, or does this “reset” at 0:00?
Can’t we make it a time-to-time approach to make automation robust? for example from 7 PM to 6 AM in the morning, the level must be low, so not changeable. And the rest of the time of a day, it may change to medium if it triggers.
It’s currently designed to operate the way you requested. It sets the fan to medium, whenever humidity increases above 50 for 30 minutes, as long as the current hour is less than 19 (meaning between 0 and 18 inclusively).
The “to 6 AM” is a new requirement; it wasn’t mentioned in your first post (or subsequent ones). However it’s easy to adapt the existing template to support it.
The following template sets the fan speed to medium if the current hour is greater than or equal to 6 and less than 19, otherwise it’s set to low.