USB or WIFI relay?

Hello everyone,

I’m new to the community, hope this is the right Category I use here.

I’m planning to make a 2 zone thermostat for my heating, and I would control it with OH (running on Pi4). The question is more about the relay.
So, I’ve already found some relays on the market (china), some with WIFI or with direct USB control.

Actually, I like the idea to control the relay with USB directly from my OH.
I’ve found two types of relay, direct USB and one with HID (driverless) mode.
However, what I’m unsure is that how will I (OH) send the command to the relay through USB?
I’ve checked and found that the commands are in HEX code, but still don’t see the big picture here.

  • What can you suggest or where could I learn more about this topic?

  • On the other hand, would you suggest wireless comunication instead?

Thank you for your help!

I think @rlkoshak is working on a thermostat. Perhaps he has some suggestions.


Not really. I’m working with which has all the hardware built in. It runs openHAB on an RPi 0 and I’m changing the openHAB configs to improve overall performance, particularly boot time (so far I’ve brought it from 25-30 minutes down to ten which is probably the limit). I’m no help for hardware beyond…

How do you send commands to the USB without openHAB? Is it a serial device? Then you would use the serial binding. If it needs special drivers you might be on your own and need to use the Exec binding to execute external scripts from OH to control it.

Depends on how far away the relays and sensors need to be from the controller and from each other. If you have two zones, you will almost certainly need to temp sensors feeding this thermostat and in order for both of them to be in their respective zones it might be too long to run wires.


Thanks, Rick.

Thank you for your fedback Rich!

Yes, I’ve already checked the serial binding add-on configuration, but I’m not sure which type of USB relay I’m better off with? Or it doesn’t matter wheter HID or not?

The distance is not a problem here. I ask the question in regards with feasability and stability. Do you or the community have more experience with let’s say a “sonoff wireless relay” or I should rather try the USB relay.

What I’m worried about is that if the wireless relay loses power, and coming back online, then the WIFI connection will not be restored automatically, as the relay will not store ssid and authentication details or am I wrong here?

I hope I could give more details for my concerns.

They store the wireless information and will come back onto the network when they restart.

1 Like

Except if a lightning strikes in nearby.
That’s what killed my wifi routers >> and ALL those devices (Ethernet + switches + moderboards) connected to those.
The weather is getting worse year by year.

UPSs & surge protectors help a lot with that,

I have a professional real-Sinus-wave Legrand 1500VA UPS.

Did not help, because the power-surge came THROUGH the Air / WIFI !
This lightning was 1km away, (stroke into the Gas station) but it wasn’t raining. So it came “dry through”.

Every nearby house in that 1-2km radius had some other problems:

  • heating, TV, PC, fridge, etc…

For me:

  • Routers, Server, Switches, Door-entry-systems, phone-central, and my 10 year old TeleTask home automation system.
1 Like

Than what killed the devices was an EMP, not a typical power surge. And an EMP, depending on it’s strength and frequencies and all sorts of other variables can just as easily kill wired devices too. In fact in some cases the wire will act as an antennae which makes the wired devices more vulnerable than the wireless ones sometimes.

Lightning is a common source of EMP but the sun and accidents like exploding transformers or capacitors and such.

Absolutely Agree!
Only those devices survived, which had SHIELDED cables (FTP, quality USB) connected, and ran through multiple devices.

Still using 6 ports of a 8port Gbit switch. (Only 2 ports died > connected to Wifi devices.)
I was able to “follow” the path of the lightning by testing each device and port one by one.

  • My house-control board was connected <==> to the server via Serial-port. (Both died.)
  • The ISP provided optical-modem’s “Tel1” port died only <==> plus my telephone system connected to outdoor phones.
  • etc…

Someone recommended me to use USB to USB isolators too.

So, a little update.
I have decieded to go ahead and buy&try the USB relay. I’ve as well put an USB isolator to the cart, thanks to @SzakiLaci !

I’ll follow up with my experience as soon as they arrive.

Today, I could finally get it (USB relay) up and running. OH can handle it with a simple rule and a script.
I highly recommend to all who is looking for wired relay solution. :+1: