Door Status inverted

Hi, I have a reed switch connected to a shelly uni which senses the status of a door outside.

The reed switch is on when the door is closed.

The state of the door is reversed in openhab.

Is there an easy way top change that?

There are a few ways. However, whether you are using a contact or switch item, on the channel tab, click on configure channel and enter the custom value for open or close.

Double check the hardware. A lot of reed switches will have a setting to flip the way it works. It might be a knob/screw to turn, jumper to bridge, different place to put the wires, etc. For example, I have some reed switches which have three terminals. How it reports open/closed is controlled by which two of the three you attach to the terminlals.

The shelly might have a way to flip it in its settings too.

Thank you for your replies. The Reed switch sadly has no option to invert the value.

The Shelly itself can invert the value. This actually helped. Now the pictogam shows the door being closed while the reed switch is on.

One question remains. The item is defined as a switch. So the status is shown as on or off. on being open and off being closed.

When I change the item to a contact the status gets stuck at the position where it is when changing the item. So the status does not change at all when opening or closing the door.

Can anyone help me with this?

Alternatively is there a way to map the status of the switch to open/ closed instead of on or off?

There are two boolean Item types in openHAB: Switch and Contact. They are not interchangeable. Switch only supports ON/OFF as commands and states. Contact only supports OPEN/CLOSED as states.

You cannot just change an Item from a Switch to a Contact and be on your way. Similarly, you cannot just link a Contact to a Channel that is intended to be linked to a Switch and expect it to work.

There is not enough information to answer that.

If all you care about is how it’s displayed, install the Map add-on, create a mapping transformation to map the ON to CLOSED and OFF to OPEN (or what ever is appropriate) and apply the transformation to the Item in the State Description metadata for the pattern property.

If it absolutely must be a Contact Item for some reason, you need to move the transformation closer to the device.

If the Thing’s Channel supports it, you can do the mapping there on the Channel’s config like @apella12 suggests or through a “state transformation” property where you’d use the Map transform same as described above.

If there isn’t an option to do that there, you’ll need to apply a transformation at the link using the transform Profile. Again, you’ll install the add-on and create the map same as described above.

In general, your config will be less complex, easier to understand, and less brittle if you avoid unnecessary conversions and transformations and/or wait until as late as possible before applying them (i.e. state description).