Hi,
I try to control a circulation pump for hot water main pipe in my house.
I created a helper of type input_boolean and an automation. I also created a helper of type timer to limit the runtime of the pump if something wents wrong.
I measure the temperature at the end of the circulation pipe, so I know the point in time when the main pipe is filled with hot water.
This looks not that complicated, I thougt.
The automation gets 4 triggers, input off-on, input on-off, timer elaped and temperatur above limit.
When I have to switch the pump off, I have to switch my relay (Shelly plus 1) and cancle the timer.
If the timer elaped or the temperature limit is reached, I have to do the same; more or less, BUT I have also to switch the input_boolean off, otherwise it remains on and my UI shows the wrong state.
BUT when I do so, the event input_boolean on-off is fired and my automation (the same as the running one) is listening.
How to deal with this situations in HA correctly?
Is the current work done by the automation and after firing the next event a new cycle starts over, or works it totally different.
I have a solution, but get warnings in the log and some times it stucks.
That’s a lengthy automation. Here’s my interpretation of it:
It triggers from:
input_boolean turning on
input_boolean turning off
temperature over 26 for 5 minutes
timer finishing
If triggered from input_boolean turning on:
if the temperature is below 22 and it’s not a holiday, start the timer and turn on the pump
otherwise, turn the input_boolean off (which will trigger the automation again!)
If triggered from input_boolean turning off:
turn off the pump
cancel the timer
If triggered by temperature, and the pump is on:
turn the pump off
cancel the timer
wait 1s
turn the input_boolean off (which will trigger the automation again!)
If triggered by the timer finishing:
turn the pump off
wait 1s
turn the input_boolean off (which will trigger the automation again!)
The default sequence (pump off, input_boolean off) should only be executed if you run the automation manually, and that will trigger another run if the input_boolean was on beforehand.
Read up on the automation modes, and see if any of those will help you:
You were more or less correct with yout interpretation.
The problem is:
How can I reflect the state of the pump in my UI (best with not directly refere the device).
My UI is ‘connected’ to the input_boolean’, and when the timer triggers the automation, the state of the input_boolean isn’t changed.
Thats a very basic pattern for automations, so how can I do this with HA?
Hi Troon,
I know, but I want to seperate UI from automation (seperation of concerns, a golden rule).
Now I have set the automation mode to ‘queued’, that works out. I also could delete lot of duplicates! If the timer expires, it just switches the input_boolean to ‘off’, like I can do manual. And this puts an event in the queue to trigger the general ‘on-to-off’ actions (switch the pump off and cancle the timer).
UI follows all the states, looks fine now.
Thanks.
One problem remaining (as usual): In the history, the temperatures were logged, the pump status (relay in device) is logged but the timer and the input_booleean always stay in their idel states.
Not really that bad, config that for debugging, but …