Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use labels in Home Assistant entity naming #18678

Merged
merged 2 commits into from
Aug 22, 2023

Conversation

Drafteed
Copy link
Contributor

@Drafteed Drafteed commented Aug 21, 2023

Based on: Koenkk/zigbee-herdsman-converters#6066, #18445 (comment), and #16702 (comment).

Finally fixes: #18445

This PR introduces using of a new label property from exposes in Home Assistant entity naming and brings entity naming to the requirements from home-assistant/core#95159 and https://developers.home-assistant.io/docs/core/entity/#entity-naming.

This change also affects #18208 and contains several fixes to avoid the regression:

  1. Not all exposes with device_class should be unnamed (e.g. Local Temperature Calibration).
  2. Only binary_sensor, button, number and sensor entities types can be named by their device class, not all.
  3. Added object_id to the discovery payload for all entities, which tells the Home Assistant how to generate the entity_id for the entity. This avoid breaking change from feat: Let Home Assistant generate entity name when device_class is present #18208 and f619610.

Specifying the object_id for all entries in the discovery payload will avoid breaking changes for all users in the upcoming release, and also will allow us to completely change the label of exposes (e.g. min_heat_setpoint_limit -> Minimum heat setpoint limit) without affecting the entity_id in Home Assistant, even if the device will be re-added.

Tested on my 25 devices.

@Koenkk
Copy link
Owner

Koenkk commented Aug 22, 2023

Many thanks! 🚀

@Koenkk Koenkk merged commit e33e335 into Koenkk:dev Aug 22, 2023
11 checks passed
@Drafteed Drafteed deleted the ha-entity-labels branch August 22, 2023 06:46
@Drafteed
Copy link
Contributor Author

One concern: breaking changes from f619610 cannot be completely avoided because HA <2023.8.0 does not accept MQTT objects with null name.
We should warn users about this in the release notes anyway.

@Koenkk
Copy link
Owner

Koenkk commented Aug 22, 2023

Yes, will do that

@SargonofAssyria
Copy link

This also creates a problem in Domoticz MQTT-AD, because the null is now translate in Domoticz in sensor_unique_id instead of a normal devicename as given by FriendlyName. Is in possible to have the FriendlyName instead of the null?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants