davidusb-geek / emhass-add-on

The Home Assistant Add-on for EMHASS: Energy Management Optimization for Home Assistant
MIT License
96 stars 29 forks source link

Enable watchdog in config.yml #107

Closed RudolfRendier closed 5 days ago

RudolfRendier commented 2 weeks ago

Enable watchdog:

https://developers.home-assistant.io/docs/add-ons/configuration

RudolfRendier commented 2 weeks ago

Not the correct solution. Seems the watchdog already functions, just not reliably.

davidusb-geek commented 2 weeks ago

Where in HA can we see the status of this watchdog?

RudolfRendier commented 2 weeks ago

https://:8123/config/logs?provider=supervisor Provides some logging from the watchdog.

Somehow my curl-calls make EMHASS crash sometimes. And even though I have the 'watchdog'-toggle enabled it's not restarting automatically.

That's why I created this PR, but it's more complicated, the watchdog already does restart the add-on sometimes.

RudolfRendier commented 5 days ago

Here's the logging of a situation where it fails to restart EMHASS. Since the watchdog works as expected and does what it can, I'm closing this PR. Sorry for the noise.

2024-11-19 07:29:04.748 WARNING (MainThread) [supervisor.addons.addon] Watchdog found addon EMHASS is failed, restarting...
2024-11-19 07:29:04.756 INFO (SyncWorker_6) [supervisor.docker.manager] Cleaning addon_5b918bf2_emhass application
2024-11-19 07:29:05.783 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on ghcr.io/davidusb-geek/emhass with version v0.11.2
2024-11-19 07:29:11.318 WARNING (MainThread) [supervisor.addons.addon] Watchdog found addon EMHASS is failed, restarting...
2024-11-19 07:29:11.328 INFO (SyncWorker_7) [supervisor.docker.manager] Cleaning addon_5b918bf2_emhass application
2024-11-19 07:29:12.767 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on ghcr.io/davidusb-geek/emhass with version v0.11.2
2024-11-19 07:29:18.029 WARNING (MainThread) [supervisor.addons.addon] Watchdog found addon EMHASS is failed, restarting...
2024-11-19 07:29:18.038 INFO (SyncWorker_7) [supervisor.docker.manager] Cleaning addon_5b918bf2_emhass application
2024-11-19 07:29:19.206 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on ghcr.io/davidusb-geek/emhass with version v0.11.2
2024-11-19 07:29:24.506 WARNING (MainThread) [supervisor.addons.addon] Watchdog found addon EMHASS is failed, restarting...
2024-11-19 07:29:24.516 INFO (SyncWorker_7) [supervisor.docker.manager] Cleaning addon_5b918bf2_emhass application
2024-11-19 07:29:25.485 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on ghcr.io/davidusb-geek/emhass with version v0.11.2
2024-11-19 07:29:30.792 WARNING (MainThread) [supervisor.addons.addon] Watchdog found addon EMHASS is failed, restarting...
2024-11-19 07:29:30.801 INFO (SyncWorker_7) [supervisor.docker.manager] Cleaning addon_5b918bf2_emhass application
2024-11-19 07:29:31.854 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on ghcr.io/davidusb-geek/emhass with version v0.11.2
2024-11-19 07:29:37.218 WARNING (MainThread) [supervisor.addons.addon] Watchdog found addon EMHASS is failed, restarting...
2024-11-19 07:29:37.228 INFO (SyncWorker_7) [supervisor.docker.manager] Cleaning addon_5b918bf2_emhass application
2024-11-19 07:29:38.280 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on ghcr.io/davidusb-geek/emhass with version v0.11.2
2024-11-19 07:29:41.387 ERROR (MainThread) [supervisor.api.ingress] Ingress error: Cannot connect to host 172.30.33.11:5000 ssl:default [Connect call failed ('172.30.33.11', 5000)]
2024-11-19 07:29:43.609 WARNING (MainThread) [supervisor.addons.addon] Watchdog found addon EMHASS is failed, restarting...
2024-11-19 07:29:43.615 INFO (SyncWorker_7) [supervisor.docker.manager] Cleaning addon_5b918bf2_emhass application
2024-11-19 07:29:44.627 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on ghcr.io/davidusb-geek/emhass with version v0.11.2
2024-11-19 07:29:49.900 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-5911240' coro=<Addon.watchdog_container() done, defined at /usr/src/supervisor/supervisor/addons/addon.py:1468> exception=AddonsJobError('Rate limit exceeded, more than 10 calls in 0:30:00')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 1482, in watchdog_container
    await self._restart_after_problem(event.state)
  File "/usr/src/supervisor/supervisor/jobs/decorator.py", line 291, in wrapper
    raise on_condition(
supervisor.exceptions.AddonsJobError: Rate limit exceeded, more than 10 calls in 0:30:00
2024-11-19 07:30:22.849 INFO (SyncWorker_6) [supervisor.docker.manager] Cleaning addon_5b918bf2_emhass application
2024-11-19 07:30:23.993 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on ghcr.io/davidusb-geek/emhass with version v0.11.2
2024-11-19 07:30:25.607 ERROR (MainThread) [supervisor.api.ingress] Ingress error: Cannot connect to host 172.30.33.11:5000 ssl:default [Connect call failed ('172.30.33.11', 5000)]
2024-11-19 07:30:29.490 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-5911735' coro=<Addon.watchdog_container() done, defined at /usr/src/supervisor/supervisor/addons/addon.py:1468> exception=AddonsJobError('Rate limit exceeded, more than 10 calls in 0:30:00')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 1482, in watchdog_container
    await self._restart_after_problem(event.state)
  File "/usr/src/supervisor/supervisor/jobs/decorator.py", line 291, in wrapper
    raise on_condition(
supervisor.exceptions.AddonsJobError: Rate limit exceeded, more than 10 calls in 0:30:00