Alarm system with cellular backup

I’ve recently set up a home automation system based on HA, using a HassOS on a Raspberry PI 4. Many Zigbee devices added so far.
After that success, now I’m trying to completely replace my home alarm system, and I need to solve some issues (because thieves could cut power supply and Internet access by cutting the fiber outdoors):

1 - Battery backup.

Solved using an UPS for the RPI, and using battery-powered Zigbee devices. The integration using zigbee2mqtt is really good.

2 - Internet backup.

The isolation from wifi network is achieved using zigbee devices instead, but I need a system able to use an cellular (3g/4g) Internet connection when router is offline. My ISP does not offer option to use a router with 3g backup.

I even have a Huawei E3531 3G USB stick compatible (I hope) with RPI.

I’ve read some posts about the matter:

But I’m not sure I could apply the solution proposed in second post.

Any ideas?

Thank you

What’s your concern, exactly?

I don’t know exactly how to configure network settings in HassOS in order to deal with a connection lost in my router, activating automatically the 3g connection and eventually restoring the original situation upon fiber recovery.

The solution in the post is applied over a fresh Linux installation, not HassOS natively installed on a RPI.

Interested to know if this is an option as would be nice moving forward to be able to have a 3/4G usb stick as a backup plugged in to HA NUC in case main network goes down

Look at NUT integration for monitoring UPS battery and power status

Use and automation may work

TRIGGER

  • ups on battery for xx seconds
    Or
  • no network connectivity for xx seconds

ACTION
I’m not sure on HASS OS but in normal Linux you should be able to change the connection from eth0 to xxx

This may also be possible for OS to default to secondary upon disconnect

Yes. It’s exactly what I want. I think checking for network connectivity should be enough, but the question is how to do it and change the connection not “in normal Linux” but in HassOS. Any suggestion?

I don’t know exactly how to configure network settings in HassOS in order to deal with a connection lost in my router, activating automatically the 3g connection and eventually restoring the original situation upon fiber recovery.

The solution in the post is applied over a fresh Linux installation, not HassOS natively installed on a RPI.

And also I should mention that I use the Companion App using DuckDNS. So, in the event of Internet failure and activation of 3G/4G backup, the solution must deal with the new public IP got by the USB 3G/4G dongle.

There is an API endpoint for the supervisor that would let you change the interface. /network/interface/<interface>/update. I’d venture you could write a script to change the interface but I can barely write an automation, so I’m no help there.

Edit: there should also be an endpoint to allow you to call an update to the duckdns addon. I don’t know how fast it populates dns servers with the new address, though. My experience not with duckdns but in general it’s no where near instantaneous.

No clue on how to do that in HassOS, so I’m afraid you’ll be on your own trying to transpose available tutorials for a standard distro to the quite locked down HassOS.

Yes, it’s what I’m afraid.
I’ll get to work and I’ll come back to share my results.

I just posted one approach for handling cellular backup