Split august motion and image capture binary sensors (#62154)

This commit is contained in:
J. Nick Koston 2021-12-19 00:25:30 -06:00 committed by GitHub
parent ebfe9aa384
commit 03477e0ae6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 80 additions and 13 deletions

View file

@ -58,6 +58,17 @@ def _retrieve_motion_state(data: AugustData, detail: DoorbellDetail) -> bool:
return _activity_time_based_state(latest)
def _retrieve_image_capture_state(data: AugustData, detail: DoorbellDetail) -> bool:
latest = data.activity_stream.get_latest_device_activity(
detail.device_id, {ActivityType.DOORBELL_IMAGE_CAPTURE}
)
if latest is None:
return False
return _activity_time_based_state(latest)
def _retrieve_ding_state(data: AugustData, detail: DoorbellDetail) -> bool:
latest = data.activity_stream.get_latest_device_activity(
detail.device_id, {ActivityType.DOORBELL_DING}
@ -123,6 +134,13 @@ SENSOR_TYPES_DOORBELL: tuple[AugustBinarySensorEntityDescription, ...] = (
value_fn=_retrieve_motion_state,
is_time_based=True,
),
AugustBinarySensorEntityDescription(
key="doorbell_image_capture",
name="Image Capture",
icon="mdi:file-image",
value_fn=_retrieve_image_capture_state,
is_time_based=True,
),
AugustBinarySensorEntityDescription(
key="doorbell_online",
name="Online",