ebaauw / homebridge-deconz

Homebridge plugin for deCONZ
Apache License 2.0
134 stars 7 forks source link

Lost all devices during Conbee II -> Conbee III migration because I rebooted #192

Closed jan666 closed 10 months ago

jan666 commented 10 months ago

I tried to migrate my Conbee II to my Conbee III but had no success. Because the Conbee III was not detected from Phoscon after I starteted deCONZ I thought maybe its a good idea to reboot the Raspberry Pi.

Turns out: it wasn't. It looks like homebridge started up, homebridge-deconz saw the empty deCONZ and removed all devices. After I fixed my deCONZ (rolling back to Conbee II and restored a backup) I restored a homebridge backup. All devices back - but they are all new for Homekit. Everything is gone.

I know it's impossible to get it back but I wonder if its possible to make this more failsafe?

ebaauw commented 10 months ago

Stop Homebridge (and disable the service, so it won’t start on reboot) while migrating deCONZ. And only restart Homebridge, after having verified that deCONZ exposes all your devices over its API.

jan666 commented 10 months ago

Yeah, from retroperspective I know I should have done this. I know that homebridge-deconz did everything how it should and it was totally my fault. I just wondered if homebridge-deconz could do something to prevent this. Homebridge/homekit was the one thing I did not think about before migrating...

ebaauw commented 10 months ago

Technically, I suppose it could, but that would probably do more harm than good. E.g. I could not automatically remove accessories when the corresponding resources no longer exists, but then you would need to take explicit action for each device deleted from deCONZ. I do some sanity checks that deCONZ has connected to the coordinator device, but the API isn’t always consistent in how it reports this. In theory we could so some heuristics, e.g. if (the resources for) more than 10 devices are missing, there’s probably something wrong, so don’t delete the accessories, but I fear this is lead to misunderstanding when people intent to delete more than 10 devices.

Since this is an edge case (in my almost 10 years of using deCONZ, I only migrated once from a RaspBee to a RaspBee II), I don’t think it’s worth catering for it.

jan666 commented 10 months ago

There is an autoExpose setting. What about an autoUnexpose setting (default true) for people that want an extra safety net? For me losing a device in HomeKit is the worst case as this is not really backupable