Zigbee2mqtt: Renaming devices breaks the link with Gladys

Hello everyone,

This is indeed the current behavior of Gladys with the Zigbee2mqtt integration, and it’s not your fault @bob :slightly_smiling_face:

The « link » between Zigbee2mqtt and Gladys is made through the device name (the friendly_name). Therefore, you need to clearly distinguish two cases:

  • Renaming the device in Gladys: no problem, it’s intended. The name you choose is kept even during resynchronizations with Zigbee2mqtt.
  • Renaming the device in Zigbee2mqtt: here, the link is broken. Gladys no longer recognizes the device and considers it as a new device. The old one remains in the database with its old name — hence the duplicates you see in the list.

This is also why @mutmut never encountered the problem: you have to go through the Zigbee2mqtt interface to rename.

An important point to keep in mind: it’s not just a polluted list. The old device keeps its history and all the scenes that pointed to it continue to point to the old device, which no longer receives any data. They therefore stop working without an error message. If you have scenes created before the renaming, it’s worth checking them again.

To clean up, no need to touch the database: go to Integrations → Zigbee2mqtt → Devices, you will find the old devices in the list, with a « Delete » button. That’s what you did in practice @bob, and it’s the right approach :+1:

My advice for now: give a « clean » name to each device in Zigbee2mqtt at the time of pairing, then avoid renaming it afterwards. Once the device is in Gladys, you can rename it freely on the Gladys side, and it’s this name that will be displayed everywhere in the interface.

That said, you are right to report the issue: it’s a limitation that we should be able to handle intelligently. Zigbee2mqtt already emits an event when a device is renamed, so we could automatically follow the renaming instead of creating a duplicate. Even better in the long term: rely on the Zigbee address of the device (its hardware identifier, which never changes) rather than its name. I’ll note that for a next version.

I created this request:

Thanks for the feedback!