Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on Human detected #67

Open
anacozero opened this issue Mar 25, 2022 · 9 comments
Open

Error on Human detected #67

anacozero opened this issue Mar 25, 2022 · 9 comments

Comments

@anacozero
Copy link

Getting an error on latest version when a human is detected by amcrest doorbell.

25/03/2022 22:06:09 [INFO] App Version: 1.0.16
25/03/2022 22:06:09 [INFO] Fetching camera details...
25/03/2022 22:06:14 [INFO] Device type: AD410
25/03/2022 22:06:14 [INFO] Serial number: REDACTED
25/03/2022 22:06:14 [INFO] Software version: 1.000.0000000.7.R (2021-02-20)
25/03/2022 22:06:14 [INFO] Device name: Front Door
25/03/2022 22:06:15 [INFO] Writing Home Assistant discovery config...
25/03/2022 22:06:15 [INFO] Fetching storage sensors...
25/03/2022 22:06:15 [INFO] Listening for events...
25/03/2022 22:08:46 [INFO] {'Code': 'TimeChange', 'action': 'Pulse', 'index': '0', 'data': {'BeforeModifyTime': '2022-03-25 05:08:46', 'ModifiedTime': '2022-03-25 05:08:46'}}
25/03/2022 22:08:46 [INFO] {'Code': 'NTPAdjustTime', 'action': 'Pulse', 'index': '0', 'data': {'Address': '200.160.0.8', 'Before': '2022-03-25 05:08:45', 'result': True}}
25/03/2022 22:09:41 [INFO] {'Code': 'VideoMotionInfo', 'action': 'State', 'index': '0'}
25/03/2022 22:09:41 [INFO] {'Code': 'VideoMotion', 'action': 'Start', 'index': '0', 'data': {'Id': [0], 'RegionName': ['Region1']}}
25/03/2022 22:09:42 [INFO] {'Code': 'NewFile', 'action': 'Pulse', 'index': '0', 'data': {'File': '/mnt/sd/2022-03-25/001/jpg/17/09/42[M][0@0][0].jpg', 'Size': 39803, 'StoragePoint': 'NULL'}}
an error occurred during closing of asynchronous generator <async_generator object AsyncClient.stream at 0x7f9eb4040820>
asyncgen: <async_generator object AsyncClient.stream at 0x7f9eb4040820>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/app/amcrest2mqtt.py", line 426, in main
    elif code == "CrossRegionDetection" and payload["data"]["ObjectType"] == "Human":
KeyError: 'ObjectType'

During handling of the above exception, another exception occurred:

RuntimeError: aclose(): asynchronous generator is already running
an error occurred during closing of asynchronous generator <async_generator object Http.async_stream_command at 0x7f9eb3c9e4c0>
asyncgen: <async_generator object Http.async_stream_command at 0x7f9eb3c9e4c0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/app/amcrest2mqtt.py", line 426, in main
    elif code == "CrossRegionDetection" and payload["data"]["ObjectType"] == "Human":
KeyError: 'ObjectType'

During handling of the above exception, another exception occurred:

RuntimeError: aclose(): asynchronous generator is already running
an error occurred during closing of asynchronous generator <async_generator object Http._async_stream_command at 0x7f9eb4040790>
asyncgen: <async_generator object Http._async_stream_command at 0x7f9eb4040790>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/app/amcrest2mqtt.py", line 426, in main
    elif code == "CrossRegionDetection" and payload["data"]["ObjectType"] == "Human":
KeyError: 'ObjectType'

During handling of the above exception, another exception occurred:

RuntimeError: aclose(): asynchronous generator is already running
Traceback (most recent call last):
  File "/app/amcrest2mqtt.py", line 440, in <module>
    asyncio.run(main())
  File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/app/amcrest2mqtt.py", line 426, in main
    elif code == "CrossRegionDetection" and payload["data"]["ObjectType"] == "Human":
KeyError: 'ObjectType'
@frustreermeneer
Copy link

I'm getting the exact same error since yesterday. Same versions, same doorbell.
I don't know what changed.

@tehbra1n
Copy link

Same, reverting to previous version of container fixes the issue.

robsonke added a commit to robsonke/hassio-addons that referenced this issue Mar 29, 2022
robsonke added a commit to robsonke/hassio-addons that referenced this issue Mar 29, 2022
@tehbra1n
Copy link

tehbra1n commented May 5, 2022 via email

@rb2k
Copy link

rb2k commented May 6, 2022

Just ran into this as well on 1.0.16, downgrading to 1.0.15 now

@DayRunner131
Copy link

I had a very similar issue and contacted Amcrest for the current firmware. ...R.20210712 is current for the AD110 and solves these issues. I understood from them that the phone app has a bug and will not show the current firmware, so it has to be manually pushed.

@jweston2112
Copy link

jweston2112 commented Aug 5, 2022

I changed this line in the Docker Container in /app/amcrest2mqtt.py (Not the Image... not really a Docker Guru or a Python Programmer for that matter) (I know if I do another pull it'll overwrite it)

           elif code == "CrossRegionDetection" and payload["data"]["Object"]["ObjectType"] == "Human":

added the ["Object"] and that seems to keep it from crashing. I think the JSON that comes from the Device might have changed in a Firmware update on the AD410

I had to move the Debugger line < log(str(payload)) > that Dumps the JSON to before the above line so I could Parse it and figured out they lump all the info about the "Object" in the camera into an Object Array Object:{ ... } which has the ObjectType Node

Hope that Helps

@unixorn
Copy link

unixorn commented Sep 29, 2022

I'm seeing the same thing with my Amcrest 410

amcrest2mqtt    | an error occurred during closing of asynchronous generator <async_generator object Http._async_stream_command at 0x7fa9d3adee50>
amcrest2mqtt    | asyncgen: <async_generator object Http._async_stream_command at 0x7fa9d3adee50>
amcrest2mqtt    | Traceback (most recent call last):
amcrest2mqtt    |   File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
amcrest2mqtt    |     return loop.run_until_complete(main)
amcrest2mqtt    |   File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
amcrest2mqtt    |     return future.result()
amcrest2mqtt    |   File "/app/amcrest2mqtt.py", line 426, in main
amcrest2mqtt    |     elif code == "CrossRegionDetection" and payload["data"]["ObjectType"] == "Human":
amcrest2mqtt    | KeyError: 'ObjectType'
amcrest2mqtt    |
amcrest2mqtt    | During handling of the above exception, another exception occurred:
amcrest2mqtt    |
amcrest2mqtt    | RuntimeError: aclose(): asynchronous generator is already running

And thanks btw for publishing a multi-architecture docker image, I'll be able to run it in k3s without restricting it to specific nodes.

@carefulcomputer
Copy link

I changed this line in the Docker Container in /app/amcrest2mqtt.py (Not the Image... not really a Docker Guru or a Python Programmer for that matter) (I know if I do another pull it'll overwrite it)

           elif code == "CrossRegionDetection" and payload["data"]["Object"]["ObjectType"] == "Human":

added the ["Object"] and that seems to keep it from crashing. I think the JSON that comes from the Device might have changed in a Firmware update on the AD410

I had to move the Debugger line < log(str(payload)) > that Dumps the JSON to before the above line so I could Parse it and figured out they lump all the info about the "Object" in the camera into an Object Array Object:{ ... } which has the ObjectType Node

Hope that Helps

Thanks ! this worked perfectly.

@carefulcomputer
Copy link

Thanks to jweston2112 , i just created a pull request..

#91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants