How to install a second Raspberry with HA for testing (and as a backup) and avoid conflicts

I have a running installation with a Raspberry Pi 3B+. I would like to prepare a 2nd installation for backup purposes (for quick replacement in an emergency). Of course, I would also like to update this system from time to time with my backup settings and the latest updates.

How can this be handled and tested without conflicting with the production system?

Just be sure to give the second device a different IP address.

But there are other things you wonā€™t be able to create an active secondary setup for.

One for sure is zigbee via ZHA since the dongle connects directly to the HA machine and to the HA instance.

But if you take a backup of your HA instance on a regular basis if your production system fails itā€™s as easy as restoring that backup to new machine.

as far as testing goes it really depends on which integrations you have on the production system that you want test on the backup machine. So itā€™s hard to give general advice without specific examples.

I use Docker so if I need to test something I just run a new docker container on the same machine. I still canā€™t use ZHA since the controller is being used on my production container but I havenā€™t found that to be a hindrance for things Iā€™ve needed to test.

Not sure this is true with an ethernet zigbee coordinator. I have not had a reason to try. But it seems it should work in my head :slight_smile:

Jeff, You can connect a restored system to the ethernet coordinator (instead of the previous - NOT at the same time as the system you restored from) you cannot connect two systems to the same coordinator.

If youā€™re not running Proxmox or some other hypervisor the process is.

Image latest
logon with temp user ID
Drop backup

At this point you change ip address of the replacement box.

When you drop the backup it inherits the ENTIRE setup from the system that was backed up (including the IP address if you set static on the box) can you say IP conflicts?

So if you do static IP address, that means donā€™t have them online at the same time in the same local network or ip conflicts and MDNS problems.

If you set your ip address at the router with a reservation you would then have two machines with different idā€™s stating they are the same box. (also problematic)

Read: donā€™t bring the HA boxes up on the same network at the same time without addressing the naming / address issues.

I currently run HAOS on bare metal on a NUC, pi are the same basic process. I keep a second boot device (in my case an m.2) imaged with a recent installation of HA. On error (or to test) I install the replacement disk. Boot the box login and initialize, fire up the samba addin and move a copy of the backup to the box. Then kick the restore. 20-30 minutes later, change ip assignment in router if I changed boxes reboot, then reboot again. Done

All it costs me a spare M.2. It fixes almost any issue except a non-storage hardware failure on the NUC. If itā€™s that bad I can get a new box here in 24 hours. The build plan for the home requires everything stay working if HA is down - so all I lose is the fancy automation.

Op, All of that said. Iā€™d not spend too much on the hot swap for a Pi3 so much as Iā€™d be thinking about replacing it. The pi3 is among the absolute minimum you can run current builds of HA on. I wouldnā€™t throw a lot of money trying to prop it up. Save the cash and start building the replacement and think about how you will restore that.

1 Like

I cannot wrap my head around this not working. I donā€™t currently have a second HA setup to test.

But I have seen reports of people connecting both ZHA and Z2M for the same HA setup to a single ethernet coordinator. Both integrations get the sensors from all devices that they know about. I also have not tested this for full transparency.

So, Iā€™d expect two different HA setups pointing to the same coordinator to be able to do the same.

Incorrect reports. This is not possible.

One coordinator - one driving software at one time. Period.

You can disconnect one THEN Connect the other but not at once.

So, someone went through all of this and wrote the article to fake us out?
Using Zigbee2MQTT and ZHA with One Coordinator - SmartHomeScene

I will parade a bunch of links if you wish where itā€™s supposed to be completely impossible. the spec simply isnā€™t designed for it. I read that as someone who said yeah look I can make this work. They never look at if they should or the long term ramifications.

Go ask if they had issues or if it kept working. It IS VERY much a maybe you might be able to make the connect but itā€™s very much not supported and very much CAN blow stuff up.

People come up on this community site all the time to ask about things.

Those of us whoā€™ve been here done that and got the lumps on the head to prove it say hey donā€™t do that itā€™s gonna hurt. This is oe of those things.

If you reeeeeeeally want to try it go ahead Iā€™m not going to stop you. Butā€¦

Its not supposed to work so donā€™t gripe when it starts to be unstable. And itā€™s ABSOLUTELY not advisable, thereā€™s zero way anyone should be recommending it.

I have seen multiple threads about wanting to have a 2nd HA setup for emergency reasons but not yet a straightforward answer since HA is just not designed for that (yet).

Yes, I have seen posts where both ZHA and Z2M are being used BUT with separate coordinators for each.
Still, running both integrations simultaneously will not help the OP either.

We donā€™t even know if the OP is using zigbee at all!
So Thomas: how are you communicating with your devices.
The IP address conflict is only an issue if you would power the 2 working systems at the same time.
Thatā€™s a problem when testing/preparing, not if the first one fails AND is not connected logically to your network.

1 Like

First of all, I would like to thank you all for this interesting discussion. I didnā€™t think my question would be met with so much interest.

Anyway, I would like to let you know what integrations my current installation includes:

  • Apple TV (for some Home Pod Minis, not needed with HA)
  • Bluetooth (for the Govee devices)
  • Govee Bluetooth (only some thermometers for heating)
  • Homekit Bridge (to tell Siri via Apple HomeKit how to set the heating and to ask for the current temperature etc.)
  • Mobile App (not really needed at the moment, my Apple devices appear here)
  • Shelly (actors for the IR heaters)

I currently only use HA for my IR heater and for that I use the Generic Thermostat helpers.

@Nick: Youā€™re right, I donā€™t use Zigbee. So that wonā€™t be a problem.

I want this 2nd setup mainly for my not-so-techy wife in case Iā€™m not available and all this stuff breaks down. She would never be able to install HA and/or a backup.

I want to have a 2nd Raspi and a running SD card available for whatever may happen. With a few useful instructions, sheā€™ll be fine. However, I should make sure that this configuration works.

I donā€™t know if you are aware of that: running HA with a RPi on a SD card can be your first reason for problems.
Also, maybe it would be better/easier imaging your working SD card (with the latest situation of HA) to another one so your partner just has to swap those, after powering the RPi off/onā€¦ just an idea.

I can understand that, when HA has become an important part of everyday life, you want to be able to get back to a working situation if your system fails.
With a RPi, that would the power unit and the SD card.

I didnā€™t have a HW failure so far (yet) from my server and HA by itself also hasnā€™t been unusable for more then a few minutes.

1 Like

Yes, I am aware of this problem and for this reason I replace the SD card once a year and destroy the old card. I have never had a problem with this procedure.

What you are suggesting (the image) is my current procedure.

In fact, I havenā€™t had a hardware failure yet either. But there seemed to be a strange software problem that destroyed some settings. This didnā€™t become a real problem because it happened when I was working on the system and I noticed it soon enough. But it made me wonder what would happen ifā€¦

TBC: I love RPiā€™s and have 6 running for various tasks.

What I meant was: you donā€™t need a 2nd RPi, just a power unit and a copy of your SD card, IMHO.
In that case, you donā€™t have any issues with IP address conflicts or integrations bound to any HW.

For the other part of your question, the testing: you can install HA by using virutalisation software and depending your choice of HA version, you can use that config for both systems by copying them over.

1 Like

Basically youā€™re completely right. But I thought Iā€™d use the 2nd Pi to update the backup SD card with the latest backup from time to time.

That right there is the part that makes the difference.

The vast majority of zigbee dongles connect to the HA instance machine directly via USB. In this case if you use ZHA then you can only have one HA instance connecting to the dongle at a time. the ZHA integration in HA (at least via USB) is a direct one to one connection from HA to the zigbee coordinator.

Now if the ā€œdongleā€ (in this case itā€™s a ethernet based coordinator) is connected over the LAN then thatā€™s not the case anymore and multiple HA instances can connect to the zigbee coordinator at the same time. I doubt the linked procedure would work of you had the zigbee2mqtt software connected to a USB based device and also tried to use ZHA at the same time.

Itā€™s the way zwave used to be before zwavejs created an over the network solution.

Of course I could be completely wrong tho.

2 Likes

@NathanCu

Iā€™m running exactly same as you, HA on a bare metal NUC. Interesting point in your reply is to have a complete M2 backup (I do make automatic daily backups, but donā€™t have a solution in case of a full hd crash).

Could you tell me how I can make a mirror copy of an M2 (I assume the M2 needs to be removed from the NUC, but what kind of tool (hw/sw) do you use?)

TIA, Wim

1 Like

No mirror necessary, thatā€™s the beauty. I donā€™t have to care. Itā€™s a bog standard HAOS image use the standard instructions.

I never intend to keep that install. The restore should reinstall the versionl of haos you had. And I periodically drop a new image o it to be sure itā€™s not wildly out of date when I restore the backup. (the original reason op said they wanted the second box.- itā€™s not really necessary)

And yes itā€™s just a swap. It takes literally 10 seconds.!(bad admin I donā€™t have the screws holding the m2 access door in on my case there anymore, so flip er over remove 1 screw. Do it in reverse. Done)

Youā€™re not wrong, finity.

And you still should NOT connect two drving rigs to the same network coordinator at once. Bad things can happen. Because each driving software ASSUMES complete control over the 'stick. In that case even if you can TECHNICALLY do it you still should not.

2 Likes

Iā€™m pretty sure I agree with you.

I just donā€™t have the experience to say one way or the other with any sense of certainty.

:laughing:

1 Like

Yeah this is one of those that the stick or the software should really prevent this and just because it doesnā€™t doesnā€™t mean youā€™re good to go like the link suggested.

For instance what happens if a ZHA install says join while another instance is removing other nodes. Both things assume they ā€˜ownā€™ the stick

We have to be very careful not to advise people to do bad things just because we CANā€¦ Doesnā€™tean we SHOULD.

(also. This is why multi admin is such a banger of a feature for Matter. - itā€™s designed to work that way. Zigbee is NOT)

1 Like