Home assistant connection question

Hi,

Unfortunately I have a relatively unstable internet connection which requires me to restart my router quite often (need to by a new one at some point).
Whenever I restart the internet connection my Home assistant on my raspberry looses the connection and also needs to be restarted. This is particularly bad if i am not at home and my set-up stops working.

Is there a way to automatically restart home assistant after say 5 min of no internet connection?

Welcome Markus.

I am just starting down the road of Home Assistant on my RPi. I have only had it a week.

What method did you use to install Home Assistant? I think the officially recommended method is to use the Hassio (HassOS) image on an SD Card. When I tested that in a VM, it periodically lost network connectivity. I am using another method on my Raspberry.

you can use an automation to do what you want. You’ll need to create a “ping” binary sensor. then you can use this (after substituting your details):

  automation:  
    - alias: restart home assistant
      trigger:
        - platform: state
          entity_id: binary_sensor.your_sensor_name
          to: 'off'
          for:
            minutes: 5
      action:
        - service: homeassistant.restart

There is no one “officially recommended” method. You can install HA in any way (that is supported on the HA website) that fits your needs.

EDITED FOR BETTER SPECIFICITY…:wink::slightly_smiling_face:

There are officially recommended methods :wink:

People can of course do what they want, but those are the methods the project recommends and will ensure the documentation supports.

1 Like

yeah, i guess there are “official” methods but I was referring to the idea that Hassio was the only “official” method. I should have been more specific. :slightly_smiling_face:

Hass.io can be installed on Linux, not just RPi.
Hass.io can be installed on Raspian without HassOS.
Hassbian can also be installed on Debian based Linux
Of course, all 3 variants can be installed in VMs.

These are variations I listed above should be easily supported too.

It is the recommended newbie method.

Did you click the link and read what’s there? Did you then click the Hass.io link and read it?

All the things you mentioned about Hass.io are supported by the documentation. Hassbian technically is Raspbian + Home Assistant, but yes, the scripts will work on Debian and Ubuntu.

The key thing is, we’re talking about what the documentation supports, and what the core components will work on. The project doesn’t promise that the documentation will support (say) installing Home Assistant on Fedora, or that all the components will work on (say) Windows Server 2019. However, Docker, Hass.io (whether HassOS or other), and Hassbian, those are different.

Yes, I did click your link.

Your listing link did not mention #1.
When I did #2 I had to modify the Linux install
For #3 I needed to hunt down the released .deb for Hassbian & troubleshoot dependencies.

Your listing link only recommended one choice for VMs.

I am moving to Hassbian on Raspian to gain more customization flexibility that the Docker based installations.

Docker on Raspbian is pretty much the most flexible way you can install HA (Hassio or not) on a RPi.

I can definitely see the increased flexibility if you are moving from HassOS to Hassbian but if you are on a regular Docker install now I’m not sure what “flexibility” gain you would realize.

And any way you install HA following any of the recommended install methods you will ultimately end up with essentially the same product (aside from the add-on capability of hassio). In the end it’s all just “Home Assistant”.

And lest we forget about @Markus_Holzhauser…:slightly_smiling_face:

Welcome to the forum!

Not all threads go off topic so quickly. :wink:

We have a bunch of really helpful people on here. You’ll be fine.

1 Like

The problem is is you need to add python components, they get replaced on upgrade with the container. That does not happen in a virtualenv like Hassbian.

I am confused, what python components do you need to add for docker install?
i have been running HA on docker for over a year and haven’t had to install anything extra python wise.

1 Like

hass.io installed in docker on raspbian or debian or ubuntu will give you ultimately the best of everything IMO. I would never go back from docker anyway… it’s way easier to manage and use.

My suggestion is to tackle the root cause first; buy a new router. It is not normal that the connection isn’t restored automatically.

The Alexa media player requires the alexapy Python module for some of its functionality. With Hassio you need to reinstall after every update since the docker container is replaced.

Hi can you share also the binary sensor configuration please?
Thanks!

Docs here:

- platform: ping
  host: 192.168.1.1
  name: ping_main_router
1 Like