ikifar2012 / amcrest2mqtt-addon

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

s6-supervise amcrest2mqtt (child): fatal: unable to exec run: Permission denied #14

Closed iankaufmann closed 1 year ago

iankaufmann commented 1 year ago

I updated to 2023.03.0 and now I'm getting this error. If I leave it running, the error loops every 10 seconds or so forever.

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: amcrest2mqtt
 A Home Assistant addon for amcrest2mqtt
-----------------------------------------------------------
 Add-on version: 2023.3.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.5  (amd64 / qemux86-64)
 Home Assistant Core: 2023.3.5
 Home Assistant Supervisor: 2023.03.1
-----------------------------------------------------------
 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-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun amcrest2mqtt (no readiness notification)
s6-supervise amcrest2mqtt: warning: unable to spawn ./run - waiting 10 seconds
s6-supervise amcrest2mqtt (child): fatal: unable to exec run: Permission denied
s6-supervise amcrest2mqtt: warning: unable to spawn ./run - waiting 10 seconds
s6-supervise amcrest2mqtt (child): fatal: unable to exec run: Permission denied
s6-supervise amcrest2mqtt: warning: unable to spawn ./run - waiting 10 seconds
s6-supervise amcrest2mqtt (child): fatal: unable to exec run: Permission denied
asdfghjkai commented 1 year ago

Seconded here, same issue

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: amcrest2mqtt
 A Home Assistant addon for amcrest2mqtt
-----------------------------------------------------------
 Add-on version: 2023.3.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.5  (amd64 / qemux86-64)
 Home Assistant Core: 2023.3.4
 Home Assistant Supervisor: 2023.03.1
-----------------------------------------------------------
 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-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun amcrest2mqtt (no readiness notification)
s6-supervise amcrest2mqtt (child): fatal: unable to exec run: Permission denied
s6-supervise amcrest2mqtt: warning: unable to spawn ./run - waiting 10 seconds
s6-supervise amcrest2mqtt: warning: unable to spawn ./run - waiting 10 seconds
s6-supervise amcrest2mqtt (child): fatal: unable to exec run: Permission denied
s6-supervise amcrest2mqtt (child): fatal: unable to exec run: Permission denied
s6-supervise amcrest2mqtt: warning: unable to spawn ./run - waiting 10 seconds
s6-supervise amcrest2mqtt: warning: unable to spawn ./run - waiting 10 seconds
s6-supervise amcrest2mqtt (child): fatal: unable to exec run: Permission denied
s6-supervise amcrest2mqtt: warning: unable to spawn ./run - waiting 10 seconds
s6-supervise amcrest2mqtt (child): fatal: unable to exec run: Permission denied
WBraakman commented 1 year ago

I have the same problem

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: amcrest2mqtt A Home Assistant addon for amcrest2mqtt

Add-on version: 2023.3.0 You are running the latest version of this add-on. System: Home Assistant OS 9.5 (aarch64 / raspberrypi4-64) Home Assistant Core: 2023.3.5 Home Assistant Supervisor: 2023.03.1

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-log-level: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun amcrest2mqtt (no readiness notification) s6-supervise amcrest2mqtt (child): fatal: unable to exec run: Permission denied s6-supervise amcrest2mqtt: warning: unable to spawn ./run - waiting 10 seconds s6-supervise amcrest2mqtt (child): fatal: unable to exec run: Permission denied s6-supervise amcrest2mqtt: warning: unable to spawn ./run - waiting 10 seconds s6-supervise amcrest2mqtt (child): fatal: unable to exec run: Permission denied

richlawson commented 1 year ago

I'm also encountering the same problem (my log matches the above).

After upgrading, all of my AD410 sensors also became unavailable:

Video continued to stream.

Reverting back to 2022.5.1 restored everything to normal.

I tried upgrading my firmware to the latest version (Lexus_SDB61i-Lexus2_Eng_N_32M_nonCA_V1.000.00AC001.0.R.20230221.bin from https://amcrest.com/firmware-ash). A second attempt at upgrading to 2023.3.0 was the same as the first (only the video streaming was working - no sensors), so I reverted back to 2022.5.1 of the add-on again. Everything started working for me again.

Edit: Added information about reverts to for clarity.

ikifar2012 commented 1 year ago

Alright I will look into this tomorrow I think I know what is causing this. This is a change I completely forgot about from last year https://developers.home-assistant.io/blog/2022/05/12/s6-overlay-base-images I completely forgot to set the execute permission in the git index 🤦‍♂️ Sorry for the inconvenience, I will try to get a fix out ASAP

richlawson commented 1 year ago

Thank you for all the effort you're putting into maintaining this! I really appreciate it. It can't be easy with the maintainer of the underlying project disappearing and having to switch to a different fork.

ikifar2012 commented 1 year ago

Alright, 2023.3.2 is out, let me know if the issue is solved

richlawson commented 1 year ago

That fixed the permissions issues, but the sensors are still not coming up for me, and it crashed. Here's the log:

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: amcrest2mqtt
 A Home Assistant addon for amcrest2mqtt
-----------------------------------------------------------
 Add-on version: 2023.3.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.5  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2023.3.6
 Home Assistant Supervisor: 2023.03.2
-----------------------------------------------------------
 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-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun amcrest2mqtt (no readiness notification)
s6-rc: info: service legacy-services successfully started
[03:10:51] WARNING: MQTT service not available, please ensure the MQTT Broker addon is installed and configured
Traceback (most recent call last):
  File "/amcrest2mqtt/src/amcrest2mqtt.py", line 1, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'
[03:10:52] WARNING: Halt add-on with exit code 1
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Edit: Sorry about the formatting issues.

ikifar2012 commented 1 year ago

Please try 2023.3.3 and let me know how it goes

richlawson commented 1 year ago

Thank you for the update and all your work on this.

At first things were looking good. The binary sensors came up and everything just after the update. But then I tried testing out the doorbell and the human detection on the AD410, and not only was nothing detected by the binary sensors (for both the ringing of the doorbell and the human detection), but the doorbell streaming stopped. Also, different lights were displaying on the doorbell that I had never seen before. I'm going to restore a backup again.

Here's the log:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun amcrest2mqtt (no readiness notification)
s6-rc: info: service legacy-services successfully started
25/03/2023 05:00:15 [INFO] App Version: 1.0.16
25/03/2023 05:00:15 [INFO] Fetching camera details...
25/03/2023 05:00:18 [INFO] Device type: AD410
25/03/2023 05:00:18 [INFO] Serial number: <redacted>
25/03/2023 05:00:18 [INFO] Software version: 1.000.00AC001.0.R
25/03/2023 05:00:18 [INFO] Device name: Front-Door-Doorbell
25/03/2023 05:00:18 [INFO] Writing Home Assistant discovery config...
25/03/2023 05:00:18 [INFO] Fetching storage sensors...
<Front-Door-Doorbell:Z17224B3EF3DA> Trying again due to error: HTTPError('400 Client Error: Bad Request for url: http://192.168.1.109:80/cgi-bin/storageDevice.cgi?action=getDeviceAllInfo')
<Front-Door-Doorbell:Z17224B3EF3DA> Trying again due to error: HTTPError('400 Client Error: Bad Request for url: http://192.168.1.109:80/cgi-bin/storageDevice.cgi?action=getDeviceAllInfo')
<Front-Door-Doorbell:Z17224B3EF3DA> Trying again due to error: HTTPError('400 Client Error: Bad Request for url: http://192.168.1.109:80/cgi-bin/storageDevice.cgi?action=getDeviceAllInfo')
25/03/2023 05:00:19 [WARNING] Error fetching storage information 400 Client Error: Bad Request for url: http://192.168.1.109:80/cgi-bin/storageDevice.cgi?action=getDeviceAllInfo
25/03/2023 05:00:19 [INFO] Listening for events...
25/03/2023 05:03:33 [INFO] human detected
25/03/2023 05:03:33 [INFO] {'Code': 'CrossRegionDetection', 'action': 'Start', 'index': '0', 'data': {'Action': 'Appear', 'CfgRuleId': 1, 'Class': 'Normal', 'CountInGroup': 0, 'DetectRegion': [[0, 0], [0, 4000], [0, 8191], [8191, 8191], [8191, 4000], [8191, 0]], 'EventID': 10003, 'EventSeq': 2, 'FrameSequence': 664783, 'GroupID': 2, 'Mark': 0, 'Name': 'IVS-1', 'Object': {'Action': 'Appear', 'Age': 0, 'Angle': 0, 'Bag': 0, 'BagType': 0, 'BoundingBox': [2696, 2064, 6376, 7744], 'CarrierBag': 0, 'Center': [4536, 4904], 'Confidence': 0, 'DownClothes': 0, 'Express': 0, 'FaceFlag': 0, 'FaceRect': [0, 0, 0, 0], 'FrameSequence': 664783, 'Gender': 0, 'Glass': 0, 'HairStyle': 0, 'HasHat': 0, 'Helmet': 0, 'HumanRect': [0, 0, 0, 0], 'LowerBodyColor': [0, 0, 0, 0], 'MainColor': [0, 0, 0, 0], 'MessengerBag': 0, 'ObjectID': 9, 'ObjectType': 'Human', 'Phone': 0, 'RelativeID': 0, 'SerialUUID': '', 'ShoulderBag': 0, 'Source': 0.0, 'Speed': 0, 'SpeedTypeInternal': 0, 'Umbrella': 0, 'UpClothes': 0, 'UpperBodyColor': [0, 0, 0, 0], 'UpperPattern': 0}, 'PTS': 43038255940.0, 'Priority': 0, 'RuleID': 1, 'RuleId': 1, 'Source': -1.0, 'Track': [], 'UTC': 1679702620, 'UTCMS': 208}}
25/03/2023 05:04:19 [INFO] doorbell rang
25/03/2023 05:04:19 [INFO] {'Code': '_DoTalkAction_', 'action': 'Pulse', 'index': '0', 'data': {'Action': 'Invite', 'CallID': '20230325000424@266190@192.168.1.109', 'CallSrcMask': 4}}

The human detection and ringing of the doorbell showed up in the log for the add on at least.

richlawson commented 1 year ago

For what it's worth, the video came back up before I restored my backup, so I re-tested the doorbell and human detection again, but those still didn't work.

I checked into the doorbell lights, and they blink repeatedly when the doorbell can't connect to the WAN. So I created an automation that turns that off, since I keep the Internet blocked on the doorbell. I run that through the integration, so it wasn't able to turn the blinking lights off, either.

Here's what that looks like, in case it's helpful:

alias: "Front Doorbell: Reset in offline mode"
description: ""
trigger:
  - platform: time_pattern
    minutes: "5"
condition:
  - condition: state
    entity_id: sensor.amcrest_doorbell_online_light
    state: "false"
action:
  - service: shell_command.front_doorbell_online_light
    data: {}
mode: single

And here's the shell command:

  - platform: rest
    scan_interval: 7200
    resource: !secret amcrest_resource
    username: !secret amcrest_username
    password: !secret amcrest_password
    authentication: digest
    name: Amcrest Doorbell Online Light
    device_class: power
    value_template: >
      {{value.split('=')[-1]}}

Edit: Added that I re-tested when video stream came back up and clarified a bit on the automation.

richlawson commented 1 year ago

One more quick note: for the lights, since I'm calling the service on the doorbell itself, bypassing the add-on, I'm wondering if the reason that the automation wouldn't run is because of the state condition checking to see if that online light sensor is false was failing. which is the part that would have come from the add-on.

ikifar2012 commented 1 year ago

Alright so this new fork has a bunch of changes, take a look here for all the changes: https://github.com/carefulcomputer/amcrest2mqtt/commit/67d4cb8ad45f1f56778c3b9835e10b60bd5b1180 Interestingly I had to fork it myself because the requirements.txt did not contain all the dependency's needed, so that may indicate it has not been tested MQTT explorer might also come in handy if you want to see exactly what is going on but if this does cause a lot of issues I can try to switch to the patch which does not include these changes: https://github.com/carefulcomputer/amcrest2mqtt/commit/013e13825496c46f6a33234cf731f6decaee0f2d Keep in mind I do not have access to an amcrest device therefore I am relying on bug reports, so thank you for reporting these bugs I really appreciate it and want to keep this addon running

richlawson commented 1 year ago

You're right about there being a lot of changes in https://github.com/carefulcomputer/amcrest2mqtt/commit/67d4cb8ad45f1f56778c3b9835e10b60bd5b1180. I'm not sure what might be breaking things, but based on my experience and the experience in this issue, it seems as though it isn't working correctly.

https://github.com/dchesterton/amcrest2mqtt isn't supported anymore, but it does work for me as part of 2022.5.1 of the add-on, even with me running the latest firmware on my AD410. So is there a way to update that application only as necessary to make it work with the updated dependencies? It seems like sticking with the dchesterton version as closely as possible, at least as a starting point, might be the route to take.

Even https://github.com/carefulcomputer/amcrest2mqtt/commit/013e13825496c46f6a33234cf731f6decaee0f2d changes the data structure, and I'm not sure what that would be fixing, at least in my situation. There may be a different story for other Amcrest devices.

richlawson commented 1 year ago

Something interesting I noticed is that it seems like some of the 2022 Amcrest FW updates may have been problematic. For example, there's this thread from November 2022 on their forum (see the last comment in particular): https://amcrest.com/forum/amcrest-smart-home-f32/an-update-regarding-ad410-firmware-amcrest-support-t16107.html

When I first heard about the new AD110 firmware breaking event handling I initially assumed the API was disabled as well. Fortunately that is not the case and the problem is much narrower than that - but still critical.

I sure hope the new AD410 firmware has been tested for backward compatibility with event subscriptions.

The firmware I'm using was released a little over a month ago: 2023/02/21.

Could some of the updates in https://github.com/dchesterton/amcrest2mqtt/pulls and https://github.com/carefulcomputer/amcrest2mqtt/commit/67d4cb8ad45f1f56778c3b9835e10b60bd5b1180. which date from around this time, been attempts to work around this bugginess and potentially incorrect data structures?

ikifar2012 commented 1 year ago

Could some of the updates in https://github.com/dchesterton/amcrest2mqtt/pulls and carefulcomputer/amcrest2mqtt@67d4cb8. which date from around this time, been attempts to work around this bugginess and potentially incorrect data structures?

Not sure but I know I thought this change would solve #10 however, I have not heard any update from that issue. I asked in the issue #91 and @unixorn said the patch-1 branch solved his issue, although I do not know what version of the firmware he is running (hopefully he sees this)

unixorn commented 1 year ago

Sorry it took so long for me to see this, it got lost in my notifications.

I'm running ENG_N_V1.000.0000000.7.R.20210220 which their app is saying is up to date. The model is AD410.

unixorn commented 1 year ago

The human detection works. Well works in that I see it in HA when I get notifications of human detection. It doesn't always recognize humans coming to my door, though that's a doorbell firmware problem and not a problem with the mqtt gateway.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.