home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.76k stars 28.91k forks source link

Unifi Protect Tracking: Person unavailable #119222

Open Julian0021 opened 3 weeks ago

Julian0021 commented 3 weeks ago

The problem

After the latest protect update, the ptz person tracking feature became unavailable.

What version of Home Assistant Core has the issue?

core-2024.6.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Unifi Protect

Link to integration documentation on our website

https://www.home-assistant.io/integrations/unifiprotect/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 3 weeks ago

unifiprotect documentation unifiprotect source

bdraco commented 1 week ago

Please provide a screenshot as its not clear what is not working

Julian0021 commented 1 week ago

The entity switch _switch.g4_ptz_trackingperson became unavailable recently. image

bdraco commented 1 week ago

Thanks. Can you also provide diagnostics?

Which camera model is it?

bdraco commented 1 week ago

https://www.home-assistant.io/docs/configuration/troubleshooting/#debug-logs-and-diagnostics

bdraco commented 1 week ago

It might be that the field moved in protect 4.x

I don't have any PTZ cameras to test with, but I suspect this might fix it

diff --git a/homeassistant/components/unifiprotect/binary_sensor.py b/homeassistant/components/unifiprotect/binary_sensor.py
index fb60158580e..35e378d32e8 100644
--- a/homeassistant/components/unifiprotect/binary_sensor.py
+++ b/homeassistant/components/unifiprotect/binary_sensor.py
@@ -284,7 +284,7 @@ CAMERA_SENSORS: tuple[ProtectBinaryEntityDescription, ...] = (
         name="Tracking: person",
         icon="mdi:walk",
         entity_category=EntityCategory.DIAGNOSTIC,
-        ufp_required_field="is_ptz",
+        ufp_required_field="feature_flags.is_ptz",
         ufp_value="is_person_tracking_enabled",
         ufp_perm=PermRequired.NO_WRITE,
     ),
diff --git a/homeassistant/components/unifiprotect/switch.py b/homeassistant/components/unifiprotect/switch.py
index ca56a602209..50372d47ea8 100644
--- a/homeassistant/components/unifiprotect/switch.py
+++ b/homeassistant/components/unifiprotect/switch.py
@@ -319,7 +319,7 @@ CAMERA_SWITCHES: tuple[ProtectSwitchEntityDescription, ...] = (
         name="Tracking: person",
         icon="mdi:walk",
         entity_category=EntityCategory.CONFIG,
-        ufp_required_field="is_ptz",
+        ufp_required_field="feature_flags.is_ptz",
         ufp_value="is_person_tracking_enabled",
         ufp_set_method="set_person_track",
         ufp_perm=PermRequired.WRITE,
bdraco commented 1 week ago

The diagnostics should confirm either way