I’ve had a couple weird events happen to me and it seems to be pretty consistent. As far as I know, the only way to remove a zigbee device is calling the mentioned service and using it’s IEEE address. This definitely removes the device but also inadvertently removed automations that included that device. It’s not 100%, meaning a recent device removal cleared 3 out of 4 automations. A couple other times it removed all the automations related to the device.
Fortunately, I have backups and can re-create them with simple copy-n-paste actions, but it’s much better if that doesn’t happen.
Has this happened to anyone else? And also is there a better way to remove a zigbee device from the ZHA integration?
Have you looked in the logbook (the actual homeassistant.log file in your config directory) to see if there are any errors related to the removed automations? That might tell you why it’s happening.
I’m going to guess that it’s possible that the automations get removed because they reference the device that no longer exists and it causes the automation config to produce an error that then fails silently unless you look in the file above.