Reload config if hass don't detect devices

Hi!
I would like to know if there is a way to reload hass by automation, something like if device is not load correctly then reload hass?

My problem came because after some power cuts some devices didn’t load correctly so i would like that hass relod it until everything is normal

service: homeassistant.restart

I use this to check for invalid config or missing wink. If the power goes out around here, the wink takes longer to reboot than HASS does. The following automations fix that.

sensor:
  - platform: template
    sensors:
      invalid_config:
        value_template: "{% if is_state_attr('persistent_notification.invalid_config', 'title', 'Invalid config') %}true{% else %}false{% endif %}"
        friendly_name: 'Invalid Config'
      wink_missing:
        value_template: "{% if is_state('binary_sensor.hub', 'on') %}false{% else %}true{% endif %}"
        friendly_name: 'Wink Missing'


automation: 
  # restart if wink not found (power outage / race condition)
  - alias: Reboot Wink Check
    trigger:
      platform: state
      entity_id: sensor.invalid_config
      state: 'true'
      for:
        seconds: 60
    condition:
      condition: state
      entity_id: sensor.wink_missing
      state: 'true'
    action:
      service: homeassistant.restart
1 Like

Thanks, something like this i was searching.

Do you mind to explain why do you test for invalid config? Testing for missing sensor is not enough?

Thanks

Sorry for the really delayed response! If the wink hub doesn’t show up it throws an ‘invalid config’ error. Sometimes that one shows up first, sometimes it realizes the Wink hub is missing first. By testing for both, it reboots fastest regardless of which one pops up first.