Auto reconnection after losing wifi connection

Because of where my device is, occasionally it loses wifi connection.
Then I have to turn the device off and on again to reconnect the wifi and all works fine.

Is there anyway for this to happen automatically? Its annoying that my home automation system, needs manual intervention at times.


You can create a binary_sensor that pings google. If google is not available for 5 minutes, start an automation that restarts HA.

Similar to @francisp suggests, I monitor my internet connection so that my system can switch to SMS notifications in the event of a supplier outage:

  - platform: ping
    count: 3
    scan_interval: 300
    name: 'WAN_Check_BBC'
  - platform: ping
    count: 3
    scan_interval: 300
    name: 'WAN_Check_OpenDNS'

I then combine then into a template sensor and test against that for my automations.

- platform: template
# online / offline 
        friendly_name: 'Internet Connection'
          - binary_sensor.WAN_Check_BBC
          - binary_sensor.WAN_Check_OpenDNS
        value_template: '{% if is_state("binary_sensor.WAN_Check_BBC","off") and is_state("binary_sensor.WAN_Check_OpenDNS", "off") %}Offline{% else %}Online{% endif %}'

Thanks Both.

I have the sensor and automation setup.

@francisp Im using HASSIO - so will homeassistant.restart restart the docker container? or just the home assistant app?


It will do the same as when you click configuration → server controls → restart.

Then i dont think this answers my question.

Im assuming its the device that loses connection, so restarting just the HA app wont help

There is the service hassio.host_reboot

1 Like

Perfect - thanks!

I guess there must be a simpler answer, to modify the connection settings and avoid restarting, not always desired.

This might solve it:

1 Like