Add new event sensors from UniFi Protect 2.11 (#107773)

pull/107779/head
Christopher Bailey 2024-01-11 00:23:59 -05:00 committed by GitHub
parent 99e25d94c0
commit b83f5b5932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 203 additions and 0 deletions

View File

@ -210,6 +210,69 @@ CAMERA_SENSORS: tuple[ProtectBinaryEntityDescription, ...] = (
ufp_value="is_co_detection_on",
ufp_perm=PermRequired.NO_WRITE,
),
ProtectBinaryEntityDescription(
key="smart_siren",
name="Detections: Siren",
icon="mdi:alarm-bell",
entity_category=EntityCategory.DIAGNOSTIC,
ufp_required_field="can_detect_siren",
ufp_value="is_siren_detection_on",
ufp_perm=PermRequired.NO_WRITE,
),
ProtectBinaryEntityDescription(
key="smart_baby_cry",
name="Detections: Baby Cry",
icon="mdi:cradle",
entity_category=EntityCategory.DIAGNOSTIC,
ufp_required_field="can_detect_baby_cry",
ufp_value="is_baby_cry_detection_on",
ufp_perm=PermRequired.NO_WRITE,
),
ProtectBinaryEntityDescription(
key="smart_speak",
name="Detections: Speaking",
icon="mdi:account-voice",
entity_category=EntityCategory.DIAGNOSTIC,
ufp_required_field="can_detect_speaking",
ufp_value="is_speaking_detection_on",
ufp_perm=PermRequired.NO_WRITE,
),
ProtectBinaryEntityDescription(
key="smart_bark",
name="Detections: Barking",
icon="mdi:dog",
entity_category=EntityCategory.DIAGNOSTIC,
ufp_required_field="can_detect_bark",
ufp_value="is_bark_detection_on",
ufp_perm=PermRequired.NO_WRITE,
),
ProtectBinaryEntityDescription(
key="smart_car_alarm",
name="Detections: Car Alarm",
icon="mdi:car",
entity_category=EntityCategory.DIAGNOSTIC,
ufp_required_field="can_detect_car_alarm",
ufp_value="is_car_alarm_detection_on",
ufp_perm=PermRequired.NO_WRITE,
),
ProtectBinaryEntityDescription(
key="smart_car_horn",
name="Detections: Car Horn",
icon="mdi:bugle",
entity_category=EntityCategory.DIAGNOSTIC,
ufp_required_field="can_detect_car_horn",
ufp_value="is_car_horn_detection_on",
ufp_perm=PermRequired.NO_WRITE,
),
ProtectBinaryEntityDescription(
key="smart_glass_break",
name="Detections: Glass Break",
icon="mdi:glass-fragile",
entity_category=EntityCategory.DIAGNOSTIC,
ufp_required_field="can_detect_glass_break",
ufp_value="is_glass_break_detection_on",
ufp_perm=PermRequired.NO_WRITE,
),
)
LIGHT_SENSORS: tuple[ProtectBinaryEntityDescription, ...] = (
@ -415,6 +478,69 @@ EVENT_SENSORS: tuple[ProtectBinaryEventEntityDescription, ...] = (
ufp_enabled="is_co_detection_on",
ufp_event_obj="last_cmonx_detect_event",
),
ProtectBinaryEventEntityDescription(
key="smart_audio_siren",
name="Siren Detected",
icon="mdi:alarm-bell",
ufp_value="is_siren_currently_detected",
ufp_required_field="can_detect_siren",
ufp_enabled="is_siren_detection_on",
ufp_event_obj="last_siren_detect_event",
),
ProtectBinaryEventEntityDescription(
key="smart_audio_baby_cry",
name="Baby Cry Detected",
icon="mdi:cradle",
ufp_value="is_baby_cry_currently_detected",
ufp_required_field="can_detect_baby_cry",
ufp_enabled="is_baby_cry_detection_on",
ufp_event_obj="last_baby_cry_detect_event",
),
ProtectBinaryEventEntityDescription(
key="smart_audio_speak",
name="Speaking Detected",
icon="mdi:account-voice",
ufp_value="is_speaking_currently_detected",
ufp_required_field="can_detect_speaking",
ufp_enabled="is_speaking_detection_on",
ufp_event_obj="last_speaking_detect_event",
),
ProtectBinaryEventEntityDescription(
key="smart_audio_bark",
name="Barking Detected",
icon="mdi:dog",
ufp_value="is_bark_currently_detected",
ufp_required_field="can_detect_bark",
ufp_enabled="is_bark_detection_on",
ufp_event_obj="last_bark_detect_event",
),
ProtectBinaryEventEntityDescription(
key="smart_audio_car_alarm",
name="Car Alarm Detected",
icon="mdi:car",
ufp_value="is_car_alarm_currently_detected",
ufp_required_field="can_detect_car_alarm",
ufp_enabled="is_car_alarm_detection_on",
ufp_event_obj="last_car_alarm_detect_event",
),
ProtectBinaryEventEntityDescription(
key="smart_audio_car_horn",
name="Car Horn Detected",
icon="mdi:bugle",
ufp_value="is_car_horn_currently_detected",
ufp_required_field="can_detect_car_horn",
ufp_enabled="is_car_horn_detection_on",
ufp_event_obj="last_car_horn_detect_event",
),
ProtectBinaryEventEntityDescription(
key="smart_audio_glass_break",
name="Glass Break Detected",
icon="mdi:glass-fragile",
ufp_value="last_glass_break_detect",
ufp_required_field="can_detect_glass_break",
ufp_enabled="is_glass_break_detection_on",
ufp_event_obj="last_glass_break_detect_event",
),
)
DOORLOCK_SENSORS: tuple[ProtectBinaryEntityDescription, ...] = (

View File

@ -221,6 +221,83 @@ CAMERA_SWITCHES: tuple[ProtectSwitchEntityDescription, ...] = (
ufp_set_method="set_cmonx_detection",
ufp_perm=PermRequired.WRITE,
),
ProtectSwitchEntityDescription(
key="smart_siren",
name="Detections: Siren",
icon="mdi:alarm-bell",
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_siren",
ufp_value="is_siren_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_siren_detection",
ufp_perm=PermRequired.WRITE,
),
ProtectSwitchEntityDescription(
key="smart_baby_cry",
name="Detections: Baby Cry",
icon="mdi:cradle",
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_baby_cry",
ufp_value="is_baby_cry_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_baby_cry_detection",
ufp_perm=PermRequired.WRITE,
),
ProtectSwitchEntityDescription(
key="smart_speak",
name="Detections: Speaking",
icon="mdi:account-voice",
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_speaking",
ufp_value="is_speaking_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_speaking_detection",
ufp_perm=PermRequired.WRITE,
),
ProtectSwitchEntityDescription(
key="smart_bark",
name="Detections: Barking",
icon="mdi:dog",
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_bark",
ufp_value="is_bark_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_bark_detection",
ufp_perm=PermRequired.WRITE,
),
ProtectSwitchEntityDescription(
key="smart_car_alarm",
name="Detections: Car Alarm",
icon="mdi:car",
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_car_alarm",
ufp_value="is_car_alarm_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_car_alarm_detection",
ufp_perm=PermRequired.WRITE,
),
ProtectSwitchEntityDescription(
key="smart_car_horn",
name="Detections: Car Horn",
icon="mdi:bugle",
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_car_horn",
ufp_value="is_car_horn_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_car_horn_detection",
ufp_perm=PermRequired.WRITE,
),
ProtectSwitchEntityDescription(
key="smart_glass_break",
name="Detections: Glass Break",
icon="mdi:glass-fragile",
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_glass_break",
ufp_value="is_glass_break_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_glass_break_detection",
ufp_perm=PermRequired.WRITE,
),
)
PRIVACY_MODE_SWITCH = ProtectSwitchEntityDescription[Camera](