Notify on stuck vacuum with stoptimer

Hi,
i have the following situation: My vacuum robot starts every day on a fixed time. I know that it needs at most 50 minutes to clean the whole apartment, but sometimes gets stuck on a cable or a piece of laundry lying on the floor. So i want a notification to appear if the cleaning time is more than 50 minutes, so most possibly the robot is stuck and i need to search and rescue it when i come back home. So far so good, this is working for me now.
But, sometimes, it manages to unstuck itself, so it just takes a bit longer than 50 minutes to reach its dock again. In this case i want another notification so that i know that everything is allright again.

Currently i have this flow:

Every day at 10:30 the robot is started. At the same time, a stoptimer is started to wait for 50 minutes. If the robot’s state changed from “not docked” to “docked”, the stoptimer is stopped. If the stoptimer isn’t stopped, and the robot is still not docked afterwards, a message is created and sent out with telegram.
The problem i currently have is the last “Staubsauger kehrt zurueck” which is a state trigger from “previous state is not docked” to “current state is docked”. After that, another message should be created and also sent with telegram.
Currently, the behavior of the flow is that it evaluates if the robot is docked after the stoptimer ends, and then never triggers the node with this trigger. It seems that the message is somehow removed from the flow.

I have an assumption that this could be because there could be some time in between the last check that the robot is docked and this trigger. So i need a clarification at first: Will the last state trigger node receive a message from the previous “current state” node and is then somehow “armed”, so that it will fire a message when its trigger happens, or will the message only appear at its input, and do nothing, since the trigger isn’t triggered?

How could i implement a “if the vacuum isnt docked, wait indefinitiely long until the next node could pass the message, because its trigger constraing has triggered”?

OK, i see the node is not so good visible, so i have exported the flow on pastebin: https://pastebin.com/SLAUA4dw

[{"id":"e22b9f16.bf003","type":"cronplus","z":"56b1c979.b2c618","name":"10:30 Uhr","outputField":"payload","timeZone":"","options":[{"topic":"Starte Saugvorgang","payload":"","type":"str","expression":"0 30 10 * * *"}],"x":92,"y":464,"wires":[["c835d5d7.5308c8","d69e6228.1f778"]]},{"id":"c835d5d7.5308c8","type":"api-call-service","z":"56b1c979.b2c618","name":"Starte Staubsaugerroboter","version":1,"debugenabled":false,"service_domain":"vacuum","service":"start","entityId":"vacuum.xiaomi_vacuum_cleaner","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":312,"y":464,"wires":[["d141dbd8.c17658"]]},{"id":"7e7e6f15.80cc9","type":"change","z":"56b1c979.b2c618","name":"Nachricht zusammenbauen","rules":[{"t":"set","p":"payload","pt":"msg","to":"Der Staubsauger hat sich vermutlich irgendwo festgefahren","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Saugvorgang dauert ungewöhnlich lang.","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":792,"y":464,"wires":[["c53c6103.eb16e","c168df3c.7aa1c"]]},{"id":"858cb5dd.31b298","type":"change","z":"56b1c979.b2c618","name":"Nachricht zusammenbauen","rules":[{"t":"set","p":"payload","pt":"msg","to":"Der Staubsauger ist wieder gedockt.","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Saugvorgang beendet.","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":792,"y":512,"wires":[["c168df3c.7aa1c","c53c6103.eb16e"]]},{"id":"c168df3c.7aa1c","type":"api-call-service","z":"56b1c979.b2c618","name":"Telegram an Frauke","version":1,"debugenabled":false,"service_domain":"notify","service":"telegram_frauke","entityId":"","data":"{\"title\":\"{{ topic }}\",\"message\":\"{{ payload }}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1060,"y":464,"wires":[[]]},{"id":"c53c6103.eb16e","type":"api-call-service","z":"56b1c979.b2c618","name":"Telegram an Simon","version":1,"debugenabled":false,"service_domain":"notify","service":"telegram_simon","entityId":"","data":"{\"title\":\"{{ topic }}\",\"message\":\"{{ payload }}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1050,"y":512,"wires":[[]]},{"id":"d141dbd8.c17658","type":"ha-wait-until","z":"56b1c979.b2c618","name":"wait until docked?","outputs":2,"entityId":"vacuum.xiaomi_vacuum_cleaner","entityIdFilterType":"exact","property":"state","comparator":"is","value":"docked","valueType":"str","timeout":"50","timeoutType":"num","timeoutUnits":"minutes","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":538,"y":464,"wires":[[],["7e7e6f15.80cc9","1a839b27.1cb245"]]},{"id":"49cfb758.fb9508","type":"trigger-state","z":"56b1c979.b2c618","name":"Vacuum","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"vacuum.xiaomi_vacuum_cleaner","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"o01ny7bj64","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"includes","comparatorValueDatatype":"list","comparatorValue":"returning,docked"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":412,"y":512,"wires":[["858cb5dd.31b298","d69e6228.1f778"],[]]},{"id":"d69e6228.1f778","type":"change","z":"56b1c979.b2c618","name":"disable","rules":[{"t":"set","p":"disable","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":252,"y":512,"wires":[["49cfb758.fb9508"]]},{"id":"1a839b27.1cb245","type":"change","z":"56b1c979.b2c618","name":"enable","rules":[{"t":"set","p":"enable","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":578,"y":560,"wires":[["49cfb758.fb9508"]]}]

You could also add two additional constraints to the trigger-state node “Vacuum” that would check if someone is not home and not send the notification which the assumption if someone is home then they were the one who probably returned the vacuum to the base station.

image

edit:
different version

[{"id":"2da9bcf7.cdb654","type":"cronplus","z":"56b1c979.b2c618","name":"10:30 Uhr","outputField":"payload","timeZone":"","options":[{"topic":"Starte Saugvorgang","payload":"","type":"str","expression":"0 30 10 * * *"}],"x":92,"y":640,"wires":[["5efd07ca.73a268"]]},{"id":"5efd07ca.73a268","type":"api-call-service","z":"56b1c979.b2c618","name":"Starte Staubsaugerroboter","version":1,"debugenabled":false,"service_domain":"vacuum","service":"start","entityId":"vacuum.xiaomi_vacuum_cleaner","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":312,"y":640,"wires":[["ee4b3554.7efff8"]]},{"id":"cd4f3d7c.6a30b","type":"change","z":"56b1c979.b2c618","name":"Nachricht zusammenbauen","rules":[{"t":"set","p":"payload","pt":"msg","to":"Der Staubsauger hat sich vermutlich irgendwo festgefahren","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Saugvorgang dauert ungewöhnlich lang.","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":792,"y":640,"wires":[["a3ff1cf9.1fddd","e782ae25.bc32a"]]},{"id":"381c3358.2463dc","type":"change","z":"56b1c979.b2c618","name":"Nachricht zusammenbauen","rules":[{"t":"set","p":"payload","pt":"msg","to":"Der Staubsauger ist wieder gedockt.","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Saugvorgang beendet.","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":792,"y":688,"wires":[["e782ae25.bc32a","a3ff1cf9.1fddd"]]},{"id":"e782ae25.bc32a","type":"api-call-service","z":"56b1c979.b2c618","name":"Telegram an Frauke","version":1,"debugenabled":false,"service_domain":"notify","service":"telegram_frauke","entityId":"","data":"{\"title\":\"{{ topic }}\",\"message\":\"{{ payload }}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1060,"y":640,"wires":[[]]},{"id":"a3ff1cf9.1fddd","type":"api-call-service","z":"56b1c979.b2c618","name":"Telegram an Simon","version":1,"debugenabled":false,"service_domain":"notify","service":"telegram_simon","entityId":"","data":"{\"title\":\"{{ topic }}\",\"message\":\"{{ payload }}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1050,"y":688,"wires":[[]]},{"id":"ee4b3554.7efff8","type":"ha-wait-until","z":"56b1c979.b2c618","name":"wait until docked?","outputs":2,"entityId":"vacuum.xiaomi_vacuum_cleaner","entityIdFilterType":"exact","property":"state","comparator":"is","value":"docked","valueType":"str","timeout":"50","timeoutType":"num","timeoutUnits":"minutes","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":538,"y":640,"wires":[[],["cd4f3d7c.6a30b","355224f9.7aeabc"]]},{"id":"355224f9.7aeabc","type":"ha-wait-until","z":"56b1c979.b2c618","name":"wait until docked?","outputs":1,"entityId":"vacuum.xiaomi_vacuum_cleaner","entityIdFilterType":"exact","property":"state","comparator":"includes","value":"returning,docked","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"minutes","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":282,"y":688,"wires":[["5dd8242a.67e36c"]]},{"id":"5dd8242a.67e36c","type":"api-current-state","z":"56b1c979.b2c618","name":"nobody home?","version":1,"outputs":2,"halt_if":"$entity().state != \"not_home\" and $entities(\"person.frauke\").state != \"not_home\"","halt_if_type":"jsonata","halt_if_compare":"jsonata","override_topic":false,"entity_id":"person.simon","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":528,"y":688,"wires":[["381c3358.2463dc"],[]]}]
1 Like

Okay, thanks a lot. I was not aware of the existence of home_assistant_wait_until until now, this node could make other flows i have a lot easier as well.