OH2 BasicUI How to make Switch state inverse?

I have Relay connected via MCP23017 Binding which have ACTIVE Pin state as LOW (0)
but in OH Switch ACTIVE state is HIGH (1)

How can I configure Switch via Item or Sitemap to inverse default behaviour?

So far I emulate state inversion by placing two icon file

lamp-off.png - for YELLOW LED (ON state)
lamp-on.png - for BLACK LED (OFF state)

But it’s sounds like a hack… besides that I still have wrong color for blue slider.

  1. Have you checked the logs? It looks to me like OFF sets the pin LOW, and ON sets it HIGH.
  2. How have you configured the default (as described in the docs)?

Sorry, how to do that?

looks like I travel all over docs, but didn’t see such thing.

From here:

Switch Test2 "Test 2" (Tests) { mcp23017="{ address:21, pin:'B1', mode:'DIGITAL_OUTPUT', defaultState:'LOW'}" }

it’s different thing, but not what I’m asking for.
Let’s gerenralize question without binding to this particular interface.

How to force switch send LOW level when I’m pull slider to right(i.e. turn-on Action) from BasicUI?

guys any ideas?
Is this reasonable question?

did you ever figure out how to invert the logic?

For my task I made workaround, As I know there is now such possibility inside OH.

And could you share your workaround, please?

if you are using the mcp23017 binding, the only way i found, was to either make a second switch and a rule to flip it or you can invert the logic in the binding and recompile it.

yep, it’s what I’ve done.