I’m trying to figure out how to trigger a flow and send a notification if the triggering sensor state does not change for 5 seconds. This use case is for a sonoff that sometimes stars to go unavailable for 1 second and back to normals… which could continue for a few minutes. I want to get the notification in the following scenarios:

Thanks @subzero79, that works. Looks like I’m going to have to just clone that one to as many states as I know there will be for that entity and make sure it’s not jumping back to the original state.

If anyone has some ideas about how to use one process where the second state node after 5 seconds compares it to the result of the first (without knowing all the states beforehand)… like storing first one into a variable and then referencing it if it’s still the same, that would be helpful in future.

I may misunderstand your need but to me it sounds like using a switch,delay and state node would do what you want?[{"id":"7c312acb.5290c4","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ee5e415c.f67bc","type":"server-state-changed","z":"7c312acb.5290c4","name":"Event State","server":"74cbfde1.f316f4","entityidfilter":"light.bedroom","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":128.10000610351562,"y":136.00000095367432,"wires":[["3c16e83e.51c408"]]},{"id":"3c16e83e.51c408","type":"switch","z":"7c312acb.5290c4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"availible","vt":"str"},{"t":"eq","v":"unavailible","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":321.1000061035156,"y":136.00000190734863,"wires":[["610e9ee7.ff40a"],["1c06ffd7.447db"]]},{"id":"1c06ffd7.447db","type":"delay","z":"7c312acb.5290c4","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":470.8500633239746,"y":153.7500057220459,"wires":[["cfae8f1f.c9499"]]},{"id":"cfae8f1f.c9499","type":"api-current-state","z":"7c312acb.5290c4","name":"Current State","server":"74cbfde1.f316f4","outputs":2,"halt_if":"availible","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.bedroom","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":642.8501129150391,"y":156.0000171661377,"wires":[["de777c67.5067b"],[]]},{"id":"de777c67.5067b","type":"debug","z":"7c312acb.5290c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":887.6251258850098,"y":132.50001525878906,"wires":[]},{"id":"610e9ee7.ff40a","type":"delay","z":"7c312acb.5290c4","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":470.00001525878906,"y":117.50000190734863,"wires":[["1bcfc11c.ae48af"]]},{"id":"1bcfc11c.ae48af","type":"api-current-state","z":"7c312acb.5290c4","name":"Current State","server":"74cbfde1.f316f4","outputs":2,"halt_if":"unavailible","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.bedroom","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":643.7500152587891,"y":118.75000190734863,"wires":[["de777c67.5067b"],[]]},{"id":"74cbfde1.f316f4","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

If anyone has some ideas about how to use one process where the second state node after 5 seconds compares it to the result of the first (without knowing all the states beforehand)… like storing first one into a variable and then referencing it if it’s still the same, that would be helpful in future.

You can use flow context(variables, objects or arrays) to store and use them to compare it in state nodes.

Nice, this is EXACTLY what I was trying to do! The only problem is that it’s not working as I expected.

If I flip the switch again within 5 seconds, the flow.light_state will get updated again with the newer state and it will still always match the second sensor reading after 5 seconds. Also, if I flip the switch multiple times within that 5 seconds it will send all of those messages. So there are a few things to work out, but it’s definitely a great start.