PSA: MQTT Name changes in 2023.8

What broke for you? It appears you misunderstand the post.

3 Likes

So after updating everything (HA 2023.9 and Z2M 1.33) and restarting etc etc (no error logs) I now end up with Zigbee devices that use the sensor type in the friendly name, like: Kantoor Beweging, became Kantoor Beweging Beweging. The only way to fix this is by manually changing the Home Assistant name in Zigbee2Mqtt for every sensor I have, and will connect in the future? Changing it to ‘Kantoor’ in Home Assistant name field, fixes the friendly name and allows me to still use Kantoor Beweging as Z2M name.

I understand people might not consider this ‘breaking’ since entity_id’s stayed the same. But this is defnitely ‘breaking’ from UI standpoint and from device management, if I always have to change friendly names manually when adding a new device.

image

Is this really the solution, or am I missing something very obvious?

The worst part is that Home Assistant puts Door behind any contact sensor, even if it’s declared as a Window sensor by Home Assistant itself. So the only solution is to change the friendly name of each contact sensor inside HA.

image image

This feels like an extremely bad solution having to manually change these things in order to not have a duplicated name or wrong sensor type names? So I hope I am missing something.

1 Like

You should not have duplicate names unless you add the duplicated names in Z2M. By default Z2M does not do this either.

All this change did was: Add the device name to the entity name for naming the entity. I.e. if your device is named xyz in Z2M, and you got 2 entities in the past named abc and def. The result would be 2 entities with the name xyz abc and xyz def.

So if you named your device kantor beweging in Z2M and the sensor before was beweging, you can expect the name to be kantor beweging beweging.

As it stands, this would have also been the same result using Z2M in the past. So, I’m not sure how its different for you now.

Yes, but it doesn’t make sense to have a motion sensor called ‘Kantoor’ in Z2M, since I also have lights, a curtain, power outelets in that same room. Can’t have 8 Zigbee devices in one room that all have the name ‘Kantoor’ in Z2M. Which is why I (and many others) have Kantoor Beweging, Kantoor Gordijnen etc.

What other alternatives are there if you have more than one Zigbee sensor in a room and need to use a logical naming scheme?

Still, I don’t understand why a contact sensor automatically gets the ‘Door’ name in HA, even when HA itself has it set as window device_class? I either have a window sensor called ‘Kantoor Raam Deur’ or I have to manually set the friendly name in HA, which defeats the whole reasoning of HA putting the device type in the name since that gets overridden this way anyway


Ok, then name the device appropriately. E.g. “Phillips Hue Motion Sensor”

I name individual things accordingly. E.g. East Wall Motion Sensor, Fixture Bulb 1, Fixture Bulb 2, etc. Same as you would for all the other integrations that follow this pattern.

e.g.
image

And if you have 9 of them in your house, in each room one?

Kantoor Phillips Hue Motion Sensor
Slaapkamer Phillips Hue Motion Sensor

So in HA you get:

Kantoor Phillips Hue Motion Sensor Beweging
Slaapkamer Phillips Hue Motion Sensor Beweging

?

What’s even the point of Phillips Hue Motion Sensor AND Beweging in the friendly name, it’s completely redundant, since Phillips Hue Motion Sensor IS for motion.

Btw, not coming at you, but I’m sincerely asking what logical alternatives there are, since this all doesn’t make sense this way.

For all other devices types this didn’t change anything btw. My lights, eg: Kantoor Lamp Plafond 1, still has that name. It didn’t add ‘Lamp’ at the end (probably since domain is light and already clear?). It basically only affects binary_sensors since the domain doesn’t tell you the device type I suppose.

See my examples above, it’s a lot easier than you think. All of the bulbs in the picture I have shown above are the same device in the same area.

:man_shrugging:

FWIW ESPHOME did almost the same thing (though there entity names changed), and the only fix I found was to shift from MQTT to the API. It broke all my automations, not to mention Google Assistant, and all my web interfaces (manual edited ones). It is shown as cosmetic – it is not. Maybe it’s an ESPHOME bug, maybe not, but it is definitely not cosmetic with a key integration (or more than one).

In your situation, I’d probably go with

Office <device model number>, etc

The naming scheme isn’t an issue with light bulbs, since those friendly names didn’t change in HA.

Your proposition still doesn’t make sense for binary sensor devices, since having a motion sensor called ‘Kantoor Phillips Hue Motion Sensor Beweging’ in HA simply doesn’t make any sense. Phillips Hue Motion Sensor already tells you it’s a for motion (which is Beweging).

The issue is when you have 9 motion sensors, 13 contact sensors (9 for door and 4 window) and a few leak sensors. Basically the easiest solution is to rename all friendly names inside Z2M for HA to ‘Kantoor’. So you still have the Z2M friendly name as is, and in HA it just puts whatever behind it. Still cumbersome having to do this, but it is what it is.

Would be nice to see if HA just added a checkbox for MQTT devices like this to add or not add the device. Seeing as how you CAN override it by setting your own friendly name in HA entity panel, this all just seems extra unnecessarily complex


Thank you for your help and suggestions, I’ll see what’s the best way forward for new entities!

This is how all other integrations work. Sorry it’s inconvenient for you. You could always just not change the name and change the name in your frontend based on it’s context in the frontend. Or use the area card, which will remove the device name from included entities.

1 Like

Thank you for your quick replies. For future devices or installations, it won’t really matter that much. Just one extra step in my case to set the HA friendly name in Z2M for a new device. For my current installation I just uploaded my Z2M devices.yaml to ChatGPT-4 and gave it instructions to change it devices containg doors, windows etc according to my example. so it wasn’t that much work to manually change each.

Unless I am missing something, appending the device name to the friendly name is a major user interface issue for me. I have a lot of kc868 relay boards and use ESPHome on them with MQTT. Now instead of “West Outside Lights” and “Back Fruit Trees”, I have “kc868-west West Outside Lights” and “kc868-west Back Fruit Trees”. All I need to know is what the entity is, I don’t care about the device. How do I revert this without hand editing 80+ entities in HA?

That sounds like a horrific workaround, but I would like to see it.

I reverted my HA install to 2023.7.3 to get the old behavior back. I am hoping that someone will realize that if the device friendly_name is not specified, the name (or device ID) is not something people want forced in the UI.

I was not referring to you workaround, the horrific part is something that complicated is needed at all. It’s basically exporting every device, editing them, them importing them again. If doing that is the “official” way to handle using an ESP multi-relay/sensor board, yikes.

I upgrade now my z2m to “1.33.0” and the messages appear:

Logger: homeassistant.components.mqtt.mixins
Source: components/mqtt/mixins.py:296
Integration: MQTT (documentation, issues)
First occurred: 20:03:49 (1 occurrences)
Last logged: 20:03:49

MQTT device name is equal to entity name in your config {‘availability’: [{‘topic’: ‘zigbee2mqtt_EDGE/bridge/state’, ‘payload_not_available’: ‘offline’, ‘payload_available’: ‘online’}], ‘brightness’: True, ‘brightness_scale’: 254, ‘color_mode’: True, ‘command_topic’: ‘zigbee2mqtt_EDGE/Lampadas Movel/set’, ‘device’: {‘identifiers’: [‘zigbee2mqtt_12210510398101101501091131161169569687169_2’], ‘name’: ‘Lampadas Movel’, ‘sw_version’: ‘Zigbee2MQTT 1.32.1-dev’, ‘connections’: []}, ‘json_attributes_topic’: ‘zigbee2mqtt_EDGE/Lampadas Movel’, ‘max_mireds’: 500, ‘min_mireds’: 153, ‘name’: ‘Lampadas Movel’, ‘schema’: ‘json’, ‘state_topic’: ‘zigbee2mqtt_EDGE/Lampadas Movel’, ‘supported_color_modes’: {‘color_temp’, ‘xy’}, ‘unique_id’: ‘2_light_zigbee2mqtt_EDGE’, ‘optimistic’: False, ‘white_scale’: 255, ‘hs’: False, ‘encoding’: ‘utf-8’, ‘flash_time_long’: 10, ‘payload_not_available’: ‘offline’, ‘availability_mode’: ‘latest’, ‘enabled_by_default’: True, ‘xy’: False, ‘rgb’: False, ‘color_temp’: False, ‘payload_available’: ‘online’, ‘retain’: False, ‘qos’: 0, ‘flash_time_short’: 2, ‘effect’: False}, this is not expected. Please correct your configuration. The entity name will be set to null

And now ?

I found out. the problem is with the z2m edge.
But the problem is that it has already been uninstalled and still has the same message.
What do I do ?

Hi, Im having the same issue only for my PS5:

MQTT entity name starts with the device name in your config {‘availability’: [{‘topic’: 'ps5-mqtt/


Is there any update on this?

Has that been reported to the developer of whatever is generating those MQTT Discovery messages?

1 Like