Watches a switch and, when it turns itself off, switches it back on — waiting longer before each attempt, and giving up after a set number of tries.
I wrote it for a residual-current device that trips on damp: the kind of trip that clears by itself hours later, leaving a freezer off in the meantime.
Source: github.com/driin0/home-assistant-blueprints
Please read this first
This is not an auto-reclosing RCD and cannot be one. A commercial auto-reclosing device measures the line’s insulation before closing, and refuses to reclose if the leakage is still there. That measurement is the thing you are paying for, and no automation can perform it.
This blueprint has no way to tell a spurious trip from a genuine fault before restoring power. It restores power and watches whether the circuit stays up — a check made after the fact. On a real insulation fault, power returns to the faulty circuit for a few seconds, as many times as you allow attempts.
Keep the number of attempts low, and think about what the protected circuit actually is before using this at all.
How it works
When the switch turns off, the automation immediately disables its own control boolean, then starts trying. Each attempt waits longer than the last — 5 s, 10 s, 20 s with the default multiplier — up to a ceiling you set, because an uncapped exponential delay grows to absurd values.
An attempt counts as successful only if the circuit stays up for the success timeout. If it does, the control boolean is switched back on and the cycle stops. If every attempt fails, the boolean is left off: automatic restarting stays disabled until a person re-enables it. Something that re-arms itself after an inconclusive outcome is exactly what you do not want on a protective device.
When the device disappears with the power
If the switch is a network device that goes offline when it loses power — or when a router reboot takes the network down with it — set a connectivity sensor: a binary_sensor or a device_tracker reporting whether the device is reachable. The automation then waits for it to come back, and confirms the switch is still off, before trying anything. Commanding a device that cannot hear you achieves nothing.
Every wait is bounded. If the device never returns, the cycle ends with a notification instead of hanging — which matters because the automation runs in single mode, and one hung cycle would block every later trip from being handled.
Notifications
Optional, separately worded for each outcome: tripped, restarted, attempt failed, gave up, and device never came back. Every text is a field you can rewrite, in any language, with {{switch_name}}, {{current_attempt}}, {{next_attempt}} and {{max_attempts}} available.
Requires Home Assistant 2024.6 or newer. MIT licensed.
An Italian version lives as a Gist for those who imported it from there; the maintained version is the one in the repository.