Migrate zigbee2mqtt configuration

I have been on a journey to separate mqtt and z2m from my home assistant vm. Basically I do not want all my devices going offline when I had to restart HA. I run HAOS as a vm in proxmox. I had z2m and mqtt running as addons. Now after a long journey (not an easy one I might add but now I have learnt some ‘advanced’ linux commands and all) I have managed to install mqtt and z2m as LXC containers on proxmox with the help of tteck’s helper script (shout out to him!) and got them to run successfully.

Is there an easy way to migrate my configurations to my new z2m instance? Emphasis on ‘easy’. I will prefer to hear about SCP. It didn’t work initially and I have tried already with the learning for now. I just want my smart home up and running, then I can tinker later. If there is no easy way I have go pair all the devices again :frowning_face:

Hi check this: How do I move my Zigbee2MQTT instance to a different environment?

Also

On how to do the backup from the webui

1 Like

Thanks all. What I did was copy the devices from my old configuration.yaml file under config/zigbee2mtt into the configuration.yaml file in lxc as well as the content of state.json file. Nothing changed after that so I had to try pressing the pairing button on one of my devices. It was discovered with the same name as before so I went around doing the same for all my zigbee devices. Now I have everything almost as if nothing changed.

Would you have done in one of the suggested way, you wouldn’t have had to repair your devices, which was the point of your question, wasn’t it…

I couldn’t find any straight answers on how to " move the contents of the data directory and update the path to your coordinator in your configuration.yaml". I tried copying the contents which I believe essentially moved them but nothing happened. Although I was confused about the content of coordinatorbackup.json. Maybe that was the most important content.

I posted how to take a backup. That backup contains all the files you needed to migrate.
Just posting for anyone looking at this thread to not do as you did; please remove the solution tag, it’s definitely not the proper way.

1 Like

I get your point but it maybe was a solution for me. I could not find a way to make a backup that I could move between the 2 systems - more of how (I am no expert). I have removed the solution tag, though, so anyone else looking at the post could do it the proper way.

1 Like

What is your target by moving z2m to container? Without available HA automations not working anyway?

Everything was working perfectly, to be honest. Part of it is to optimise resources and part of it is just tinkering. Sometimes I can see the memory usage of my HAOS VM at over 90%. I want to run anything I can outside of the VM. Regarding resource management, my overall aim is to move these into containers within the same Docker instance.

Fair enough, but the point of marking a post as “solution” is for other users to find a proper solution to similar issues.
Thanks for removing the tag.

2 Likes

I, and I’m sure quite some users here as well, are doing it that way.
If HA is down, for whatever reason, you still can operate the devices and as @Mexxx is saying: Z2M can run in a container without affecting HA.

Is it difficult to update Z2M version in LXC environment? I read somewhere that it is necessary to do some additional actions regarding this. I have the Mosquitto broker in its own separate container, but I haven’t dared to move Z2M out of HA yet.

I have Z2M & Mosquitto in the same container.
Updating Z2M can be as easy as running the script from tteck again when you installed it that way.
That’s the nice thing with Proxmox & LXC’s: installation, backup, snapshot, testing, … all this is very easy.

1 Like

With the addon I have always been notified when a new version of z2m is available. Is there such a notification in the container solution? Or should I check github regularly for an update?

Every first of the month there is an update of Zigbee2MQTT.

Thanks for that info @francisp
@arkoko if you use LXC there’s a script for automatically updating all LXCs weekly. You can find it with the rest of the tteck scripts.

I would advice against that, not that the auto update script is not good, but I would do this manually.
In case you want a maximum uptime of your HA zigbee devices, I think it’s better to control this process yourself.
Just my 2c.

1 Like

Thanks to everyone. I just successfully migrated z2m addon with 74 devices to LXC. I’ll see how it goes.

How did you do it ? How did you manage to transfer the backup ?