ikifar2012 / amcrest2mqtt-addon

A Home Assistant addon for amcrest2mqtt
4 stars 4 forks source link

Addon is crashing with unexpected error, and watchdog is not re-starting it #9

Closed iankaufmann closed 1 year ago

iankaufmann commented 1 year ago

Add-on version: 2022.5.1 You are running the latest version of this add-on. System: Home Assistant OS 9.5 (amd64 / qemux86-64) Home Assistant Core: 2023.1.7 Home Assistant Supervisor: 2023.01.1

I have noticed this happen a few times over the last month that I've been using the addon (I used to just run it in a self-managed docker container and never had an issue).

I will notice that all of a sudden the addon is stopped, and the logs only contain a cryptic unexpected error.

I have the "watchdog" option turned on, but it doesn't seem to actually revive the addon. However, hitting "start" manually turns the addon back on without any issues, then it works for a week or so before happening again.

Edit: I caught the log this time and will paste it below. It looks like it is happening when the doorbell can't be reached in 6 seconds. I guess my question is why that kills the addon and why it doesn't get restarted by the watchdog.

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
01/02/2023 22:36:15 [INFO] App Version: 1.0.14
01/02/2023 22:36:15 [INFO] Fetching camera details...
<Front Door:Z1760254EDDD7> Trying again due to error: ReadTimeout(ReadTimeoutError("HTTPConnectionPool(host='192.168.10.53', port=80): Read timed out. (read timeout=6.05)"))
01/02/2023 22:36:26 [INFO] Device type: AD410
01/02/2023 22:36:26 [INFO] Serial number: Z1760254EDDD7
01/02/2023 22:36:26 [INFO] Software version: 1.000.0000000.7.R
01/02/2023 22:36:26 [INFO] Device name: doorbell
01/02/2023 22:38:06 [ERROR] Ping unsuccessful
01/02/2023 22:38:06 [INFO] Exiting app...
[cmd] ./run.sh exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

 We are so sorry, but something went terribly wrong when
 starting or running this add-on.

 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
rabsoft commented 1 year ago

I am seeing the same issue

ikifar2012 commented 1 year ago

I am not sure what to do with the addon as of right now as it appears the dev that makes amcrest2mqtt seems to have disappeared, https://github.com/dchesterton/amcrest2mqtt/issues/96 and the API seems to have changed. I myself do not have an amcrest device or I would have just forked it, if anyone knows of a more up to date amcrest2mqtt fork I can base the addon on let me know

iankaufmann commented 1 year ago

What I ended up doing was going to "Settings > Devices & Integrations > Devices > amcrest2mqtt" and then enabling the binary sensor for "running".

Then I set up this automation:

- id: monitor_amcrest2mqtt_off
  alias: Monitor - amcrest2mqtt - off
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: binary_sensor.amcrest2mqtt_running
      to: 'off'
      for: '00:00:10'
  action: 

    - alias: "Try to restart amcrest2mqtt until running"
      repeat:
        until: "{{ is_state('binary_sensor.amcrest2mqtt_running', 'on') or index > 5 }}"
        sequence:

          - service: hassio.addon_restart
            data:
              addon: 3490a758_amcrest2mqtt-addon

          - delay:
              seconds: 30

I didn't realize the API has changed. I don't plan on updating my AD410 unless there is a good reason to. I have it blocked from the internet and don't use their app or anything. Just pipe it into BlueIris via RTSP, and then I use this addon to get button press events so I can trigger the doorbell sound through multiple sonos speakers in the house.