MCP23017 invert stat on switch

Hi everyone,

I bought relay board activet low state and I connect to the MCP23017. It works but works invert.

When I send command switch on then relay turn off.
I can not modify it in dashboard - hab panel.

I know that i can modify site map like e.g:

Switch item=Garagevarme1 label="your label here" mappings=[0="ON", 1="OFF"]

but what about with dashboard - habpanel?
Thank you in advance for help

Anyone help?

First question, what binding do you use, official one?
If official one you can use defaulState parameter, during my experiments it worked

Switch WtrValveBack “Podlewanie ogrodowe " (WtrValveBack) { mcp23017=”{ address:20, pin:'B5, mode:‘DIGITAL_OUTPUT’, defaultState:‘LOW’}" }

If you use switch board from photo you can connect you wires to achive Normal Close or Normal Open, I have the same switches :slight_smile:

Last thing, there is one problem…MCP binding does not work in OH 2.1. If you plan to use it do not migrate to 2.1 more details here



Me too I have a question how could I invert the state?

Your solution defaultState:'LOW is not working as this only changes the initial state of the chip’s outputs, so its will only set when it boots to stay in LOW or HIGH state.
This parameter is not for inverting the logic.

I was trying to invert the logic by using transform in a sitemaps ex.: Switch item=A1 mappings=[OFF=ON, ON=OFF] , but is not a perfect solution for me because many things:

  • the icon logic will be still inverted
  • also the graphical sliding switch will be changed to ON OFF buttons by using transom
  • furthermore the log is also is reporting On during Off which may lead to confusion.

I vould prefer a better solution.
Any thoughts?

did you ever figure out how to fix this problem?

openHAB 2.5.0~M5-1 / MCP23017 Binding
works as expected