Zigbee Device Replacement Best Practice

I had a water leak sensor installed on top of my sump pump and it alerted me to a rising water level early enough that I was able to avoid disaster flooding in the basement. My question is…is there a best-practice for how to replace these devices? My old sensor got completely waterlogged and had to be discarded so I ordered the very same sensor to replace it. When added to Z2M, I wasn’t allowed to name it the same as the old device despite the old device no longer appearing in the list of devices (I suspect the database still had the name even though the dashboard didn’t list it because it was offline).

How do I go about making sure that I can remove the old device and rename the replacement device with the same friendly name? I can’t find the old device anywhere for me to remove it so I’m not sure where to look.

You can check

/config/zigbee2mqtt/configuration.yaml
devices:

Sometimes there is a separate devices.yaml

1 Like

Remove old device from z2m and mqtt. Then restart ha.

1 Like

Thanks for the suggestions folks.

One additional question, if I remove the old device first, then reboot and add the replacement device and name it the very same name, do the automations that use this entity automatically continue to use the same entity name as I had selected which is now the new device or will all of those now have to be redone?

Probably have to be redone, because it will use some number.
Check it out.
When you restart it, it will show you an error.

Name is not important, you have to give it the same entity_id as the old one. Then everything continues to run as before.