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

HomeAssistant >2023.8.0 Warning: MQTT device name is equal to entity name in your config #514

Open
krkeegan opened this issue Aug 4, 2023 · 6 comments

Comments

@krkeegan
Copy link
Collaborator

krkeegan commented Aug 4, 2023

Describe the bug
Starting in 2023.8.0, depending on your configuration, you may start to see a warning for each device that looks like:

MQTT device name is equal to entity name in your config {...}, this is not expected. Please correct your configuration. The entity name will be set to `null`

This is just a warning, things will continue to work until April 2024.

Cause
HomeAssistant has changed how it handles entity names. Previously it was acceptable to have the following:
Device: Garage KPL
Entity: Garage KPL Btn1

Now, if I understand things correctly, HomeAssistant wants the names to be:
Device: Garage KPL
Entity: Btn1

I believe HomeAssistant will automatically append the device name to the beginning of the entity name.

See: HA Forum Post for a discussion of the issue.

Solution
This is just a simple change in the discovery template config. In many cases we can just eliminate {{name_user_case}} from the start of the entity names.

The unique IDs remain the same, so this shouldn't have any affect on a user's setup.

However, in a few cases (lights, switches, ...) the entity and the device share the same name since there is only a single entity. In these cases, I guess we will have to call the entity light or switch. Alternatively it looks like maybe not having a name at all for these single entity devices may work as well?

Suggestions
I am open to any other suggestions people have.

Timetable
We have plenty of time to play with the options a bit before pushing out the solution. I would say September 2023 is the earliest expected release.

@krkeegan
Copy link
Collaborator Author

krkeegan commented Aug 4, 2023

From the Breaking Changes:

Naming of MQTT entities

The naming of MQTT entities has been changed to be aligned with the entity naming guidelines:

  • The has_entity_name entity will be set to True on all MQTT entities.
  • This means any MQTT entity which is part of a device will automatically have its friendly_name attribute prefixed with the device name.
  • Unnamed binary_sensor, button, event, number, and sensor entities will now be named by their device class instead of being named “MQTT binary sensor” etc.
  • It’s now allowed to set an MQTT entity’s name to None to mark it as the main feature of a device.

I don't understand bullet point 3. But, maybe that doesn't apply to us?

But it does sound like setting the name to None on single entity devices or even where the entity is the "main feature of a device" is the right thing to do.

@krkeegan
Copy link
Collaborator Author

krkeegan commented Aug 4, 2023

My limited testing suggests that while existing users may receive the warning, the change will only affect new users. Since the unique_id is not changing the previously derived value of the friendly_name remains fixed in HomeAssistant, even if the user did not previously alter the friendly_name. So any change we make to name will not affect existing users, but it will get rid of the warning..

@djfjeff
Copy link

djfjeff commented Sep 14, 2023

Maybe I don't understand on my end but what do you propose for existing user that have this warning for example :

2023-09-14 08:22:59.232 WARNING (MainThread) [homeassistant.components.mqtt.mixins] MQTT entity name starts with the device name in your config {'unique_id': '34.d6.33_8', 'name': 'Modem Scene 8', 'availability_topic': 'insteon/availability', 'command_topic': 'insteon/modem/scene', 'device': {'identifiers': ['34.d6.33'], 'manufacturer': 'Insteon', 'model': '2413U - PowerLinc USB Modem (Dual Band)', 'sw_version': '0x9e - Unknown', 'name': 'Modem', 'via_device': '34.d6.33', 'connections': []}, 'payload_on': '{"state": "on", "group": "8"}', 'payload_off': '{"state": "off", "group": "8"}', 'enabled_by_default': True, 'retain': False, 'qos': 0, 'encoding': 'utf-8', 'availability_mode': 'latest', 'payload_available': 'online', 'optimistic': False, 'payload_not_available': 'offline'}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Scene 8'

Should I just go to the UI and rename switch.modem_scene_8 to switch.scene_8 or something like this?

@krkeegan
Copy link
Collaborator Author

Upgrade to 1.2.0. It is fixed there for the default installation.

If you defined your own custom discovery templates, you should read Home assistant's entity naming guidelines https://developers.home-assistant.io/docs/core/entity/#entity-naming

@krkeegan
Copy link
Collaborator Author

It looks like your naming conventions for your modern scenes violates the HA naming guidelines. "Modem Scene 8" will not be allowed in HA in 6 months. But "Scene 8" is fine.

@djfjeff
Copy link

djfjeff commented Sep 14, 2023

I already update to 1.2.0, this message is from this version of Insteon MQTT. The Scene 2 to Scene 8 are the only entity that show this issue in my environment, everything else is good. I never used custom discovery on my end but my installation is very old (early day of insteon-mqtt).

Should I simply rename those and go on from there?

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

No branches or pull requests

2 participants