insteon-mqtt icon indicating copy to clipboard operation
insteon-mqtt copied to clipboard

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

Open krkeegan opened this issue 1 year ago • 6 comments

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 avatar Aug 04 '23 18:08 krkeegan

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 avatar Aug 04 '23 18:08 krkeegan

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..

krkeegan avatar Aug 04 '23 20:08 krkeegan

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?

djfjeff avatar Sep 14 '23 12:09 djfjeff

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 avatar Sep 14 '23 14:09 krkeegan

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.

krkeegan avatar Sep 14 '23 14:09 krkeegan

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?

djfjeff avatar Sep 14 '23 14:09 djfjeff