I2C sensors bindings

Tags: #<Tag:0x00007f616c2f8e18> #<Tag:0x00007f616c2f8cb0>

I’m in the process of creating my first binding - PCF8574 - https://github.com/openhab/openhab2-addons/pull/5407 and hopefully soon it will be finished.
I’m wondering what binding I should build next.
I’d like to attach two sensors to my Raspberry PI: BH1750 (light intensity sensor) and SHT30/SHT31 sensor (temperature and humidity).
I’m aware there are python scripts that read values from these sensors and they can be used with exec binding, but I’d like to have a native binding that is easy to add and configure.

I’m wondering what might be the best way to build such bindings. Should there be a separate binding for each sensor or maybe there could be one binding called ‘I2C Sensors’ that could handle multiple sensor types.
I’m not sure if this kind of binding (that can handle multiple types of sensors) is even possible to build.

Because I’m new to openHAB and bindings development, I’m searching for a good example showing I2C sensor reading that I could use as a base for building my binding/bindings.

BTW is anyone interested in such bindings?
I’m aware we can use MQTT, esp8266 and ESPEasy, but I want to avoid wireless sensors.

1 Like

David_Graeff any thoughts?
I’ll wait till binding development will work again and I want to give those two (BH1750, SHT31) a try.
Do You think those will be a useful bindings?
Any binding I can use as a template?

Hello I would appreciated it. I am using now python code + exec binding for reading light intensity from BH1750. There was lot of problem with perissions, …
How it is going with this binding development?

Hi! Does it support only a single i2c chip for now? I’d like to see an I2C bus bridge plus an extendable set of Things. I am planning to add a lot of sensors to my installation and will use PCF8575 GPIO adapters.

1 Like

Sorry, didn’t read carefully. :slight_smile: 8575 is the same as 8574, with 16 bits instead of 8. Should be easy yo add.

It’s a pity you’ve dropped the project :frowning:
What “other” solution did you find? Can you please share with us?
Thanks!

The easiest way was to use ESP Easy and connect everything via MQTT.
You should have no problem with that :slight_smile:

< OFF >
So, you were forced “into the line” too… :frowning: I’m sad to hear that.
I still don’t want to give up solving it to be able to use a WIRED system with lot’s of GPIOs!
Everyone is pushing those Wifi + Ethernet + RF + Bluetooth systems…

I think it’s:

  1. a security risk
  2. slower execution of command
  3. unnecessary radio-waves in your house. (There are lot’s of people sensitive to those, even if they don’t know why they have a headache.)
  4. they fill up the routers ARP + IP table and slow down communication a bit
  5. it’s much more difficult to debug a system, if it’s not “plugged in”. (And we should know by now: whatever can be broken > WILL BROKE sooner or later.)

< /OFF >

Then look for Java library and try to creating something by your own.
I’m not a Java developer, but it was quite easy to get started with binding creation.
I’m sure that right now it is even easier.
The community is great and if you create a PR you will get a lot of feedback.

Hello! @Misiu are you working on this or stopped for some reason ? I’ve added 2xpcf8575 to my controller, and very interested in getting them working.

Sadly I moved to other project, because openHAB was in the middle of migration.
I hope to get back to openHAB in future, but for now I can’t help.