Change HAOS IP with automation

hi, I want to change the ip of a RPI HAOS installation.

long story short: I have HA running in a VM on a big server, that uses to much energy. during nighttimes i found it is sufficient to have a RPI to take care of HA. and switch back to to the big server when getting up.

i thought it would be cool to have the following:

  1. big server (ip: .238) is on. creates backup at 9pm.
  2. after backup is done, big server changes IP to .237
  3. rpi (ip: .236) restores backup from big server
  4. after backup is restored and .238 is not reachable, RPI switches IP to .238
  5. in the morning RPI creates a backup.
  6. after backup PRI changes IP to .236
  7. big server restores backup from RPI
  8. after backup is done and .238 is not reachable, IP changes from .237 to .238

I want switch from sqlite to mariadb do that historical data is maintained.
Zigbee coordinator is a zigstar poe adapter (integrated with ZHA

is my idea completly nuts?

However, I am able to change an installations IP with ha network update .... however putting this into a script in cinfiguration.yaml it is not working. The command works within the ssh & terminal addon just fine. Anyone might have an idea to accomplish what i want?! or even did a similar setup?

The backups are stored in a nextcloud instance that is locally attached with smb.

I hope someone can help me out because other approaches like HAHA are not what i am looking for, unfortunately.

the reason for the IP switch is simple. I wann the app to be working all the time excep the couple of minutes where the ipswitch happens.

Best regards,
goeste

Cool idea! Few comments:

much if not all of this can be run by virtualizing your HA instance and schedule a movement of the compute part of it at certain times. Vmware vmotion would work well, not sure what other hypervisors calls this. A Pi wont run a hypervisor but a NUC could.

Is this something you could do running a docker cluster, or perhaps kubernetes?

How much power does your server use? I have a 2U Dell, it can go as low as 150W.

Love the idea but not sure how stable and hassle free it would be doing it as you describe :blush:

I am currently running HAOS VM on Proxmox in an R7910 still 150/200w compared to 15w of an rpi make a huge difference for 6-8 hours…

right now I can only use proxmox and/or a RPI

I can see where you wanna go to with the virtulizing point… that shouldn’t be an issue at all. however the vm ↔ rpi thing is the issue i feel

most likely yes, but i have no experience with any sort of clusters tbh

I wouldn’t. As interesting as the thought is conceptually, Waaaaay too many moving parts that have to work EXACTLY RIGHT in order every time or you could have data loss. My experience is that rarely happens. Meaning you’ll spend most of your time fixing this. Which will defeat the purpose.

That said…

There’s more to name resolution and server availability than host name. A lot of stuff uses IP address to locate hosts. Yous have to have an insanely short ttl on your DNS services so that when you swap IPs everything else can find it. Until ttlnexpires and DNS flushes out the old IP things will be… Weird. (especially with HA core) id try to keep the IP address the same which means instead of changing the IP address you’re better swapping IPs in network and using reserved addresses and Dhcp to move stuff around.

It can take literally hours for a restore to happen on a Pi (ask me how many times I restored my own last week during the updates to the Appdaemon and Node Red addons) What do you plan to do once the backup completes before your pi comes up? If your server keeps going then whatever happens between backup and restore is lost.

1 Like

Not too familiar with the workstations, do these have idrac like servers which you can use to power the workstation on? Like I said I love your idea, but it seems a lot of things could fail in the process. You can get cheap, not-power hungry NUCs or other mini-pcs that are compatible with hypervisors, and since you already have a network zigbee adapter you are free to move your vm around. I do the same here, not for power reasons but for maintenance. A couple of clicks and my HA is moved live from my 2U server to my NUC without losing a single ping :slight_smile:

If I were to copy your use case to my environment it’s as simple as setting up scheduled tasks in the hypervisor to migrate the vm to the “cheap” compute, power off the main server and reverse the process when wanted.

2 Likes

yh that r7910 also has idrac @NathanCu is right in reg. to restore time. haven’t thought about ttl in my local dns… i might have to reconsider the idea to be fully fledged :slight_smile: thanks so far for the hints and sticks to stumble on

That’s good, then you can integrate your idrac both to HA to get readings and also to the hypervisor to do power on / off. If you are on a power-saving mission look into the power profiles on the idrac (if those exist on workstations, not sure), you can save some watts by turning down the performance as well.

That’s the only “non-automated” part at my end, my NUC does not have a way for me to trigger it on by the hypervisor, I need to physically press the power button. I haven’t bothered connecting a screen and a keyboard to it (NUC is tucked away on my attic), to see if it has a BIOS setting to resume power I could try using a smart plug to trigger it.

The great part about doing it the virtual migration way is that you do not need to think about DNS, restore times etc. And if you are really fancy you could set up replication that kicks in if your server for some reason fails :wink:

1 Like

@fleskefjes what integration are you using for idrac integration?

SNMP. Example: Monitoring Dell iDRAC in Home Assistant

I had to fiddle around a bit to find the correct config for my 740 initially.

Just another idea, take a look at this project and see if it has any ideas to help