OpenHAB I2C examples

I want to use the 4 channel relay board from seeedstudio.com using I2C( http://wiki.seeed.cc/Raspberry_Pi_Relay_Board_v1.0 /), do anyone have examples on how to include I2C into the OpenHAB? I want to use a switch item to control the relays. Happy for all help.

There is an issue for someone to implement an I2C binding but at this time there is no way for OH to interact with I2C directly. So you would have to implement the communication with the I2C using some external code (Python scripts are nice) and set up some sort of communication between that and OH. Options for that include MQTT, Exec binding, and HTTP.

Hi,

Although it sounds complicated, the moment you get on track with MQTT will be more than satisfying! @rlkoshak Are you for real? You sound geekier than myself! No pun intended! :wink:

BR,
George

I don’t have time to code for fun these days so I contribute to the community by helping people on the forum. It is not as glamorous as writing a new binding but I think it’s worth while. Plus I can do it on my phone for the must part.

And I love making things. It doesn’t get more multidisciplinary than home automation, well maybe robotics.

@rlkoshak Definitely the way to be, I mean no harm! Thank you mate!

Yours truly,
George

Thanks Rich, do you have a link to a good examples of MQTT used together with OH?


https://community.openhab.org/search?q=MQTT

Hi Rich
I am trying to get a “BH1750FVI I2C Digital Light Intensity Sensor” to work with your sensorReporter.
The module is connected to my raspberry pi via GPIO PINs 2 and 3 (SDA and SCL), as per http://www.raspberrypi-spy.co.uk/2015/03/bh1750fvi-i2c-digital-light-intensity-sensor/
The python script form this tutorial, confirms that I have the module working, yay!
now comes the OH2 integration… I plan on using the MQTT method, as I have a broker running.
I have read your readme, and gone through the install script and ini file, but honestly i have very little idea of what to put in them. Do you have examples of these files configured to communicate with I2C sensor?
What else needs to by done?
An example of the OH2 side of the configuration would also be greatly appriciated.

Thank you for the good work,
Cheers
Kasper

No. I’ve no experience with IC2 but am certain that what I and others have written for sensorReporter is not sufficient. You will need to research how to interact with IC2 through Python and write a new class to support that to use sensorReporter. I’ve no knowledge about how IC2 works.

I included the link above to the script to answer the question “do you have a link to a good examples of MQTT used together with OH?”.

See the first two links above for instructions and examples for how to configure OH to talk MQTT.

Hi Stromo!
I’m actually in the same condition as you were a while ago. May I ask you which solution did work for you?
Thanks!

If someone has MQTT in use, the easiest way of using I2C sensors is a Tasmota ESP8266 board (ie Wemos D1 mini).