MQTT Switch State: Command '0' not supported by type 'OnOffValue'

Hello,

I am using openHAB 3 and try to migrate all files in /etc/openhab to the GUI. Yesterday I migrated a Shelly 3EM thing to the GUI. Now I see the following warning (which appears every few seconds) in openhab.log:

2021-03-08 12:25:27.740 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '0' not supported by type 'OnOffValue': No enum constant org.openhab.core.library.types.OnOffType.0

The channel in the new thing looks like this:

- id: Relay
  channelTypeUID: mqtt:switch
  label: Relay
  description: ""
  configuration:
    commandTopic: shellies/shellyem3-8CAAB561D930/relay/0/command
    stateTopic: shellies/shellyem3-8CAAB561D930/relay/0
    off: off
    on: on

And the relay of the Shelly 3EM looks like this in MQTT Explorer:

image

I also can use the switch to turn the relay on and off. This works without a problem.

Well, I do not get it. I am lost somewhere in between. And hope for help.

Thanks and cheers,
Roi

It looks like the device is sending 0 to mean OFF and presumably 1 to mean ON. You’s set up the off parameters to look for “off” and the on parameter to look for “on”. Try using 0 and 1.

Hi and thank you for the answer,

it was something different. A different channel of a different Shelly thing which I also migrated from a things-file to the GUI. This new Shelly 2.5 thing has a channel “OverTemperature”, which can be 0 and 1. This is how it looks in the MQTT Explorer:

image

This is how the channel looked in openHAB3 GUI:

And the code view showed this:

- id: OverTemperature
  channelTypeUID: mqtt:switch
  label: OverTemperature
  description: null
  configuration:
    stateTopic: shellies/shellyswitch25-68C63AFB8AA2/overtemperature

Yesterday I went into the code view and inserted the last two lines:

- id: OverTemperature
  channelTypeUID: mqtt:switch
  label: OverTemperature
  description: null
  configuration:
    stateTopic: shellies/shellyswitch25-68C63AFB8AA2/overtemperature
    off: "0"
    on: "1"

The warnings in openhab.log disappeared. The GUI view still looks the same, like shown above in the screenshot.

There seems to be a different between the numbers 0 and 1 and the characters 0 and 1? Or is it something different? I do not understand completely.

Cheers,
Roi

Yes, "1" is not the same thing as 1 and either one can be delivered as an MQTT message. However, almost all the time the string "1" is sent instead of the number 1.

Ok. Thank you. And how do I enter “1” and “0” in the GUI? If I do that it appears like ‘“0”’ in the code view.

Add the quotes when you enter it. Or open the code tab and add the quotes there.

1 Like

Hi,

I have a similar issue.
Have configured an MQTT switch item with needs the command GLOW to turn on and ALLOFF to turn off.
Here is the configuration:

The thing works as it should, but I always get these warnings in my log file:

2021-12-20 21:24:48.483 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command 'ALLOFF' not supported by type 'OpenCloseValue': No enum constant org.openhab.core.library.types.OpenClosedType.ALLOFF
2021-12-20 21:24:50.495 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command 'GLOW' not supported by type 'OpenCloseValue': No enum constant org.openhab.core.library.types.OpenClosedType.GLOW

How can I change the configuration to get rid of these warnings?
Tried to put the commands into quotes, but this didn’t change anything.

Thanks
Matthias

This would the suggest the warning is coming from something other than a Switch Channel. A Switch Channel would usually complain about OnOffValue. Is your screenshot really of a Switch? Or have you setup another type of Channel somewhere else with almost identical information? Or another a Channel which is processing the same MQTT message?

1 Like

Interesting point!
I had another channel subscribing to the same MQTT topic. Aim was to catch a periodic alive signal from the device. And this was linked to a contact item.
Have removed this channel now as I actually do not use it anyway.
So let’s see whether the messages will still come now.
But thank you! I was probably looking at the completely wrong point!!

This in fact did the trick!
Thank you @hafniumzinc for the hint!