How to install MCP23017 binding with .jar file

did you go raspi-config and enable i2c interface
you may install gpio binding on opehab2
with pi4j you must follow pi4j tutorial http://pi4j.com/install.html
and http://pi4j.com/example/control.html
and you must add openhab on gpio and i2c group
sudo adduser openhab gpio
sudo adduser openhab i2c

Hi,

still not works :frowning:

The I2C bus works
with the command can set Relais ON/OFF / result I2C is enabled and write works
[19:55:56] pi@myrpi2:~$ i2cset -y 1 0x20 0x14 0x01
[19:56:02] pi@myrpi2:~$ i2cset -y 1 0x20 0x14 0x00

have install PI4J :slight_smile:
curl -s get.pi4j.com | sudo bash

Haven’t install Wiring Pi: No installation is required for Wiring Pi. Wiring Pi is embedded in the Pi4J native library.

Haven’t Test : Simple GPIO Control using Pi4J. do this tomorrow

[20:04:31] pi@myrpi2:~$ java -version
openjdk version “1.8.0_121”

[20:05:02] pi@myrpi2:~$ javac -version
javac 1.8.0_121

Use OpenHab : openHAB 2.1.0~20170612235727-1 (Build #947)

have first remove this addon, an replay the flies on add-on :

  • org.openhab.binding.gpio-1.9.0.jar
  • org.openhab.io.gpio-1.9.0.jar
  • org.openhab.binding.mcp23017-1.9.0.jar

on “karaf console” - All module are "Active"
187 | Active | 80 | 1.9.0 | openHAB GPIO IO Module
188 | Active | 80 | 1.9.0 | openHAB GPIO Binding
189 | Active | 80 | 1.9.0 | openHAB mcp23017 Binding

but on the “tail -F /var/log/openhab2/openhab.log /var/log/openhab2/events.log”

Same ERROR :frowning:
2017-06-15 19:44:21.539 [ERROR] [org.openhab.binding.mcp23017 ] - [org.openhab.binding.mcp23017.binding(177)] Error during instantiation of the implementation object
java.lang.RuntimeException: ERROR; Access to GPIO pins on this system requires priviliged access.

with i2c you can follow : http://www.raspberrypi-spy.co.uk/2013/07/how-to-use-a-mcp23017-i2c-port-expander-with-the-raspberry-pi-part-1/
with pi4j you with see my exameple
with error you can read my error Above on

Hi,

Is a bit more difficult

pi@myrpi2:/opt/pi4j/examples$ sudo java -classpath .:classes:/opt/pi4j/lib/’*’ MCP23017GpioExample
<–Pi4J–> MCP23017 GPIO Example … started.
Unable to determine hardware version. I see: Hardware : BCM2835, - expecting BCM2708 or BCM2709.
If this is a genuine Raspberry Pi then please report this
to projects@drogon.net. If this is not a Raspberry Pi then you
are on your own as wiringPi is designed to support the
Raspberry Pi ONLY.

this error is Non-root GPIO access broken with 4.9 kernel, for this reason must downgrade to kernel
from 4.9.24+ to 4.4.50+

the command is
sudo rpi-update 52241088c1da59a359110d39c1875cda56496764
after downgrade all feature on PI4J examples works :slight_smile:

Now I only have to understand where the error lies in items :rage:

sorry you, i so busy
when i run pi4j on openhab I did not have that problem
but you can Review my guide step by step
you may be reinstall openhab
good luck

Hello,

have reploy new OH2.1.0

  • Install I2C work perfect - the relais works
  • Install PI4J wok perfect - the relais works

have set Compatible Mode to 1.x

  • Paper UI > Configuration > System > Include Legacy 1.x Bindings

have put on OH2 Add-On folder:

  • org.openhab.io.gpio-1.10.0.jar
  • org.openhab.binding.gpio-1.10.0.jar
  • org.openhab.binding.mcp23017-1.10.0.jar

the connect to “karaf console” list all Bundles.
if put mcp23017 in Add-on folder OH2 crash, you see in the picture all bundle “resolved” and will reject from “karaf”

If remove add-on mcp23017 all is perfect, but mcp function not works :frowning:

on “tail -F /var/log/openhab2/openhab.log /var/log/openhab2/events.log” don’t see the error.

Do you have an idea

Hi @bodyfix,

try to use 1.9.0 or 1.11.0 version, since 1.10.0 is broken for some reason. I got some days ago follow PM

Kind regards,

Alexander

EDIT: If you use openhabian, may be you run into: GPIO Binding not working · Issue #39 · openhab/openhabian · GitHub

EDIT2: Take a look here: Org.openhab.binding.i2c or org.openhab.binding.mcp23017

Be carefull when you think about migration to 2.1, there is serious bug at least it appears on Rpi environment.

Hi everybody,

i integrated and rebuild MCP* bindings against current Pi4J snapshot. This should solve openHAB start issues (https://www.raspberrypi.org/forums/viewtopic.php?t=182191#p1156722). Jar’s can be found here: https://github.com/falkena/binaries

Can somebody else test, please? If it works, i’ll open PR with fix.

Thanks and kind regards,

Alexander

Hello falkena,
sudo update 52241088c1da59a359110d39c1875cda56496764 isn’t possible in a openHABian-installation.
If I copy the org.openhab.binding.mcp3424-1.11.0-SNAPSHOT.jar and …mcp23017.jar with 839KB (there are also files with 629KB) in the addons library I get

2017-09-11 17:28:17.081 [INFO ] [b.core.service.AbstractActiveService] - mcp3424 Refresh Service has been started
2017-09-11 17:28:17.196 [INFO ] [b.core.service.AbstractActiveService] - mcp23017 Refresh Service has been started

but the bindings aren’t displayed.

SnapShot#1036
Kernel = Linux 4.9.35-v7+
Platform = Raspberry Pi 3 Model B Rev 1.2