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
71.07k stars 29.73k forks source link

Unifi Protect - not naming entities uniquely or consistently in format #122512

Open danielgoepp opened 1 month ago

danielgoepp commented 1 month ago

The problem

It would appear that for some device types, for example G4 Bullet cameras, if you have more than one, the entity ids that are created are not all unique. Some are, just not all. For example in my setup many of them include the 'slab' or 'west_yard' to indicate which camera is being references, but some don't do this, so the _2 has to be added on the end to make them unique.

The first camera 'Slab G4 Bullet High resolution channel' gets 'camera.g4_bullet_high' however the second camera West Yard G4 Bullet High resolution channel' gets 'camera.g4_bullet_high_2'

I would have recommended they get: camera.slab_g4_bullet_high camera.west_yard_g4_bullet_high

These are the two devices in question:

image

Also sometimes the format is slab_g4bullet and sometimes it's g4_bulletslab

Here is an export of all the entities for these two devices on my system:

| Friendly Name                               | Current Entity ID                                       | New Entity ID   |
|---------------------------------------------|---------------------------------------------------------|-----------------|
| Slab G4 Bullet Animal detected              | binary_sensor.slab_g4_bullet_animal_detected            |                 |
| Slab G4 Bullet Audio object detected        | binary_sensor.g4_bullet_slab_audio_object_detected      |                 |
| Slab G4 Bullet Baby cry detected            | binary_sensor.g4_bullet_slab_baby_cry_detected          |                 |
| Slab G4 Bullet CO alarm detected            | binary_sensor.g4_bullet_slab_co_alarm_detected          |                 |
| Slab G4 Bullet Detections: CO               | binary_sensor.g4_bullet_slab_detections_co              |                 |
| Slab G4 Bullet Detections: animal           | binary_sensor.slab_g4_bullet_detections_animal          |                 |
| Slab G4 Bullet Detections: baby cry         | binary_sensor.g4_bullet_slab_detections_baby_cry        |                 |
| Slab G4 Bullet Detections: motion           | binary_sensor.g4_bullet_detections_motion               |                 |
| Slab G4 Bullet Detections: person           | binary_sensor.g4_bullet_slab_detections_person          |                 |
| Slab G4 Bullet Detections: smoke            | binary_sensor.g4_bullet_slab_detections_smoke           |                 |
| Slab G4 Bullet Detections: vehicle          | binary_sensor.g4_bullet_slab_detections_vehicle         |                 |
| Slab G4 Bullet Disk write rate              |        sensor.g4_bullet_disk_write_rate                 |                 |
| Slab G4 Bullet HDR mode                     | binary_sensor.g4_bullet_slab_hdr_mode                   |                 |
| Slab G4 Bullet High FPS                     | binary_sensor.g4_bullet_slab_high_fps                   |                 |
| Slab G4 Bullet High resolution channel      |        camera.g4_bullet_high                            |                 |
| Slab G4 Bullet Infrared mode                |        sensor.g4_bullet_slab_infrared_mode              |                 |
| Slab G4 Bullet Is dark                      | binary_sensor.g4_bullet_is_dark                         |                 |
| Slab G4 Bullet Microphone level             |        sensor.g4_bullet_slab_microphone_level           |                 |
| Slab G4 Bullet Motion                       | binary_sensor.g4_bullet_motion                          |                 |
| Slab G4 Bullet Object detected              | binary_sensor.g4_bullet_slab_object_detected            |                 |
| Slab G4 Bullet Overlay: show bitrate        | binary_sensor.g4_bullet_overlay_show_bitrate            |                 |
| Slab G4 Bullet Overlay: show date           | binary_sensor.g4_bullet_overlay_show_date               |                 |
| Slab G4 Bullet Overlay: show logo           | binary_sensor.g4_bullet_overlay_show_logo               |                 |
| Slab G4 Bullet Overlay: show name           | binary_sensor.g4_bullet_overlay_show_name               |                 |
| Slab G4 Bullet Person detected              | binary_sensor.g4_bullet_slab_person_detected            |                 |
| Slab G4 Bullet Recording mode               |        sensor.g4_bullet_recording_mode                  |                 |
| Slab G4 Bullet Smoke alarm detected         | binary_sensor.g4_bullet_slab_smoke_alarm_detected       |                 |
| Slab G4 Bullet Storage used                 |        sensor.g4_bullet_storage_used                    |                 |
| Slab G4 Bullet Vehicle detected             | binary_sensor.g4_bullet_slab_vehicle_detected           |                 |
| West Yard G4 Bullet Animal detected         | binary_sensor.west_yard_g4_bullet_animal_detected       |                 |
| West Yard G4 Bullet Audio object detected   | binary_sensor.g4_bullet_west_yard_audio_object_detected |                 |
| West Yard G4 Bullet Baby cry detected       | binary_sensor.g4_bullet_west_yard_baby_cry_detected     |                 |
| West Yard G4 Bullet CO alarm detected       | binary_sensor.g4_bullet_west_yard_co_alarm_detected     |                 |
| West Yard G4 Bullet Detections: CO          | binary_sensor.g4_bullet_west_yard_detections_co         |                 |
| West Yard G4 Bullet Detections: animal      | binary_sensor.west_yard_g4_bullet_detections_animal     |                 |
| West Yard G4 Bullet Detections: baby cry    | binary_sensor.g4_bullet_west_yard_detections_baby_cry   |                 |
| West Yard G4 Bullet Detections: motion      | binary_sensor.g4_bullet_detections_motion_2             |                 |
| West Yard G4 Bullet Detections: person      | binary_sensor.g4_bullet_west_yard_detections_person     |                 |
| West Yard G4 Bullet Detections: smoke       | binary_sensor.g4_bullet_west_yard_detections_smoke      |                 |
| West Yard G4 Bullet Detections: vehicle     | binary_sensor.g4_bullet_west_yard_detections_vehicle    |                 |
| West Yard G4 Bullet Disk write rate         |        sensor.g4_bullet_disk_write_rate_2               |                 |
| West Yard G4 Bullet HDR mode                | binary_sensor.g4_bullet_west_yard_hdr_mode              |                 |
| West Yard G4 Bullet High FPS                | binary_sensor.g4_bullet_west_yard_high_fps              |                 |
| West Yard G4 Bullet High resolution channel |        camera.g4_bullet_high_2                          |                 |
| West Yard G4 Bullet Infrared mode           |        sensor.g4_bullet_west_yard_infrared_mode         |                 |
| West Yard G4 Bullet Is dark                 | binary_sensor.g4_bullet_is_dark_2                       |                 |
| West Yard G4 Bullet Microphone level        |        sensor.g4_bullet_west_yard_microphone_level      |                 |
| West Yard G4 Bullet Motion                  | binary_sensor.g4_bullet_motion_2                        |                 |
| West Yard G4 Bullet Object detected         | binary_sensor.g4_bullet_west_yard_object_detected       |                 |
| West Yard G4 Bullet Overlay: show bitrate   | binary_sensor.g4_bullet_overlay_show_bitrate_2          |                 |
| West Yard G4 Bullet Overlay: show date      | binary_sensor.g4_bullet_overlay_show_date_2             |                 |
| West Yard G4 Bullet Overlay: show logo      | binary_sensor.g4_bullet_overlay_show_logo_2             |                 |
| West Yard G4 Bullet Overlay: show name      | binary_sensor.g4_bullet_overlay_show_name_2             |                 |
| West Yard G4 Bullet Person detected         | binary_sensor.g4_bullet_west_yard_person_detected       |                 |
| West Yard G4 Bullet Recording mode          |        sensor.g4_bullet_recording_mode_2                |                 |
| West Yard G4 Bullet Smoke alarm detected    | binary_sensor.g4_bullet_west_yard_smoke_alarm_detected  |                 |
| West Yard G4 Bullet Storage used            |        sensor.g4_bullet_storage_used_2                  |                 |
| West Yard G4 Bullet Vehicle detected        | binary_sensor.g4_bullet_west_yard_vehicle_detected      |                 |

What version of Home Assistant Core has the issue?

2024.7.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

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 1 month ago

unifiprotect documentation unifiprotect source