Problem with new MCP23017 binding in Openhab 2.3

Yesterday I’ve started migration to 2.3 and point on my list is migration to new MCP23017 binding ( . I’ve changed my old configuration and now I perform testing.
I have to say that this binding works very unstable. Main problem what I have now is that after restart some (random) inputs does not work (or work with huge delay).

Did you notice such problem?

Michal Szymanski

I’m the author of this binding and I have to admit, that I started to have the same problems. I investigated it a little, and it turnes out that items file is loaded BEFORE things file, so input pins are not initialized.

I described it here:

Today I will confirm that my problem is solved when item file is copied to Item directory after reboot. But for sure changing something in a item file (what cause reloading) does not help because I’ve tried it several times. I’ve tried to define Thing in file and in PaperUI but result is almost the same.

The funny thing is that each time some input items works and some note (even defined in the same file); Regarding to you post, how authors of other binding handle this problem?


Changing item file doesnt reload all items, I’ve noticed it too.
this binding isn’t typical - it has to create listener to other library - other bindings do not base on channelLinked method.
But for sure something broke recently. For me this binding worked flawlessly in 2.2.0. After upgrade to 2.3.0 problems began…

I send a question to openHab developers. Maybe they will have some idea how to fix this.

1 Like

And how is it? Is it working?

I perform test today. Yesterday I was involved in promoting OH in Poland :slight_smile:

Michal Szymanski

Looks really nice!!!

I was investigating trouble with mcp binding and it looks for me that something changed in openhab framework - some events are now asynchronous and IMHO it causes problems with my binding. I made some workaround, it is not well tested yet, but it looks like it works for me.
Here is the link for built jar:

so, uninstall default one, and copy this to /usr/share/openhab2/addons
then restart openhab.

This is ugly workaround, and I’m sure that openHab crew won’t allow me to merge it to their code, but I’ll try to start a discussion about it, so maybe It will be fixed soon

And i’m not sure what is your hardware config, but You may need to set input pins as PULL_UP like this:
Thing mcp23017:mcp23017:chipA “MCP23017chipA” [address=20,bus=1] {
Type input_pin : input#B0 [pull_mode=“PULL_UP”]
Type input_pin : input#B1 [pull_mode=“PULL_UP”]
Type input_pin : input#B2 [pull_mode=“PULL_UP”]
Type input_pin : input#B3 [pull_mode=“PULL_UP”]
Type input_pin : input#B4 [pull_mode=“PULL_UP”]
Type input_pin : input#B5 [pull_mode=“PULL_UP”]
Type input_pin : input#B6 [pull_mode=“PULL_UP”]


I think I do not need “Pull-up” option because I have pull-up resistor on my pcb. Previous version of MCP binding has no such option that is why I’ve added resistor to my PCB.

Today I will try your workaround. To be honest in OH during the startup I have many ERROR probably related to asynchronous behavior of OH.
For example I’ve got hundred error messages during boot that persistence does not work, usually many error that some objects are null but after several minutes situation is stable. Also at least in 2.1 not all values are recovered from mapdb simply sometime some are null my impression it is also related to asynchronous loading items/rules/persistance addson :frowning:


I’ve uninstaled default and copied your to /usr/share… and after rebooted but where I can find configuration for this binding ? In binding list I have only old one

It should be visible in PaperUI in configuration/bindings.
Yesterday I made clean install of raspbian with openhab and it worked ok:

If it is not visible, check logs, maybe there is some info

ok, I’ve upgraded. I have quite complex home automation systems and it takes some time. But it seems it works.


So far so good. I’ve found one ‘bug’ but it appeard that is not software bug but defect in switch connected to mcp23017 :slight_smile:

I still testing becuase for me it is not only tests of MCP23017 but also test of OH 2.3

Michal Szymanski

It looks that it work. There is some issue with remembering old values of MCP inputs, but it also happened in old version. I’m not sure if ‘default’ value for output works correctly but it is also probable related to mapdb

Do you know if there is mcp23018 binding as well?
McP 23017 allows you to address only 8 devices over i2c while 23017 has got 8 bits address so you can manage 128 devices in i2c.
Many thanks.

Sorry I do not know, you mean 8 23017 devices = 8*16 inputs/outputs.

Hello Guys, I am Marcin from Gdynia and just starting home automaton project with OH.

I was trying to implement MCP23017 last year without success and because I/O expanders were most important I stopped my project. I wasn’t able to find the reason why I can set outputs states manually by python commands and cannot set them by OH2. I read many of conversation like this but nothing helped. For now I back from beginning to this subject and installed fresh OH2.4 2 days ago. Some problems occurs with inputs when I used the Paper Interface for binding implementation so I found this conversation. I read everything and tried one more time.
I prepared new fresh installation of OH2.4 and install .jar file from Mr. Anatol. For now everything is working well, but on LOG Viewer I have on non-critical warning like below:

2018-12-31 15:31:59.843 [hingStatusInfoChangedEvent] - 'mcp23017:mcp23017:chipA' changed from UNINITIALIZED (DISABLED) to INITIALIZING

==> /var/log/openhab2/openhab.log <==

2018-12-31 15:31:59.843 **[WARN ] [.core.thing.binding.BaseThingHandler] - BaseThingHandler.initialize() will be removed soon, ThingStatus can be set manually via updateStatus(ThingStatus.ONLINE)**

==> /var/log/openhab2/events.log <==

2018-12-31 15:31:59.852 [hingStatusInfoChangedEvent] - 'mcp23017:mcp23017:chipA' changed from INITIALIZING to ONLINE

Is it anything which I should worry about?

Hi please contact with me directly in Polish. I’m using OH 2.3 with MCP without any problem and I think I have not such warning.


Hi guys
I would like to ask if Binding MCP23017 work correclty after reboot or OH2 restart your projects?

I have opehab2.4.0 on openhabian and after restart all mcp23017 inputs are not initialized.
I have to remove all releated input items from items file save it and than readd them back in order to initialize. But even though input states are not read until I toglle them.

All outputs work correctly.


I use 2.3 version and sometimes thera are some issues with values after initialization.
First question do you use persistance to store values for input/outpu, by default openHab does not remember old values.