Help on using the CONTACT option in OH

RPi 3B+ running openHAB 2.5.0~S1621-1 (Build #1621)

I have an ESP8266-01 setup running Sonoff firmware and want to use it as a door switch. I have been searching through the help files and posts here but haven’t found the information on using CONTACT in the items file. If I open and close the door switch connected to the 8266-01 I can see the following errors in the log file

2019-07-08 12:13:29.406 [WARN ] [eneric.internal.generic.ChannelState] - Command 'OFF' not supported by type 'OpenCloseValue': No enum constant org.eclipse.smarthome.core.library.types.OpenClosedType.OFF

2019-07-08 12:13:29.457 [WARN ] [eneric.internal.generic.ChannelState] - Command 'ON' not supported by type 'OpenCloseValue': No enum constant org.eclipse.smarthome.core.library.types.OpenClosedType.ON

I have the door contact set like this in the items file.

Contact         MF_Dining_Carport          "Carport Door [%s]"          <door>               (MF_Dining, gDoor)             ["Door"]                       {channel="mqtt:topic:41567ab4:carport"}

Group:Contact:(OPEN, CLOSED)               gDoor          "Door"             <door>            (Home)   ["Switchable"]

I’m sure I have something configured wrong. Any pointers?

Thank you


You cannot send commands to a Contact type Item (in general anyway, there are always exceptions)

Where’s that command coming from, how have you set up your MQTT channel? You want it updating state.

I was also looking for the code from the demo program as I thought there was code for door contacts in it. Still searching.

I know back about a couple years ago when I first started working with OH, I did have door switches working. Unfortunately I didn’t save the code.

Okay, let us know when you are ready to share your MQTT channel info.

Here is the Data from the Sonoff configuration and the OH configuration for the Carport door.
It doesn’t appear that I have set up the MQTT for this.

I think in your MQTT channel, you want to get rid of the command topic. You do not want incoming MQTT to trigger an openHAB command, you want a state update.

Then you need to convert incoming ON/OFF payloads from the Tasmota into OPEN?CLOSED suitable for a Contact type Item. The binding has a handy tool to do that - fill in the “Custom xxx value” boxes with ON and OFF as required.

Well I was working with the circuit and code yesterday and got it working as a switch to where I can open and close a switch connected to the ESP8266-01 and it will show ON and OFF on the Basic UI. So now I need to figure out how to convert that to show the door OPEN and CLOSE.