Fix edge cases for adding/enabling sensors for UniFi Protect (#86329)

Co-authored-by: J. Nick Koston <nick@koston.org>
fixes undefined
This commit is contained in:
Christopher Bailey 2023-01-21 14:38:59 -05:00 committed by GitHub
parent 5306883288
commit 772a432c4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 3 deletions

View file

@ -346,6 +346,7 @@ EVENT_SENSORS: tuple[ProtectBinaryEventEntityDescription, ...] = (
name="Motion",
device_class=BinarySensorDeviceClass.MOTION,
ufp_value="is_motion_detected",
ufp_enabled="is_motion_detection_on",
ufp_event_obj="last_motion_event",
),
ProtectBinaryEventEntityDescription(

View file

@ -4,7 +4,7 @@
"integration_type": "hub",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/unifiprotect",
"requirements": ["pyunifiprotect==4.6.1", "unifi-discovery==1.1.7"],
"requirements": ["pyunifiprotect==4.6.2", "unifi-discovery==1.1.7"],
"dependencies": ["http", "repairs"],
"codeowners": ["@briis", "@AngellusMortis", "@bdraco"],
"quality_scale": "platinum",

View file

@ -139,6 +139,7 @@ CAMERA_SWITCHES: tuple[ProtectSwitchEntityDescription, ...] = (
icon="mdi:run-fast",
entity_category=EntityCategory.CONFIG,
ufp_value="recording_settings.enable_motion_detection",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_motion_detection",
ufp_perm=PermRequired.WRITE,
),
@ -149,6 +150,7 @@ CAMERA_SWITCHES: tuple[ProtectSwitchEntityDescription, ...] = (
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_person",
ufp_value="is_person_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_person_detection",
ufp_perm=PermRequired.WRITE,
),
@ -159,6 +161,7 @@ CAMERA_SWITCHES: tuple[ProtectSwitchEntityDescription, ...] = (
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_vehicle",
ufp_value="is_vehicle_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_vehicle_detection",
ufp_perm=PermRequired.WRITE,
),
@ -169,6 +172,7 @@ CAMERA_SWITCHES: tuple[ProtectSwitchEntityDescription, ...] = (
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_face",
ufp_value="is_face_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_face_detection",
ufp_perm=PermRequired.WRITE,
),
@ -179,6 +183,7 @@ CAMERA_SWITCHES: tuple[ProtectSwitchEntityDescription, ...] = (
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_package",
ufp_value="is_package_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_package_detection",
ufp_perm=PermRequired.WRITE,
),
@ -189,6 +194,7 @@ CAMERA_SWITCHES: tuple[ProtectSwitchEntityDescription, ...] = (
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_license_plate",
ufp_value="is_license_plate_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_license_plate_detection",
ufp_perm=PermRequired.WRITE,
),
@ -199,6 +205,7 @@ CAMERA_SWITCHES: tuple[ProtectSwitchEntityDescription, ...] = (
entity_category=EntityCategory.CONFIG,
ufp_required_field="can_detect_smoke",
ufp_value="is_smoke_detection_on",
ufp_enabled="is_recording_enabled",
ufp_set_method="set_smoke_detection",
ufp_perm=PermRequired.WRITE,
),

View file

@ -2140,7 +2140,7 @@ pytrafikverket==0.2.2
pyudev==0.23.2
# homeassistant.components.unifiprotect
pyunifiprotect==4.6.1
pyunifiprotect==4.6.2
# homeassistant.components.uptimerobot
pyuptimerobot==22.2.0

View file

@ -1512,7 +1512,7 @@ pytrafikverket==0.2.2
pyudev==0.23.2
# homeassistant.components.unifiprotect
pyunifiprotect==4.6.1
pyunifiprotect==4.6.2
# homeassistant.components.uptimerobot
pyuptimerobot==22.2.0