OH3 GUI: Channel Updates (MQTT) don't follow default rules for Contact

I’m sending MQTT updates for various datapoints I have and have configured my MQTT channel (generic MQTT Thing) as follows:


the red marked values are default and are already in the GUI, when you add a “Contact” Channel.

This leads to:

2021-01-06 11:43:49.100 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '0' not supported by type 'OpenCloseValue': No enum constant org.openhab.core.library.types.OpenClosedType.0
2021-01-06 11:43:49.148 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '1' not supported by type 'OpenCloseValue': No enum constant org.openhab.core.library.types.OpenClosedType.1

I had to go into “Code” and manually add the “on/off” values, to enable the action, the GUI tells me is already going on.

  - id: State_AnforderungKessel1
    channelTypeUID: mqtt:contact
    label: Anforderung Kessel 1
    description: ""
    configuration:
      stateTopic: openHAB/master/Oktopus/State_AnforderungKessel1
      off: "0"
      on: "1"
2021-01-06 11:48:07.061 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'MQTTOktopus_AnforderungKessel1' changed from NULL to CLOSED

Is this a bug, or did I miss something?

Looks like a bug.

When you create a Channel, what happens if you remove the 1, then add it back into the UI and click save? Does it correctly configure then?

If I try to remove either default value, it gets automatically reinserted if I leave the field empty.
only if I insert anything other than “0” or “1”, the CODE shows the on/off in the YAML.
If I then save the Channel, this happens:

2021-01-06 12:00:37.928 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '1' not supported by type 'OpenCloseValue': No enum constant org.openhab.core.library.types.OpenClosedType.1

seems like a bug then?

No harm in reporting it!

1 Like

done! :wink: