[SOLVED] MCP23017 binding does not work

So after changing from 2.4 to 2.5 I got the following error message. Any ideas how to resolve this?

"

2019-12-17 20:15:41.035 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.mcp23017.internal.handler.Mcp23017Handler@6a73f2': com.pi4j.io.file.LinuxFile.directIOCTL(IJI)I

java.lang.UnsatisfiedLinkError: com.pi4j.io.file.LinuxFile.directIOCTL(IJI)I
	at com.pi4j.io.file.LinuxFile.directIOCTL(Native Method) ~[?:?]
	at com.pi4j.io.file.LinuxFile.ioctl(LinuxFile.java:103) ~[?:?]
	at com.pi4j.io.i2c.impl.I2CBusImpl.selectBusSlave(I2CBusImpl.java:291) ~[?:?]
	at com.pi4j.io.i2c.impl.I2CBusImpl.runBusLockedDeviceAction(I2CBusImpl.java:258) ~[?:?]
	at com.pi4j.io.i2c.impl.I2CBusImpl.readByte(I2CBusImpl.java:153) ~[?:?]
	at com.pi4j.io.i2c.impl.I2CDeviceImpl.read(I2CDeviceImpl.java:205) ~[?:?]
	at com.pi4j.gpio.extension.mcp.MCP23017GpioProvider.<init>(MCP23017GpioProvider.java:129) ~[?:?]
	at com.pi4j.gpio.extension.mcp.MCP23017GpioProvider.<init>(MCP23017GpioProvider.java:113) ~[?:?]

	at com.pi4j.gpio.extension.mcp.MCP23017GpioProvider.<init>(MCP23017GpioProvider.java:108) ~[?:?]
	at org.openhab.binding.mcp23017.internal.handler.Mcp23017Handler.initializeMcpProvider(Mcp23017Handler.java:155) ~[?:?]
	at org.openhab.binding.mcp23017.internal.handler.Mcp23017Handler.initialize(Mcp23017Handler.java:93) ~[?:?]
	at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_222]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

Start with removing the binding, stop OH, clean cache, reboot and after OH has fully reloaded then reinstall the binding.

If problem persist then set the log, for the binding, to DEBUG and or TRACE via the console and post the output.

EDIT:

Quick check on github finds this https://github.com/openhab/openhab2-addons/issues/6111

You can still post the logs here and maybe someone has found a workaround that has not been posted on git.:crossed_fingers:

Thanks a lot for the quick reply. Did all of that before.
I managed to find the problem, I had to install the Pi4J library.

sudo apt-get install pi4j
&

Now the MC23017 Things are online, but a new error appeared:

2019-12-17 20:43:55.624 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.mcp23017.internal.handler.Mcp23017Handler@107c4f9': null
java.lang.NullPointerException: null
	at org.openhab.binding.mcp23017.internal.handler.Mcp23017Handler.handleOutputCommand(Mcp23017Handler.java:116) ~[?:?]
	at org.openhab.binding.mcp23017.internal.handler.Mcp23017Handler.handleCommand(Mcp23017Handler.java:83) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]
	at com.sun.proxy.$Proxy190.handleCommand(Unknown Source) [?:?]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:74) [bundleFile:?]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:48) [bundleFile:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_222]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]```

Now try stopping OH, cleaning cache and rebooting as null indicated a variable does not have a value.

EDIT:

This is the same null error in the git issue posted above.

Same error, can it be because of an older Java version?

Not sure, I do not use this binding, try updating your java and see.

I realized I can’t update JAVA, I do not know how (reading all the guides and trying with no success) I guess going back to 2.4 will be the best way, until someone can help…

Edit: Manually putting the org.openhab.binding.mcp23017-2.4.0.jar in usr\share\openhab2\addons solves the issue for the moment.

Bounty still up for this though - probably it’ll be an easy fix.

Hello OpenHab Community

I just started with the system and I’m feeling like baby in the woods…
How do I copy and where to find jar file

" org.openhab.binding.mcp23017-2.4.0.jar in usr\share\openhab2\addons"

?
Destination folder cannot be accessed from explorer by \IPaddress, it is internal Openhabian storage, do I have to do it over PuTTY?

If you don’t have Samba file sharing on your OH system, a easy way to copy files to/from that device is to use WinSCP. A simple Norton Commander style GUI to copy files between two systems that can use the SSH connection.

Thank you noppes123, I copied jar file to addons but this error still persists

2020-01-02 14:52:45.280 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.mcp23017.handler.Mcp23017Handler@16e53bb': null

Do I have to do something more?

null indicates the item does not have a value.

Since adding the jar file have you restarted OH?

When I’m trying to create mcp23017 thing log viewer says no i2c available…

2020-01-02 21:54:56.812 [hingStatusInfoChangedEvent] - 'mcp23017:mcp23017:8c750ca1' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR): Tried to access not available I2C bus: /dev/i2c-1 (Permission denied)

2020-01-02 21:54:56.818 [hingStatusInfoChangedEvent] - 'mcp23017:mcp23017:8c750ca1' changed from OFFLINE (CONFIGURATION_ERROR): Tried to access not available I2C bus: /dev/i2c-1 (Permission denied) to ONLINE

modifying boot/config.txt -> dtparam=i2c_arm=on
and
sudo apt-get install i2c-tools

did not help :frowning:

As a PLC programmer I exptected that it is easier but seems I need to start with something more simple however onboard GPIO worked for me already :slight_smile:

If you have the openhabian-config tool then use it to fix permissions.

Hello,
I’m facing the same exact problem described by the thread starter.
I read about his solution to the problem, but when can I find the file discribed in the solution?

Hello,
See here:

https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.mcp23017/2.4.0-SNAPSHOT/

Thank you very much, it works also for me!

Does it work on OH3?
I can read pin values from command line but nothing in Paper UI
“sudo i2cget -y 1 0x20 0x12”

I found in other topic that old .jar bindings will not work with OpenHab 3.
Anyway I tried coping it to addon folder but no binding showed up on the list and lots of error in log viewer.
Anybody used MCP23017 on OH3.0?

“Status:
UNINITIALIZED
HANDLER_INITIALIZING_ERROR
sun/misc/SharedSecrets”

And in log viewer:

“changed from INITIALIZING to UNINITIALIZED (HANDLER_INITIALIZING_ERROR): sun/misc/SharedSecrets”

The last binding version which works for me was 2.4 with Openhab 2.5. Binding version 2.5 was still not working. And openhab 3 version is not working, too. I didnt find a solution right now. Hopfully anybody can help…

1 Like