Turn On and Off LED with esp32 and openHAB

Platform information:
Hardware: Raspberry Pi 4
OS:openHABian
openHAB version: OpenHAB 2.5

I am trying to turn on a relay/led using ESP32 and openHAB, can HTTP binding be used for it?
Someone please do help

Thanks in advance

It’s easier with mqtt. Both ESP-IDF and Arduino for esp have MQTT libs. For HTTP you have to use an http server on the esp32 and listen OR periodically make requests to the openhab API using http client.

Thank you.
Can you help me with the sitemaps and items code

You have to first make the esp recognize the mqtt commands for on/off of the led. Creating the item is the easiest part.

1 Like

What kind of software are you running on the esp?

Arduino 1.8.10

Errr… Arduino is IDE and kinda an operating system. ESP is just a bare board, like your Raspberry. You need a software for it first. You can try finding something on the Internet or develop your own. In the latter case protocol choice is up to you.

If relay is all you need, you are going wrong way. You should have bought some ready to use relay module. I know Sonoff is known worldwide and Openhab already supports it. There can be others on the market, however you might need to write a binding for it.

There is https://github.com/espressif/arduino-esp32

@Sarayu_Nagarajan you can flash the ESP with Tasmota or ESP_Easy and both have a GUI to configure the device.

https://www.letscontrolit.com/wiki/index.php?title=ESPEasy

I use both of these with mqtt and they work good with OH.

EDIT:
Forgot to mention that I do not use the Arduino IDE to flash. Take a look at Atom.IO as it’s much easier to work with IMHO. You can find several videos on YouTube that will walk you thru the setup.

1 Like

Thank you