you can ignore removeBindingProvider errors. Something going wrong during openHAB shutdown.
More interessant is error about opening of I2C bus during addBindingProvider. As i’ve seen, you restart
openHAB again after this error again. This time without errors. It should work now. If not, only debugger can help now.
test active org.openhab.binding.mcp23017-1.9.0.jar on karaf by
run : ssh -p 8101 openhab@localhost
yes
pass: habopen
run: list and find binding had active
S 4: install pi4j
wget http://get.pi4j.com/download/pi4j-1.1.deb
sudo dpkg -i pi4j-1.1.deb
This will install the Pi4J libraries and example source files to:
/opt/pi4j/lib
/opt/pi4j/examples
compiler
javac -classpath .:classes:/opt/pi4j/lib/’’ …
run
sudo java -classpath .:classes:/opt/pi4j/lib/’’ …
compiler all example
/opt/pi4j/examples/build
test mcp23017 with mcp23017 pi4j example
sudo java -classpath .:classes:/opt/pi4j/lib/’*’ MCP23017GpioExample
add openhab in GPIO group
sudo adduser openhabian gpio
you may be install i2c-tool
sudo apt-get install i2c-tools
sudo adduser openhabian i2c
S 5 run raspi-config to enable i2c, serial
Sudo raspi-config -> interfacing Options -> enable i2c và serial
S 6 creat file mcp23017.items
Group All
Group Tests (All)
Contact Test1 “Test 1” (Tests) { mcp23017="{ address:21, pin:‘A0’, mode:‘DIGITAL_INPUT’}" }
Switch Test2 “Test 2” (Tests) { mcp23017="{ address:20, pin:‘B1’, mode:‘DIGITAL_OUTPUT’, defaultState:‘LOW’}" }
Switch Test3 “Test 3” (Tests) { mcp23017="{ address:20, pin:‘B2’, mode:‘DIGITAL_OUTPUT’, defaultState:‘LOW’}" }
Switch Test4 “Test 4” (Tests) { mcp23017="{ address:20, pin:‘B3’, mode:‘DIGITAL_OUTPUT’, defaultState:‘LOW’}" }
Switch Test5 “Test 5” (Tests) { mcp23017="{ address:20, pin:‘B4’, mode:‘DIGITAL_OUTPUT’, defaultState:‘LOW’}" }
Switch Test6 “Test 6” (Tests) { mcp23017="{ address:20, pin:‘B5’, mode:‘DIGITAL_OUTPUT’, defaultState:‘LOW’}" }
S 7 : work with opehab panel
Can you help me, is my first time in openhab, us MCP23017 with 8 x OUT and 8 x IN, with I2C all command work, will introduce in OH2, but I fail at the install Manual.
Have install Pi4J, but dont understand the next step’s :
…
compiler
javac -classpath .:classes:/opt/pi4j/lib/’’ …
run
sudo java -classpath .:classes:/opt/pi4j/lib/’’ …
…
Which command I must put ?, Can you help me, please
you need this steps, to run pi4j examples. This commands build them. This may be need, if you try to figure out why pi4j can not talk to mcp23017. If binding works as expected, no pi4j installation is required.
Binding should have Active state. Try “bundle:start 181” in karaf console. If it’s still inactive, take a look into log: “log:display”. May be you need install “openHAB 1.x Compatibility Layer”. Place mcp23017.items file into /etc/openhab2/items directory, assuming you use Raspberry.
pi@myrpi2:/opt/pi4j/examples$ javac -cp .:classes:/opt/pi4j/lib/’*’ MCP23017GpioExample.java
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.
I2ctools was installed sudo adduser pi gpio sudo adduser pi i2c
but after finish the items script, see in the log Error Access privileged !?
[ERROR] [org.openhab.binding.mcp23017 ] - [org.openhab.binding.mcp23017.binding(4)] Error during instantiation of the implementation object java.lang.RuntimeException: ERROR; Access to GPIO pins on this system requires priviliged access.
at com.pi4j.wiringpi.GpioUtil.enableNonPrivilegedAccess(Native Method)
at org.openhab.binding.mcp23017.internal.MCP23017Binding.(MCP23017Binding.java:83)
…
[WARN ] [org.openhab.binding.mcp23017 ] - FrameworkEvent WARNING - org.openhab.binding.mcp23017 org.osgi.framework.ServiceException: org.apache.felix.scr.impl.manager.SingleComponentManager.getService() returned a null service object
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:232)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
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
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
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
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
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.
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
Now I only have to understand where the error lies in items
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
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”
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