hassio-addons / addon-unifi

UniFi Network Application - Home Assistant Community Add-ons
https://addons.community
MIT License
276 stars 137 forks source link

Add-on stops and is not restarted by watchdog #467

Closed mkruiver closed 9 months ago

mkruiver commented 10 months ago

Problem/Motivation

The add-on and therefore the controller keeps stopping without notice or error.

Expected behavior

Keep running. Be restarted by watchdog if stopped for whatever reason.

Actual behavior

Add-on shuts off without warning or error.

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting


Add-on: UniFi Network Application Manage your UniFi network using a web browser

Add-on version: 2.8.1 You are running the latest version of this add-on. System: Debian GNU/Linux 12 (bookworm) (aarch64 / raspberrypi4-64) Home Assistant Core: 2023.11.2 Home Assistant Supervisor: 2023.11.3

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-timezone: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started [16:14:19] INFO: Configuring timezone (Europe/Amsterdam)... s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service base-addon-timezone successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-unifi: starting s6-rc: info: service init-unifi successfully started s6-rc: info: service unifi: starting s6-rc: info: service unifi successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started [16:14:20] INFO: Now starting the UniFi Network Application... [16:14:20] INFO: Note: No add-on specific logs beyond this point.

Steps to reproduce

(How can someone else make/see it happen)

Proposed changes

(If you have a proposed change, workaround or fix, describe the rationale behind it)

realthk commented 10 months ago

Same here. For some months now, Unifi addon stops (at least once every week or so), it is grayed out in the addon list so Supervisor can tell it's not running, but the Watchdog does not start it, I have to do it manually every time.

renewoensdregt commented 10 months ago

It happened to me sometimes in the past too. I know it is not a solution, but I applied a workaround through an automation to start it automatically. You have to enable the unifi controller sensor (it´s not enabled by default if I recall correctly):

- id: unifi_stopped_running
  alias: Unifi add-on stopped running
  initial_state: true
  trigger:
    platform: state
    entity_id: binary_sensor.unifi_controller_running
    to: 'off'
    for:
      minutes: 1
  action:
    - service: notify.mobile_app_rene_s_iphone_13
      data:
        message: 'Unifi add-on stopped running!'

- id: unifi_stopped_running_daily check
  alias: Unifi add-on stopped running daily check
  initial_state: true
  trigger:
    - platform: time_pattern
      # Matches every hour at 30 minutes past whole
      minutes: 30
  condition:
    condition: state
    entity_id: binary_sensor.unifi_controller_running
    state: 'off'
  action:
    - service: notify.mobile_app_rene_s_iphone_13
      data:
        message: 'Unifi add-on stopped running, but I started it again'
    - service: hassio.addon_start
      data:
        addon: a0d7b954_unifi
jace commented 9 months ago

@renewoensdregt where is binary_sensor.unifi_controller_running available from?

renewoensdregt commented 9 months ago

If I recall right you do that through Settings -> Devices and Services -> Tab entities -> show all (inc. hidden ones) and then you see which ones are deactvated by integration and you can enable it from there.

jace commented 9 months ago

Found it. Mine's called binary_sensor.unifi_network_application_running.

realthk commented 9 months ago

Knock on wood, but haven't had the problem now for some time. Perhaps the update of Supervisor 1-2 weeks ago might have fixed it finally and restarts Unifi addon?

frenck commented 9 months ago

Add-on stops and is not restarted by watchdog

The Watchdog is a Home Assistant Supervisor feature and not in control of this add-on. If it doesn't pick up correctly, you should report an issue with the Home Assistant Supervisor project.

../Frenck