How can a RPi communicate with a hub?

Here is my requirement:
I want to use my Pi to monitor my network and when my network goes down, I want the Pi to restart my router. Now, when the router is down, my network is down as well, so my Pi can’t talk to the hub via IP, so I need another means of communicating with the hub. As the Pi has Bluetooth, it seems logical that I can issue a restart command to the hub via Bluetooth, which in turn, will turn of/on the switch where my router is connected. Is this correct? Do hubs accept remote commands via Bluetooth?

My first question, in response to your question, is are you using the terms “hub” and “router” to refer to the same thing? I ask because the term “hub” in home-automation world can also mean something used to communicate with other home automation devices.

Assuming that you are using the terms interchangeably, you can certainly use a Raspberry Pi to do what you’re talking about, and I wouldn’t bother installing openHAB just for that task. There appear to be Bluetooth-controlled electrical outlets available (I’ve never used one):

So you could write a script on your Raspberry Pi to monitor the network connectivity of your router/hub, then power cycle the outlet if the router/hub stops working.

Great, thanks for the clarity. And sorry about the ambiguity in my usage of the terms. I meant hub as in HA hub.

“My Break-Dancing days are over, but there’s always the Funky Chicken” – The Full Monty

I’m not aware of any binding that will work with Bluetooth switches. I could be wrong though. I’m also not aware of any router that supports Bluetooth. The one @j_wittenzellner points out could be used as well through the Python support and the Exec binding.

There are wifi switches but that isn’t going to help.

I personally use a zwave appliance outlet for things like this.

However, if your router supports it or you can install something like Tomato or dd-wrt you can set up a watchdog on the router itself that will cause it to reboot when it loses the network connectivity.

Agreed, my recommendation was if the original poster was considering openHAB only to implement this functionality (which would be overkill). If you are already running openHAB or are going to use it for other things, my preferred route would be the Network Health binding coupled with a ZWave outlet.

What about one of these?

433Mhz isn’t the greatest protocol as there’s no acknowledgement, but it will do the job

Thanks for the reply, but I’m going to go with the plug suggested earlier. I already have small program done in C that checks for connectivity. I can use the Python API that comes with the plug to complete the program and get my router restarted.

Are you abusing this with the onboard BT of the Pi? I just got the switch and have been having fits getting it to work with my Pi 3. I think I’m going to disable the onboard and try a BT dongle.