#Migrate Zigbee (ZHA) Network To New HA Install

1 messages · Page 1 of 1 (latest)

clear tinsel
#

Hi, what is the best way to migrate a zigbee network (using ZHA) to a new home assistant install including devices and entities? I originally installed home assistant in a virtual machine to play around with it. I added a bunch of addons and played around with dashboards, and messed with my config. It was just an environment to mess around in. During this time I added all my zigbee devices via ZHA.

Now I have a proper install of HA going and I want to bring over my zigbee network with all my zigbee devices and entities. I do not want to do a backup/restore of my whole HA installation because the mess around VM is full of junk and mess and sometimes warnings/errors.

I tried doing a ZHA backup and restore but that does not bring over the devices or entities.

Any help would be appreciated.

tranquil lion
#

Are you reusing the same coordinator on the new instance?

clear tinsel
#

same one

#

zigbee devices are all the same as well. just trying to bring them from homeassistant-test-vm to home assistant-real-vm

tranquil lion
#

Then a ZHA backup restore should work.

#

When you do that, do any devices show up at all?

clear tinsel
#

no nothing

#

i can share my backup file if it helps

tranquil lion
#

On your new instance, does adding a ZigBee device work?

clear tinsel
#

its a json file

clear tinsel
tranquil lion
#

How many devices do you have in your network?

clear tinsel
#

here is the zha backup

clear tinsel
tranquil lion
#

Oh that's not many. I would just take the plunge and re-add all of them from fresh.

clear tinsel
#

right now the coordinator is plugged into HA-real-vm. if i plugged it back into HA-test-vm the 20 devices would start working again

clear tinsel
#

was trying to avoid that tedious work

tranquil lion
#

Lol hmm ok. Let's see...

#

You're saying the devices don't show up at all in your new instance, not that they are there but unavailable?

clear tinsel
#

i see the devices/entities in my config files, can i just bring those files over ?

clear tinsel
#

do i need to somehow add these devices to HA first before restoring the ZHA backup?

tranquil lion
#

Do you have a working backup of your original instance?

#

A whole backup, not just ZHA.

clear tinsel
#

the original instance is still up and running. its just in a vm that i can launch at any time and do what ever i want with it

#

i was thinking i can try copying the devices/entities over manually from the config yaml files

tranquil lion
#

Ok. So this is a bit off-label but in the original config folder, you should see zigbee.db. Copy that.

clear tinsel
#

okay i can try that. just curious though, what is the connection between a device in HA and the devices on my zigbee network. for example, the zigbee.db, will it have the information required for HA to generate devices/entities like the device name, area, etc?

tranquil lion
#

Then in your new instance, do ha core stop using the terminal. Then replace zigbee.db with the original version using Samba or sth. Then do ha core start.

clear tinsel
#

sure will try that now

tranquil lion
#

I'm not sure. It is possible you need to copy your core.xxx_registry or something too. But zigbee.db has the info about the devices in your network.

#

This is off-label so make sure you can restore backup if it borks your setup.

clear tinsel
tranquil lion
#

No idea about that.

#

Just thinking about next steps

#

Other than your 20 ZigBee devices, how many other devices/entities do you have in your original instance?

clear tinsel
#

a bunch of security cameras. i was trying different addons to see which gave the best resutls

tranquil lion
#

If yr original system is relatively small, it could be easier to just prune out all the devices and automations you don't want to transfer, make a full backup, then restore that in your new instance

#

Actually have you tried a full HA backup restore to your new instance already?

clear tinsel
#

no i havent tried it yet. like i said the old instance was just a playground to get messy and learn. the new instance is the real one that will be running for myself and my family

#

okay rbought the zigbee.db over

#

let me reboot and see if that does anything

brittle nova
#

i didnt read

#

the "problem" is you dont need to backup or restore your coordinator because that's fully in tact, what you actually want to do is migrate over just the devices/entities created by zha

clear tinsel
#

oh i don't need any restore for the zha stuff?

#

i brought the zugbee.db over. looks like it populates the devices and entities. but they are missing names/tags/areas/etc

brittle nova
clear tinsel
#

ah okay cool. so what about the devices/entities then? manual import using the config yaml files?

brittle nova
#

the missing info for your zigbee devices would be in config/.storage in one of the files (proabbly core.config_entries), but along with it are all your other entities and devices

#

actually theres a bunch of files named core.*, not entirely sure what which is for but thats where that data is stored

clear tinsel
#

yea pretty sure it would be in devices and entities yaml

#

was hoping there was a selective way to backup and restore but looks like that doesn't exist

brittle nova
#

nope, core is all or nothing unfortunately

tranquil lion
#

The core.xxx are just text files. You could edit them to keep only the ZigBee devices and copy them over.

#

But a wrong edit or indent could corrupt your whole system

#

If the devices exist in your new instance after the zigbee.db transfer and they function properly, I'd say just use the UI to re-input the names, labels etc.

clear tinsel
#

yep figured that. plus they are formatted really weirdly.

clear tinsel
brittle nova
#

its just a json dictionary, but yeah id also just rename them then bother with that

tranquil lion
#

Do your devices respond?

clear tinsel
#

honestly not sure yet. this is in a remote property so i can't move a sensor or something to force a refresh

#

maybe just gotta wait

tranquil lion
#

Lol this is living dangerously!

clear tinsel
#

hahahaha it's more fun this way

tranquil lion
#

They are all battery powered sensors?

clear tinsel
#

yes

#

the other thing is (and this might be me being an idiot) i had an old 9dbi antenna lying around so i plugged it into the coordinator today before i left. i'm not even sure if it will work with the zigbee coordinator because it's from an old router lmao

#

oh well

#

at least the devices are there with their entities now. i can rename them manually

#

lets see if they start responding soon

clear tinsel
#

okay so after bringing zigbee.db over, it automatically added the devices and their entities. i went into .storage/core.device_registry and compared it to the one i had in my other HA install. basically brought over the zigbee devices from old install to new install. just had to make sure their config_entries parameter was updated, and the id parameter was updated.

#

rebooted and now devices have the right names, labels, areas, etc per my old HA install