How to replace mqtt (z2m) device correctly in HA without loosing history?

hello,

i´m up to replace two crashed mqtt devices from my HA installation
i had found two posts with correct “how to”…

seems to be quite simple, but both don´t refere to a mqtt device, aren´t they?

so i wonder, what is the correct way, for replacing a mqtt device beeing added by zigbee2mqtt and mosquito in to HA?

where have to delete the device? in z2m? is it then deleted in HA as well?
any “force delete” or not?
then simply connect new device rename it in z2m to the old name (entity ids as well) then all is fine?

thank you in advance for any input
br
Frank

This. Normally I don’t advice to use ‘force delete’, but if the device is really bricked, yes.

hi @francisp , as i remember that “force remove” just pushes the comunicator to delete the device id (or network id or what ever…) from its memory. In case of replacing it, it should not play a bigger role, if force remove is used or not, but keeps the system more cleaner, right?

nevertheless, here are my steps, what worked like a charm:

  • keep old device name in mind, especially “entitiy ID name” (before deletion)
  • deleted broken device in zigbee2mqtt (with option force remove)
  • paired new device
  • renamed new device to old device name

note: it doen´t matter if its paired before or after old one was removed, as i got e crypcial device name, what is then later renamed… old one must be removed at least before renaming of new one…

note: i always rename new devices in z2M at first with option
Update Homeassistant Entity ID" image to an universal name "e.g. [aqara ws 97] , then i rename it twice without that option to additional speaking name [aqara ws 97 Sickerschacht3].
as i assume name of entity_IDs are relevant for keeping history, i took ak eye to keep this same as old device…

new device came back with old name in dashboards and captured the old history stats… :+1:

thank you

br
Frank