Guys, I’m pulling my hair out on this!
I have created an automation for monitoring a washing machine, which can have the following three states on a input_select helper entity: - Washing - Finished - Cleared
The automation works mostly but at the very end of the washing process, the input_select state of the washing machine gets stuck on “Finished” and does never change again to someting else.
So when the door of the washing machine gets opened after the washing proccess, the state never changes to “Cleared” and even starting a new washing process does not change the state to “Washing” again.
You can see on the timeline, from 10:05 on, the washing machine is not consuming power anymore for more than 5 minutes which indicates the washing process is finished. This works as intended so far and a telegram message is being send correctly every 30 minutes. So far, so good.
Then you can see on 11:13 approximately, the door was being opened (and on 11:14 the door was being closed again to start a new washing process) but the state was never changed to “Cleared”. It gets stuck on “Finished”. Which results in telegram messaged keep being sent forever.
When I change the state back to “Cleared” manually, everything works again until the next washing process being finished.
Any ideas what the problem could be? Any help is very appreciated!
EDIT:
I just had a thought: As I am using trigger IDs and therefore this is a single automation, the automation may get stuck in the while loop for 30 minutes and therefore never changes the state, even when the door is being opened. Could that be the problem? Do I have to separate the automation containing the while loop from the other two automations?
You can aso change this delay for a wait_for_trigger and wait 30 min until the door is opened, then the delay will ato when you open the door.
Then you have to change your trigger on the door to have triggered when the door is opened for 5 sec, so you know the automation will be finished before it detects the door opening.
Ooh, I was not aware of the wait_for_trigger option, which could be very handy in this case.
Also I changed the “while” loop to an “until” loop (probably not necessary, but it looks better for understanding).
Now it looks like this:
Let’s see if this works now, I’ll report back next time my wife starts a washing process
P.S. Unfortunately I did not really understand what you are trying to tell me by this:
Then you have to change your trigger on the door to have triggered when the door is opened for 5 sec, so you know the automation will be finished before it detects the door opening.
I had similar issues keeping input select in sync. I used a different approach. I created template switches for each of input select items (input_select.select_option) in my case Off, Dark, Relaxed and Bright . Used so I can trigger Light moods in Alexa and my dashboard
So you can trigger the input select via the switches . The switches will always match the item select and best of all they dont trigger if you change the option in the item select.
I’ll definitely have a look on it.
However I changed my idea again, deleted the first trigger-id based action option and added an if-then option like this instead:
Well, as your automation is set on single mode, if any of the triggers happens while the automation is already running, it won’t be running again and instead you might have just an info on your log file.
When it finishes the washing, the automation will be running until you open the door, so that trigger based on the door opening will never trigger (as the automation is already running).
Now you are ending your automation also when the door opens, so it probably will take a few milliseconds until the door could be used as a trigger again, but your trigger isn’t giving that time.
So, if you change your trigger from “door opened” to “door opened for 5 seconds” this problem is solved, as the trigger will be evaluated 5s after the automation finishes (or you can try 1s).
Or you can simply change your automation mode from single to restart, then this problem has gone (and probably will be more reliable).
Now I got ya, thanks a lot man!
Do you maybe know if on the following screenshot the third action (if-action) is only being executed as soon as the second action (repeat-action) is being quit? Am I getting this right? If so, I guess the last code I’ve posted above could be the solution.
You have to take in account that your automation can be interrupted by something externally… Let’s say your Home Assistant restarts for some reason… It can take hours until you take the clothes from the washing machine and everything can happen… If that is the case, your select helper will stay on “Washing” or “Finished” state forever, so you should plan for that and work on your triggers to handle those cases.
I just wanted to report back that it works now as intended with my latest solution I posted above.
Thanks a bunch you for your time guys, very appreciated!