The current version of the `amcrest` package has a bug in exposing if
the video stream is enabled, which leads to the substream status being
used to set if the camera is on or off. The updated version of
`amcrest` fixes this bug.
Fixes#55661
Some of the compatible hardware sends event signals that wouldn't map
well to entities, e.g. NTP sync notifications, SIP registering
information, or « doorbell button pressed » events with no « return to
rest state » matching event to have a properly behaved binary sensor.
Instead of only monitoring specific events, subscribe to all of them,
and pass them through (in addition to handling them as before if they
correspond to a configured binary sensor).
Also bump python-amcrest to 1.7.2. Digest of the changes:
* The library now passes through the event data instead of just presence of a
"Start" member in in.
* Connection to some devices has been fixed by not throwing the towel on
minor errors.
https://github.com/tchellomello/python-amcrest/compare/1.7.1...1.7.2
* Convert amcrest binary sensors from poll to stream
- Bump amcrest package to 1.6.0.
- For online binary sensor poll camera periodically to test communications in case
configuration & usage results in no other communication to camera.
- Start a separate thread to call camera's event_stream method since it never returns.
- Convert all received events into signals that cause corresponding sensors to update.
- Use camera's generic event_channels_happened method to update sensors at startup,
and whenever camera comes back online after being unavailable.
* Changes per review
* Changes per review 2
* Changes per review 3
- Move event stream decoding to amcrest package.
- Change name of event processing threads so global
counter is no longer required.
- Bump amcrest package to 1.7.0.
- Bump amcrest package to 1.5.6. Includes networking improvements, no longer
communicates during Http.__init__(), and allows running snapshot command
without using stream mode.
- Handle login errors better, and not just at startup.
- Increase network connect & read timeout to 6.05 seconds.
- Increase network read timeout to 20 seconds for snapshot command.
- Run snapshot command in separate task, that cannot be cancelled, to eliminate
possibility of two snapshot commands running simultaneously (since
AmcrestCam.async_camera_image can be cancelled.) Also makes sure any exceptions
from the command are caught properly.
* Improve amcrest error handling and bump amcrest package to 1.5.3
amcrest package update fixes command retry, especially with Digest Authentication, and allows sending snapshot command without channel parameter.
Get rid of persistent_notification.
Errors at startup, other than login errors, are no longer fatal.
Display debug messages about how many times an error has occurred in a row.
Remove initial communications test. If camera is off line at startup this just delays the component setup.
Handle urllib3 errors when getting data from commands that were sent with stream=True.
If errors occur during camera update, try repeating until it works or the camera is determined to be off line.
Drop channel parameter in snapshot command which allows camera to use its default channel, which is different in different camera models and firmware versions.
Make entities unavailable if too many errors occur in a row.
Add new configuration variables to control how many errors in a row should be interpreted as camera being offline, and how frequently to "ping" camera to see when it becomes available again.
Add online binary_sensor option to indicate if camera is available (i.e., responding to commands.)
* Update per review comments
Remove max_errors and recheck_interval configuration variables and used fixed values instead.
Move definition of AmcrestChecker class to module level.
Change should_poll in camera.py to return a fixed value of True and move logic to update method.
Improve sdcard sensor so it only sends one command to camera per update as opposed to the four it used to send to reduce network traffic and make data consistent. Also better handle returned values of 'unknown'.