Convert amcrest binary sensors from poll to stream (#32818)

* 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.
This commit is contained in:
Phil Bruckner authored and GitHub committed 2020-03-19 21:07:21 -07:00
1 parent d8e3e9abaa
commit 0ed7bc3b8e
6 files changed
+130 -32

No files matched your search

+6 -1
View File
@@ -4,11 +4,16 @@ DATA_AMCREST = DOMAIN
CAMERAS = "cameras"
DEVICES = "devices"
BINARY_SENSOR_SCAN_INTERVAL_SECS = 5
BINARY_SENSOR_SCAN_INTERVAL_SECS = 60
CAMERA_WEB_SESSION_TIMEOUT = 10
COMM_RETRIES = 1
COMM_TIMEOUT = 6.05
SENSOR_SCAN_INTERVAL_SECS = 10
SNAPSHOT_TIMEOUT = 20
SERVICE_EVENT = "event"
SERVICE_UPDATE = "update"
SENSOR_DEVICE_CLASS = "class"
SENSOR_EVENT_CODE = "code"
SENSOR_NAME = "name"