Reboot pi from hass.io

Hi. Long story short is there any way I can automate rebooting my raspberry pi (the pi itself, not hass.io) on a schedule using hass.io?

So far I have found no solution: cron on the pi doesn’t work (or there is no true access to it when sshing to a pi running hass.io); there is no sudo in hass.io and it can’t be installed, so you can’t run a shell script to reboot; etc etc etc

does hassio host reboot work? If so, you should be able to add it to a script and add to an automation to fire it off.

Isn’t that only available from the command line?

Sorry, I wasn’t thinking straight.

You should be able to call the service hassio.host_reboot.

Awesome! Works! Thanks!

1 Like

@fezfox are you able to write this up if you came up with a solution?

yes I did:

- id: reboot_pi
  initial_state: true
  alias: 'Reboot pi daily'
  trigger:
  - platform: time
    at: '03:00:00'
  action:
  - service: hassio.host_reboot
1 Like

Apologies for resurrecting an older thread, but could you be more specific on how you implemented the solution described above? Did you add this in the configuration.yaml file?

Thanks… Fairly new to HA and a lot of the discussions are more than a little confusing since they are written by people who obviously know what they’re doing, while those of us who don’t (or barely) are struggling to learn. :slight_smile:

This is an automation. So you could

  1. include it directly in configurations.yaml, as above preceeded by automation:
  2. more typically, people put all their automations as above in a single filed called automations.yaml and refer to that file in configurations.yaml like this:
automation: !include automations.yaml
  1. In my case, I actually have an automations folder and that is in a file called system.yaml and every file in that folder is included with this line in configurations.yaml:
automation: !include_dir_merge_list automation/

TL;DR;

add the above to your configrations.yaml file, indented after automations:

2 Likes

Thank you for the clarification! HomeAssistant can be rather daunting in the beginning. :thinking: