Ethernet to Wifi failover - wpa_supplicant

Raspberry pi 4 openhabian
openHAB 3.4.0 Build #3029

I’m trying to understand how Openhab deals with networking issues, specifically, I am hoping it relies on the wpa_supplicant for prioritization of Wifi SSIDs.

Basically what I want to do is have the system fail over to Wifi when the Ethernet disconnects … and it does this pretty well already, however, in testing it seems that it does not pick up the changes to the wpa_supplicant until the system is rebooted. I have used sudo service networking restart as well as sudo ifconfig wlan0 downsudo ifconfig wlan0 up to try to get it to see the changes. This is also the same if I make changes to the Wifi configuration through the openhabian-config tool (and it says the system must be rebooted).

So the question: is there any way to get the system to see the changes to the wpa_supplicant without rebooting?

Serious? This does not make sense.
This, by design, isn’t even something you would be trying on high-powered data center equipment, and even less so on a Raspi.
You cannot have one layer 2 network replace another one so you would be getting a different IP, and you would need to “inject” that everywhere into all running applications. That just doesn’t won’t work.

Serious, this is an attempt doomed to fail. Get your Ethernet stable and you’re set.

Actually this is done all the time. Not sure what you are referring to. It works beautifully now. This issue I am seeking help on is how to getting the system to accept the changes to the supplicant without doing a reboot.

Not sure why you would think having a standby L2 network is not done, when it is very typical. The two interfaces have different MAC addresses so clearly they would need different IP addresses.

The use case I am referring to has nothing to with “getting my Ethernet stable”. I am working on the case of a power failure where my Ethernet network and therefore Cable provided internet goes down. It will failover to a wifi network that has a cellular connection to the internet.

The statement of having to inject the new IP address into the running applications is wrong. I am using a local DNS record (such as openhabian.local) which works beautifully well when the failover occurs.

With Wi-Fi as a standby L2 for Ethernet ? Nope it isn’t. Definitely not.

So you made us victim to the X-Y problem.
That type of outage problem typically cannot be solved this way, applications binding to IPs being one of the problems you will not overcome.

It isn’t, and it’s unrelated to DNS.
But it’s just good advice you don’t have to listen to. Good luck finding out the hard way.

Thanks. But it is actually working very well as I describe. When my ethernet cable is unplugged, the Rasp PI switches over to Wifi and I can then access it at openhabian.local (with a different IP address of course). So it is working as I would expect.

The issue for this thread has nothing to do with the tangent you took … I am trying to find out how to get the system to accept the changes to the wpa_supplicant without reb0oting (because its a hassle to reboot for other reasons that are related to Openhab but that has been discussed on other threads.)

Thanks. Other are welcome to help it they can :slight_smile:

You are referring to the fixed IP addresses that are hard coded in the bindings. And, yes, those can’t change (and wont) … so the fail over network has to use the same subnet, and have those devices reserved at the same fixed IP addresses. Haven’t seen an issue with doing that.

To clarify, there are several use cases for having a backup wifi for the system, the main one I am thinking about now is to alert me in the event of a power failure. Obviously in a power failure, many devices won’t be operational but some will. Specifically the battery operated devices on the Zigbee and Zwave networks. Managing the system will be extremely limited but having the ability for Openhab to gain access to a cell network to send out a notification seems like a useful case. Additionally, being able to log into the device remotely some management of devices might make sense. Finding out if there is motion or door activity etc is an obvious one. If the failover network is in a different subnet, obviously all the hard coded addresses are meaningless. But if the power is out, vs the xfinity network is out, there would be different outcomes.

Edit: before someone asks: Yes, the openhab system is on a UPS.

If you are talking about a power failure, why not using a UPS for your Router/Switch/openHAB server.
Connect the UPS to openHAB and you will be able to send messages on UPS state change.

Edit: Reading your edit, why not adding such to your Router/Switch ?

Yes, adding a UPS to the router is definitely a good approach.

This thread was/is not meant to explore ways to solve that issue … I am specifically asking about the Openhab system and if it prevents changes to the Wifi / Ethernet settings until after a reboot and if there is a way around that. There are good reasons to not have the changes take immediate affect (like shooting yourself in the foot with the network changing and making openhab unaccessible. ) … but I was hoping there was some approach I am not aware of.

Thats the question I am trying to answer.

How would you send messages to your mobile if your router fails due to a power outlet ? You can’t!
So you are trying to solve an issue which does not make sense in my opinion.

The cellular connection is connected to the UPS - does that help?

Sorry, don‘t understand your setup.
Where is you cellular connected to in you network, how can openHAB access it if your router fails ?

A typical private setup is a router with WAN/LAN/WiFi, some with cellular option as failover. On power outage, not having a UPS connected to your router, none of the above would work.

Edit: As you are trying to solve something which is not the scope of openHAB or openHABian, why not ask google:

As I said, I am not trying to design the solution for that I am investigating how to change the WPA_Supplicant without rebooting Openhab.

What I am experimenting with as a solution is to have a cellphone act as a hotspot, have the Openhab know the SSID (perhaps with SSID priortization in the supplicant) and then have that wlan interface become active (it should) when the ethernet interface goes down. Obviously all the devices are on the UPS. And yes, I could have the router on the UPS, but at this point I do not. There are two main cases: 1) Power fails, 2) The Xfnitity cable network is out. In both cases I am trying to retain access to Openhab and still have Openhab send notifications.

Thanks. Yes well aware … but if you understand the thread, I cant experiment with network changes without rebooting Openhab. Thats the question. Perhaps it isn’t possible.

The time you already have spent on this would have payed the UPS :wink:

I don‘t think this will solve your problem with cable network not being available. I you want to still access openHAB from outside, you are either using myopenHAB or a VPN or anything else. As your external IP will change when switching from cable network to celular, you will have to restart those as well.

Thanks … the reboot i am talking about here is to experiment with changing the wpa supplicant. What I need to do after OpenHab detects a power failure is still tbd.

I am also trying to minimize the devices sucking power on the UPS in order to keep OpenHab up as long as possible.

Have you checked e.g. for the same question in the raspberry forum ?
E.g. https://forums.raspberrypi.com/viewtopic.php?t=324155

1 Like

I have separate UPS on my Router and my Intel NUC running openHAB. Both are 12V UPS which plug in directly into my sockets. Never had any issue with runtime…

1 Like

Thanks Wolfgang … I had tried some of their suggestions already … in reading through the posts, it doesn’t appear it’s possible to change the SSID etc without a reboot. Oh well.