Force entity_id update for discovered entities?

Hi everybody,

is there a user friendly way to “force” Home Assistant to do this? Example:

I pair a new device with my zigbee2mqtt service. This device will automatically be called something like 0x0012a3234e1124234 in z2m; as z2m is connected to Home Assistant via mqtt, this will also create, for example sensor.0x0012a3234e1124234_linkquality.

What I usually then do is stop z2m, edit the configuration.yaml, and start it again. The device now has a friendly name, for example CC2530/Draussen.

Home Assistant will set the new friendly_name, so this device will show up as CC2530/Draussen. However, it will still be identified as sensor.0x0012a3234e1124234_linkquality.

I used to delete the .storage folder in my Home Assistant root directory and then restart. All entities would now have the entity_ids I wanted/expected. BUT there are too many things stored in this folder, so I cannot / don’t want to do this every single time.

I know that I can manually change the entity_id through the web interface - but while this is fine for one thing (even though most zigbee2mqtt devices are mulitple entites => temperature, humidity, pressure, link quality, etc. etc. - which ALL have to manually be changed then, as they are separate entities), this gets very frustrating when dealing with multiple entities.

Is there a service I missed that can do this? Run an update on already discovered entities and -if any values have changed- correct the existing entities so that they show the correct information?

Thank you for your help :slight_smile:

2 Likes

Sorry for digging up this topic but 3 years later I face the same situation…

Zigbee devices get an hex name when paired but when I rename the device it keeps the old entity id.
I have 70+ Zigbee devices, I really don’t want to rename each entity id manually…

I’m pretty new to Home Assistant (coming from another home automation system) so maybe I missed a feature and sorry if this is the case but now I don’t know what to do.

In the Zigbee2MQTT front-end, set the switch ‘Update Home Assistant ID’ to ‘on’

@francisp I have used the shown button every time when adding a new unit in Z2M. But I recently updated to Z2M version 1.37.0-1, and for some reason this button seems to have been removed…
I can then go into the specific device → Settings → Home Assistant Name, and then change it to something understandable. But it does not seem to reflect back into HA. The Entity ID is still something really long and unrelateable…
Do you have a suggestion?

Strange that they seem to have removed the shown button, as it now recuires additional steps to update the name…

Thanks! My Google skills clearly weren’t sufficient. :slight_smile:
I will roll back to previous version for now.