In the first āaboveā parameter in the sample code, I have written above: '{{ max_dew }}', but the UI complains with āMessage malformed: expected float for dictionary value @ data[āaboveā]ā . I also tried above: "{% max_dew | float %}" and other variations without success.
My intent is to reuse these variables in action conditions as well.
Is this possible? If yes, what is the right way to do it?
I manage the extraction fan in the bathroom using an automation that enables the fan if the absolute humidity is above a given level and the exterior humidity is below a certain level.
I already have the automation further below which works, but has the following side-effects:
While the fan is on, itās filling up the log with the checks in the repeatā¦while loop;
When changing a limit, I have to change it in multiple locations.
So I wanted to:
Use variables for the limits so that they are easier to adjust;
Not use a repeatā¦until, but rather trigger on the hystereris levels and when the fan is on/off, check if it has to be turned off/on according to the hysteresis levels.
You can make 2 input_numbers and use them in all those places. Secondly, is there any reason why you arenāt using a wait_for_trigger instead of the while loop? Use wait for trigger with 2 triggers and a timeout of 40 minutes where you continue on timeout.
I probably tried the āwait_for_triggerā - the issue I had with it is that it only triggers when one of the values change, so not when the condition is already true when wait_for_trigger is evaluated.
Iāll probably get away with it when used in a regular way, but when starting it manually, the fan is turned on (the condition is skipped) and not turning off while the humidity levels are low enough already.
I think I went with the solution that I could test.
For now, I am not using input numbers yet (as far as I understand they haved to be defined āoutsideā the automation), but I have:
While the wait_for_trigger did not have a timeout specified and I did not intervene on the automation (no update, no cancel), the trace shows the 'wait_for_trigger` was canceled, so the fan continued running beyond 12:45PM at which time the trigger condition was met: