I’ve recently switched to Zigbee2MQTT from ZHA. So far so good. However, I’m wondering whether I can make my setup more durable.
I noticed that when a device first joins, an entry like this shows up in my zigbee2mqtt configuration.yaml
:
devices:
'0x001788010915XXXX':
friendly_name: '0x001788010915XXXX'
If after the device joins I change friendly_name
to say Phillips Hue Bulb
, I can see in HA that its name was updated to Phillips Hue Bulb
; however, references to this device’s entities remian with the old ID:
light.0x001788010915XXXX
I can change these entities manually, but that is quite a labor. I then noticed something else. I unpaired the device, and made sure I have the following in my Z2M’s configuration.yaml
:
devices:
'0x001788010915XXXX':
friendly_name: 'phillips_hue_bedroom_1'
Now when I re-paired the device, it was given a nice ID, and the same applies to its entities:
light.phillips_hue_bedroom_1
sensor.phillips_hue_bedroom_1_linkquality
etc...
Why do I want this?
Suppose tomorrow my database gets corrupted or [[insert apocalyptic scenario here]]. If everything, including entity IDs, is predefined in YAML files which are backed up - I can seemingly get everything up and running pretty quickly again, including automations (which rely on entity_id
and sometimes device_id
).
Is this kind of configuration possible?