Fix handling package detection for latest UniFi Protect beta (#71821)
Co-authored-by: J. Nick Koston <nick@koston.org>pull/72107/head
parent
2448661371
commit
5f3c7f11d8
|
@ -143,7 +143,9 @@ class ProtectFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
user_input[CONF_VERIFY_SSL] = False
|
||||
nvr_data, errors = await self._async_get_nvr_data(user_input)
|
||||
if nvr_data and not errors:
|
||||
return self._async_create_entry(nvr_data.name, user_input)
|
||||
return self._async_create_entry(
|
||||
nvr_data.name or nvr_data.type, user_input
|
||||
)
|
||||
|
||||
placeholders = {
|
||||
"name": discovery_info["hostname"]
|
||||
|
@ -289,7 +291,9 @@ class ProtectFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
await self.async_set_unique_id(nvr_data.mac)
|
||||
self._abort_if_unique_id_configured()
|
||||
|
||||
return self._async_create_entry(nvr_data.name, user_input)
|
||||
return self._async_create_entry(
|
||||
nvr_data.name or nvr_data.type, user_input
|
||||
)
|
||||
|
||||
user_input = user_input or {}
|
||||
return self.async_show_form(
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "UniFi Protect",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/unifiprotect",
|
||||
"requirements": ["pyunifiprotect==3.4.1", "unifi-discovery==1.1.2"],
|
||||
"requirements": ["pyunifiprotect==3.5.1", "unifi-discovery==1.1.2"],
|
||||
"dependencies": ["http"],
|
||||
"codeowners": ["@briis", "@AngellusMortis", "@bdraco"],
|
||||
"quality_scale": "platinum",
|
||||
|
|
|
@ -140,7 +140,7 @@ def _get_doorbell_options(api: ProtectApiClient) -> list[dict[str, Any]]:
|
|||
def _get_paired_camera_options(api: ProtectApiClient) -> list[dict[str, Any]]:
|
||||
options = [{"id": TYPE_EMPTY_VALUE, "name": "Not Paired"}]
|
||||
for camera in api.bootstrap.cameras.values():
|
||||
options.append({"id": camera.id, "name": camera.name})
|
||||
options.append({"id": camera.id, "name": camera.name or camera.type})
|
||||
|
||||
return options
|
||||
|
||||
|
|
|
@ -159,6 +159,15 @@ CAMERA_SWITCHES: tuple[ProtectSwitchEntityDescription, ...] = (
|
|||
ufp_value="is_face_detection_on",
|
||||
ufp_set_method="set_face_detection",
|
||||
),
|
||||
ProtectSwitchEntityDescription(
|
||||
key="smart_package",
|
||||
name="Detections: Package",
|
||||
icon="mdi:package-variant-closed",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
ufp_required_field="can_detect_package",
|
||||
ufp_value="is_package_detection_on",
|
||||
ufp_set_method="set_package_detection",
|
||||
),
|
||||
)
|
||||
|
||||
SENSE_SWITCHES: tuple[ProtectSwitchEntityDescription, ...] = (
|
||||
|
|
|
@ -1981,7 +1981,7 @@ pytrafikverket==0.1.6.2
|
|||
pyudev==0.22.0
|
||||
|
||||
# homeassistant.components.unifiprotect
|
||||
pyunifiprotect==3.4.1
|
||||
pyunifiprotect==3.5.1
|
||||
|
||||
# homeassistant.components.uptimerobot
|
||||
pyuptimerobot==22.2.0
|
||||
|
|
|
@ -1304,7 +1304,7 @@ pytrafikverket==0.1.6.2
|
|||
pyudev==0.22.0
|
||||
|
||||
# homeassistant.components.unifiprotect
|
||||
pyunifiprotect==3.4.1
|
||||
pyunifiprotect==3.5.1
|
||||
|
||||
# homeassistant.components.uptimerobot
|
||||
pyuptimerobot==22.2.0
|
||||
|
|
|
@ -26,9 +26,13 @@ from .conftest import (
|
|||
ids_from_device_description,
|
||||
)
|
||||
|
||||
CAMERA_SWITCHES_NO_FACE = [d for d in CAMERA_SWITCHES if d.name != "Detections: Face"]
|
||||
CAMERA_SWITCHES_BASIC = [
|
||||
d
|
||||
for d in CAMERA_SWITCHES
|
||||
if d.name != "Detections: Face" and d.name != "Detections: Package"
|
||||
]
|
||||
CAMERA_SWITCHES_NO_EXTRA = [
|
||||
d for d in CAMERA_SWITCHES_NO_FACE if d.name not in ("High FPS", "Privacy Mode")
|
||||
d for d in CAMERA_SWITCHES_BASIC if d.name not in ("High FPS", "Privacy Mode")
|
||||
]
|
||||
|
||||
|
||||
|
@ -253,7 +257,7 @@ async def test_switch_setup_camera_all(
|
|||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
for description in CAMERA_SWITCHES_NO_FACE:
|
||||
for description in CAMERA_SWITCHES_BASIC:
|
||||
unique_id, entity_id = ids_from_device_description(
|
||||
Platform.SWITCH, camera, description
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue