Connect ESP8266/Arduino to openHAB Cloud and subscribe/publish to states?

Hello. This may be a very basic question but I am really stuck here and couldn’t find any tutorial.

  • I run OH3.0 + MQTT Broker on a RPi at my home
  • My devices (lamps, switches, servos) are all “selfmade” and run by ESP8266s and everything is controlled through MQTT messages.
  • OpenHAB Cloud Connector works also fine, I got Google Home Assistant connected to it on my Android device.

Now I simply want a ESP8266 lamp which is not located at my home to connect directly to the OH cloud, for me to control it over the internet, so is this possible? How would I do that? Or is it somehow possible to connect remotely to the MQTT Broker through OH cloud?

I dont know where to start, initially I thought this would be pretty easy because OH cloud worked so well with Google Home, but I really can’t find any information googling arduino + openhab cloud.

Any help or hint in a direction is appreciated.

Welcome to the community!

Unfortunately, what you’re trying to do is not easy. The OH cloud isn’t meant for devices to connect to your server from various locations. It’s meant for you to to securely access your OH server from anywhere on the Internet.

You would need to set up a secure way for your ESP8266 to connect to your home network and talk directly to your MQTT broker. That’s possible with VPN or reverse proxy, but that’s also dangerous. Making a mistake potenially means opening both networks–and all of the computers/phones/devices on it–to attacks from the Internet. I suspect that you know this already (since you’re looking for an alternative), but I’m saying it anyway for future readers.

To control the remote ESP8266, it’ll need to have its own OH server at that location. You can set it up in the OH cloud on a separate account and access it that way. The Android app will allow you to connect to multiple servers, but I don’t know if the iOS app has that feature.

If you need the two locations to talk to each other, then you can use the remote binding. However, you’ll still need to set up VPN or reverse proxy–they won’t talk over the OH cloud.

You could also just swap out the remote ESP8266 with a WiFi smart plug and control it through the proprietary cloud/app. This is probably the cheapest and easiest option, but you may not like a company having your information. If you are okay with that, I personally recommend TP-Link Kasa devices. They’ve been reliable and the company hasn’t spammed me or misused my data (as far as I’m aware).

One could use Cloud-MQTT instead of opening up holes in the firewall.

1 Like