Does this exist? Will this work?

Do all ESPHome plugs automatically reboot if WiFi is lost?

I’m thinking of plugging my router into an ESPHome smart plug. If my WiFi goes down, the plug would not be able to connect and would reboot my router.

Can I set a rule where it waits X minutes before trying to connect to WiFi or rebooting my router?

Tasmota has this ability. Does such a thing exist for ESPHome?

Watchdog for Wi-Fi router or modem~

A Tasmota plug can check a remote host (router itself, something else connected to the router, or a site on the Internet) via an ICMP Ping or loading a URL and can power cycle the router or modem if the remote host isn’t responding. In this example, an interval of 3 minutes is used. The simplest watchdog rule does not use variables:

Rule1
  ON Time#Minute|3 DO backlog Ping4 192.168.1.10 ENDON
  ON Ping#192.168.1.10#Success==0 DO Backlog Power1 0; Delay 10; Power1 1; ENDON
Rule1 1

However, if the endpoint becomes unreachable for a long time, the watchdog will keep cycling it every three minutes. This could reduce the watchdog’s relay lifetime to months, at most years. A safer option would be to use an exponential backoff algorithm. Var1 contains the current interval in minutes, which is tripled after each failed query, but limited to 1439 minutes (1 day).

Rule1
  ON system#boot do Var1 3 ENDON
  ON Var1#State>1439 DO Var1 1439 ENDON

  ON Time#Minute|%var1% DO backlog Ping4 192.168.1.10 ENDON
  ON Ping#192.168.1.10#Success==0 DO backlog Mult1 3; Power1 0; Delay 10; Power1 1 ENDON
  ON Ping#192.168.1.10#Success>0 DO Var1 3 ENDON

If your Tasmota doesn’t have ping compiled in and your remote host has an HTTP server you can access, you can use WebQuery as below:

Rule1
  ON system#boot do Var1 3 ENDON
  ON Var1#State>1439 DO Var1 1439 ENDON

  ON Time#Minute|%var1% DO backlog WebQuery http://192.168.1.10/ GET ENDON
  ON WebQuery#Data$!Done DO backlog Mult1 3; Power1 0; Delay 10; Power1 1 ENDON
  ON WebQuery#Data=Done DO Var1 3 ENDON

Triggering off the JSON response to webquery (and other commands) may require wrapping the command in backlog, as per example above

If you know how to locate and use the Tasmota documentation to find the information you need, then surely you can do the same with the esphome documentation. Everything is well documented, its organized by category and even has a search box.

Also, there’s a search box here for anyone looking for information and believe it or not but, you’re not the first person to make a post on this subject so, answers are pretty easy to find.

Depends on your Wifi component setup on Esphome. Default is 15min. You can set that as you prefer. But If you have AP-mode as backup, it doesn’t reboot.

Where can I find/read about this?