I just started a few weeks ago with setting up openhabian (openHAB 2.5.2-1 (Release Build)) on my raspberry pi 4 and it seems to work fine. After that I installed the MCP23017-Binding with the main goal to switch relays on and of.
My first step was to build a test setup (including relays, opt couplers, button) etc. which work perfect just using Python. So far, so good => Next step.
I build the following thing based on the official readme for the binding:
Thing mcp23017:mcp23017:chipA "MCP23017 chip A" [address=20,bus=1] {
Type output_pin : output#A0 [default_state="LOW", active_low="y"]
Type input_pin : input#B0 [pull_mode="OFF"]
}
I build the following items (also based on the official readme):
Switch living_room_led_switch "Living room LED switch" {channel="mcp23017:mcp23017:chipA:output#A0"}
Contact living_room_led_contact "Living room LED contact" {channel="mcp23017:mcp23017:chipA:input#B0"}
Last but not least I implemented the following rule which is also based on the official readme:
rule "living_room_led contact"
when
Item living_room_led_contact changed to OPEN
then
living_room_led_switch.sendCommand(living_room_led_switch.state != ON ? ON : OFF)
end
Unfortunately it did not work. I got a switch which I can use on basic ui but nothing happens. As it works in python I think I’ve made some other mistake. It would be great, if someone could help me with it even if it is a good link with a longer readme than the official one.
After I reboot everything I still get the following log:
2020-03-04 20:22:50.400 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.mcp23017.handler.Mcp23017Handler@1d6e0e9': null
java.lang.NullPointerException: null
at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:545) ~[?:?]
at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalOutputPin(GpioControllerImpl.java:717) ~[?:?]
at org.openhab.binding.mcp23017.handler.Mcp23017PinStateHolder.initializeOutputPin(Mcp23017PinStateHolder.java:71) ~[?:?]
at org.openhab.binding.mcp23017.handler.Mcp23017PinStateHolder.getOutputPin(Mcp23017PinStateHolder.java:59) ~[?:?]
at org.openhab.binding.mcp23017.handler.Mcp23017Handler.handleOutputCommand(Mcp23017Handler.java:108) ~[?:?]
at org.openhab.binding.mcp23017.handler.Mcp23017Handler.handleCommand(Mcp23017Handler.java:80) ~[?:?]
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.$Proxy143.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]
==> /var/log/openhab2/events.log <==
2020-03-04 20:22:50.426 [vent.ItemStateChangedEvent] - living_room_led_switch changed from OFF to ON
==> /var/log/openhab2/openhab.log <==
2020-03-04 20:25:43.446 [WARN ] [sitemap.internal.SitemapProviderImpl] - Filename `Testsetup.sitemap` does not match the name `testsetup` of the sitemap - please fix this as you might see unexpected behavior otherwise.
I don’t understand what to do. Please can anybody help me?