PSA: MQTT Name changes in 2023.8

Presumably, whilst the state entity was being added the devs worked on the entity naming code, updated the integration API and Entity Naming Standards and found the existing MQTT integration result gave “Device Name Device Name” as they code now concatenates Device Name and Entity Name which were often set to the same value by MQTT device developers.

These fields were only loosely documented in the HASS MQTT Discovery documentation, so now every developer using the spec needs to update their code within 6 months.

The change makes perfect sense after several years of work improving Device and Entity naming, discovery, and logging. Sadly, the developer facing documentation is lagging so many software engineers read the (old) HASS source code directly, and tested the (old) behaviour to create devices that auto-discovered correctly. This includes me - my Python code (used to) create several sensors and actuators all with sensible names, MDI icons, and class/units supporting long term statistics.

There is a developer blog post which is factual and came out in advance of 2023.8, but three short paragraphs don’t really explain the impact of the changes, the user-facing warning message, nor what will happen in 6 months time.

Now this change has our attention, it would help a lot if the HASS MQTT Discovery page were changed to link to the new resources (dev blog post on MQTT, and the new entity naming standards), and the example tests were updated.

A possible updated developer MQTT Discovery test example:

mosquitto_pub -r -h 127.0.0.1 -p 1883 -t "homeassistant/binary_sensor/garden/config" -m '{"name": "Motion ENTITY", "device_class": "motion", "state_topic": "homeassistant/binary_sensor/garden/state", "unique_id": "motion01ad", "device": {"identifiers": ["01ad"], "name": "Garden Sensor DEVICE" }}'

Which on 2023.8 gives:
image

And YES, I’m currently logging in to GitHub to create a PR for just this documentation change…

EDIT: GitHub link so you can also contribute.

6 Likes