core: Amcrest reports 1000s of errors in log after update to 2022.3.5

The problem

After upgrade to 2022.3.5 which contained several updates to the Amcrest code my error log is flooded with errors related to Amcrest

Logger: homeassistant.components.amcrest
Source: components/amcrest/__init__.py:261
Integration: Amcrest ([documentation](https://www.home-assistant.io/integrations/amcrest), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+amcrest%22))
First occurred: 09:21:56 (4079 occurrences)
Last logged: 22:00:04

Error while processing events from Living room camera camera: CommError(HTTPStatusError("Client error '400 Bad Request' for url 'http://192.168.1.61/cgi-bin/eventManager.cgi?action=attach&codes=[All]'\nFor more information check: https://httpstatuses.com/400"))
Error while processing events from Living room camera camera: CommError(ConnectTimeout(''))
Error while processing events from Living room camera camera: CommError(ConnectError('All connection attempts failed'))
Error while processing events from Living room camera camera: CommError(RemoteProtocolError('Server disconnected without sending a response.'))
Error while processing events from Living room camera camera: CommError(HTTPStatusError("Server error '500 Internal Server Error' for url 'http://192.168.1.61/cgi-bin/eventManager.cgi?action=attach&codes=[All]'\nFor more information check: https://httpstatuses.com/500"))

The cameras are not very new and there has always been an occational glitch that fixed itself with 10-15 lines of warnings. The CommError(HTTPStatusError(“Client error ‘400 Bad Request’ for url ‘http://192.168.1.61/cgi-bin/eventManager.cgi?action=attach&codes=[All]’\nFor more information check: https://httpstatuses.com/400”)) is new.

What version of Home Assistant Core has the issue?

core-2022.3.5

What was the last working version of Home Assistant Core?

core-2022.3.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Amcrest

Link to integration documentation on our website

https://www.home-assistant.io/integrations/amcrest/

Diagnostics information

A sniplet from the log

2022-03-16 09:21:56 WARNING (MainThread) [homeassistant.components.amcrest] Error while processing events from Living room camera camera: CommError(HTTPStatusError("Client error '400 Bad Request' for url 'http://192.168.1.61/cgi-bin/eventManager.cgi?action=attach&codes=[All]'\nFor more information check: https://httpstatuses.com/400"))
2022-03-16 09:21:57 WARNING (MainThread) [homeassistant.components.amcrest] Error while processing events from Living room camera camera: CommError(HTTPStatusError("Client error '400 Bad Request' for url 'http://192.168.1.61/cgi-bin/eventManager.cgi?action=attach&codes=[All]'\nFor more information check: https://httpstatuses.com/400"))
2022-03-16 09:21:57 WARNING (MainThread) [homeassistant.components.amcrest] Error while processing events from Living room camera camera: CommError(HTTPStatusError("Client error '400 Bad Request' for url 'http://192.168.1.61/cgi-bin/eventManager.cgi?action=attach&codes=[All]'\nFor more information check: https://httpstatuses.com/400"))
2022-03-16 09:21:57 WARNING (MainThread) [homeassistant.components.amcrest] Error while processing events from Living room camera camera: CommError(HTTPStatusError("Client error '400 Bad Request' for url 'http://192.168.1.61/cgi-bin/eventManager.cgi?action=attach&codes=[All]'\nFor more information check: https://httpstatuses.com/400"))

It just continues like that with 1000s of lines - just for half a day

Occationally this variation is seen

2022-03-16 11:36:57 WARNING (MainThread) [homeassistant.components.amcrest] Error while processing events from Living room camera camera: CommError(HTTPStatusError("Client error '400 Bad Request' for url 'http://192.168.1.61/cgi-bin/eventManager.cgi?action=attach&codes=[All]'\nFor more information check: https://httpstatuses.com/400"))
2022-03-16 11:36:57 ERROR (MainThread) [homeassistant.components.amcrest] Living room camera camera offline: Too many errors
2022-03-16 11:36:57 WARNING (MainThread) [homeassistant.components.amcrest] Error while processing events from Living room camera camera: CommError(HTTPStatusError("Client error '400 Bad Request' for url 'http://192.168.1.61/cgi-bin/eventManager.cgi?action=attach&codes=[All]'\nFor more information check: https://httpstatuses.com/400"))
2022-03-16 11:37:57 ERROR (MainThread) [homeassistant.components.amcrest] Living room camera camera back online
2022-03-16 11:37:57 WARNING (MainThread) [homeassistant.components.amcrest] Error while processing events from Living room camera camera: CommError(HTTPStatusError("Client error '400 Bad Request' for url 'http://192.168.1.61/cgi-bin/eventManager.cgi?action=attach&codes=[All]'\nFor more information check: https://httpstatuses.com/400"))

Example YAML snippet

I have two cameras

amcrest:
  - host: !secret amcrest_living
    username: admin
    password: !secret amcrest_password
    stream_source: snapshot
    binary_sensors:
      - motion_detected
      - online
    sensors:
      - sdcard
      - ptz_preset
    name: Living room camera
    resolution: high
  - host: !secret amcrest_kitchen
    username: admin
    password: !secret amcrest_password
    stream_source: snapshot
    binary_sensors:
      - motion_detected
      - online
    sensors:
      - ptz_preset
    name: Kitchen camera
    resolution: high

Anything in the logs that might be useful for us?

No response

Additional information

UPDATE: Please read my comments below. The errors changed after a firmware upgrade of the camera but things are still not really good

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 22 (4 by maintainers)

Most upvoted comments

I have a draft fix up at #69640, but I haven’t had a chance to actually test anything out with that, I should be able to get to that this weekend.

Other than staying on 2022.3.4, are there any plans to address this? I haven’t noticed any related entries in the [2022.4.] pre-releases. I have some pretty cool object recognition automations setup with deepstack and my Amcrest cameras, and the whole setup is no longer functional. It took me several brands of IP Cams to finally settle on Amcrest because I found the integration robust.

Just updated my HA to 2022.3.5 (from 2021.12.x) and I too am seeing the same errors as everyone else for my 2 Amcrest cameras. Everything was great before the update.

Having same issue with Amcrest camera IP4M-1026B, downgraded to 2022.3.4 for the time being until a new patch is issued.