tache / homeassistant-kidde

A custom component for Kidde HomeSafe.
MIT License
15 stars 3 forks source link

Add unique devce identfying information to the HA entity IDs. #9

Closed tache closed 1 week ago

tache commented 4 weeks ago

Checklist

Is your feature request related to a problem? Please describe.

no

Describe the solution you'd like

Currently, Home Assistant entity ID names are listed in the form entity_type.property, i.e., sensor.air_pressure, binary_sensor.smoke_alarm, or button.test. When multiple devices are present, they are listed as sensor.air_pressure, sensor.air_pressure_2, or sensor.air_pressure_3. It would be nice to have the items also include some identifying information about the owning device.

Some example information that is available using the Kidde JSON properties:

Describe alternatives you've considered

Provide each entity with a manual name. This does not change the entity ID. See the additional context picture.

Additional context

Example Entities with one name change

github-kidde

Example confusion with selecting entities

github-kidde_3

carterbox commented 3 weeks ago

If we can pull in whatever name the user has assigned in the Kidde app, that would probably be ideal.

keatontaylor commented 3 weeks ago

Actually was looking at the code this seems like a fairly simple change, in the interest of always providing unique IDs the serial or the device ID to build the entity ID while using the name set by the user in the app to define the friendly name / device name would be ideal.

That way regardless if the user changes the name in the Kidde app all their automations will continue to work if they're using entity IDs based on serial / device ID.

tache commented 3 weeks ago

I also would love to have the label, but I agree with your comment on the change aspect. I would prefer to have the serial_number because that seems to be the MAC ID, and it would allow easy lookup in network management apps.

keatontaylor commented 3 weeks ago

Agreed, I am hoping setting the friendly name by default to something like [Label] [Sensor Name] "Bedroom Air Pressure" will still make it super easy to search via the home assistant UI for creating automation while also ensuring IDs remain consistent and unique regardless of reinstalling the integration, etc.

Btw thank you for taking on the work of maintaining this, I just purchased 7 of these and very happy to see an integration.

nberardi commented 6 days ago

nit: the comment

Added a unique entity id based on the serial_number to names. (@nberardi)

should read

Added a unique entity id based on name, and serial_number to entity. (@nberardi)

the unique identity is based on HA's own algorithm for naming.

tache commented 5 days ago

Updated release comment - Thanks!