Initial guidance: Integrate I2C sensor nativly (BPE280: temperature + humidity + pressure)

I want to integrate a I2C sensor connected to the RaspPI that is running OpenHAB (BPE280: temperature + humidity + pressure).
I’m looking for some guidance to start in the right direction since I’m new to OpenHAB.
In general my Java knowledge is rusty but I work daily with C# and I’m willing to dig deeper.

I have some java code to read the sensor data using pi4j.

What are my options to realize a native integration?
Is a binding the right way? Is an Action an option? What are other best practice approaches?

I don’t won’t a workaround solution via python or console command hacks…
However, it might be an option to write some kind of adapter to integrate the sensor via MQTT, but then it would not help anybody else…

I read the developer documentation but I’m unsure if I go with a binding in the right direction.

Thx in advance,
Thorsten :slight_smile:

Hi Thorsten,

Welcome. On what machine are you running your openHAB? Would you want to connect the BPE280 directly to that machine, or do yo want/need the sensor remote from the openHAB machine?

In the latter case I would definitely recommend connecting the BPE280 to an Arduino or ESP8266/ESP32 and then using MQTT to integrate this small sensor setup. I have several such MQTT sensors/actuators, not exactly with a BPE280 though.

In addition to the esp8266 option, you could look at the project as a non-WiFi option (though in the same radio frequency).

I use both options at the moment, slowly transferring simple sensors over to MySensors to keep the number of devices connected to my WiFi AP down.

I then use the MQTT binding to communicate from openHAB.

Not necessarily ‘native’ though, depending upon your definition…

OpenHAB is running on a RaspPI V4 and I wanted to connect the sensor locally to the RaspPI.
I didn’t like the idea of another board if it’s not necessary.

I know I could write an app for the RasPI that maps I2C to MQTT, just thought there is a more elegant solution.

@hafniumzinc: Good tip with Didn’t know that option. With native i meant: It could in theory be integrated in the official OpenHAB build.

Sry for missing this obvious info

No problem. Certainly not the most plug and play option, but very robust, and I get good signal fairly far from the gateway. Here’s how I set mine up, but there is also an OpenHAB binding for MySensors.

Not directly ‘native’ though, unfortunately.

AFAIK there is no native solution based on your definition. Besides MySensors, if you go with the ESP8266 approach, you can also try EspHome. It handles the software part for you. The sensors communicate with OpenHab through MQTT. Or you can roll your own C++ code as you mentioned. I also write my own code for the ESP8266 :).

Direct access to lower level bus is possible via third party libraries. There is no direct support for these in openHAB 2.x, however there is library called jdk.dio which is Java level interface for it. So far it did not become part of standard library so you have to obtain it from maven repositories hosted by Eclipse foundation:
This library is used in Eclipse Kura so there is pretty big chance it works just fine. :slight_smile:

Good luck!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.