I posted on another thread that I noticed one of my lights was left on overnight.
At first i checked the automation to see if I had an error, then discovered this:
Error while executing automation automation.hall_lights_top_floor_v2: Failed to send request: device did not respond
It pretty rare this happens, but I thought I could use the template to check if the hall light was left on for more than 5 minutes and switch it off… and if the device doesn’t respond, try again.
I guess that also means I should consider a maximum number of retries if for example, the device has genuinely fallen off the network.
I’ve avoided the loop for cases where I have a flaky connection or device by using a wait for state trigger with a timeout. I’d then wait on the desired state for x amount if time. I find it a bit simpler. I had loops originally, but changed it when this functionality came out.