Split august motion and image capture binary sensors (#62154)
This commit is contained in:
parent
ebfe9aa384
commit
03477e0ae6
6 changed files with 80 additions and 13 deletions
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue