ualex73 / monitor_docker

Monitor Docker containers from Home Assistant
Apache License 2.0
267 stars 34 forks source link

Monitor stops updating if target host is down on startup #59

Closed allthesebugsv2 closed 3 years ago

allthesebugsv2 commented 3 years ago

I am running Home Assistant 2021.3.4 with Monitor Docker 1.8 installed via HACS.

This problem concerns a remote host I monitor via TCP. This host is not turned on all the time. Whenever home assistant starts while this host is off it says entity not available (which is to be expected). However, when I start up the host this will only be picked up if I restart Home Assistant. The problem also persists in the other direction: if the target host is shutdown this will not be picked up and all sensors just show their values before the shutdown.

Thank you for any help!

allthesebugsv2 commented 3 years ago

To add to this: when using the state of a docker container inside an automation, it will fail with an unknown entity error if the target host was not up at home assistant boot time. I think it would make more sense to have an "unavailable" state rather than an unknown entity in order to work with automations.

ualex73 commented 3 years ago

Just added a change in the GitHub, it should now retry every 60 seconds if during start-up the remote Docker is unavailable. I will check what I can do, IF/WHEN the remote host goes away. Only, I cannot do much about the entities when the remote host isn't there during start-up (otherwise it is a too big of code change).

allthesebugsv2 commented 3 years ago

Just updated via HACS. Thank you very much, the change works fine for me and really helps!

I guess the "unavailable" state is for another issue then (but also not that important for me).