Warn in log : MQTT Command '' not supported by type 'OnOffValue'

  • Platform information:
    • Hardware: x86 QNAO
    • OS: linux
    • Java Runtime Environment: 8 something
    • openHAB version: 2.5.6
  • Issue of the topic: please be detailed explaining your issue
  • Please post configurations (if applicable):
    • Items configuration MANY
    • Sitemap configuration FEW
    • Rules code related MANY

Hello

I need some help - I could sort out a lot of errors listed in log
The only remaining error for the time beeing is

2020-12-09 19:19:48.866 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.
2020-12-09 19:20:33.238 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.
2020-12-09 19:20:51.557 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.
2020-12-09 19:22:15.955 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.

So in total I have about 25 sonoff items via MQTT running. Some with Senors
There are many rules to synchronize the .state to the switch.state
There are rules to trigger the items via alex
And there are sitemaps used on Iphone APP

So I need your help as after hours I still do not really know where is the problem

Is the warning a result of a .sendCommand() action
Or is the warning the result of a currently not connected device where a rule tries to set something

Here some examples of thing, item and rules

item:

Switch Hobbykeller_Switch     "Hobbykeller "             (gSONOFF_B8)      { channel="mqtt:topic:63abe7ae:SONOFF_B8thg:PowerSwitch" }
Switch Hobbykeller_State      "Hobbykeller State"        (gSONOFF_B8)      { channel="mqtt:topic:63abe7ae:SONOFF_B8thg:PowerSwitchRes"}
Number HobbykellerTemperatur "Hobbykeller Temp [%s °C]" (gSONOFF_B8info)  { channel="mqtt:topic:63abe7ae:SONOFF_B8thg:Temperatur"}
Number HobbykellerHum        "Hobbykeller Hum  [%s]"    (gSONOFF_B8info)  { channel="mqtt:topic:63abe7ae:SONOFF_B8thg:Hum"}
String Hobbykeller_Uptime     "Hobbykeller Uptime"       (gSONOFF_B8Info)  { channel="mqtt:topic:63abe7ae:SONOFF_B8thg:uptime" }

thing:

  Thing topic SONOFF_B8thg "Hobbykeller Sonoff"  @ "Keller"  {
  Channels:
    Type switch : PowerSwitch    "Power Switch" [ stateTopic="SONOFF_B8/cmnd/POWER", commandTopic="SONOFF_B8/cmnd/POWER", on="ON", off="OFF" ]
    Type switch : PowerSwitchRes "Switch State" [ stateTopic="SONOFF_B8/tele/STATE", transformationPattern="JSONPATH:$.POWER",on="ON",off="OFF"]
    Type number : Temperatur    "Temperatur"      [ stateTopic="SONOFF_B8/tele/SENSOR", transformationPattern="JSONPATH:$.AM2301.Temperature"]
    Type number : Hum       "Luftfeuchtigkeit"    [ stateTopic="SONOFF_B8/tele/SENSOR", transformationPattern="JSONPATH:$.AM2301.Humidity"]
    Type string : uptime        "Uptime"           [ stateTopic="SONOFF_B8/tele/STATE", transformationPattern="JSONPATH:$.Uptime" ]
  }

rules: (example)

rule "Temp_Hobbykeller_Sonoff_Umbau"
when

       Item HobbykellerTemperatur changed or
       Item HobbykellerHum changed
then
      Temp_Hobbykeller_Sonoff.postUpdate(HobbykellerTemperatur.state.toString +" °C    "  + String::format("%.0f", (HobbykellerHum.state as DecimalType).floatValue())+ " %")
    
end
 
other rule !!
... 
    if (Hobbykeller_State.state == ON) {Hobbykeller_Switch.state = ON}
    if (Hobbykeller_State.state == OFF) {Hobbykeller_Switch.state = OFF}
...

So where do I have to look for to eliminate the warning in the log … ?

That error usually happens when one of your Switch Things receives an MQTT message on its subscribed topic (from outside openHAB), but the message doesn’t contain a relevant ON/OFF command.

I can’t immediately see what the cause is, but its difficult to tell because of the formatting: could you edit your first post and use code fences? Use three backticks `

```

like this

```

But then, you also only give an example, so your examples may not show the issue!

Is one of your Switch Things subscribed to a Tasmota RESULT topic? That doesn’t always contain a POWER command…

The other thing to point out is that these are only WARN messages, and if everything is actually functioning as you expect (ignoring the log), then you can safely ignore this is you want…

1 Like

You are right the RESULT causes the warning

    Thing topic SONOFF_LED_TL "LED Terasse Lounge" @ "Terasse" {
    Channels:
      Type switch : PowerSwitch    "Power Switch" [ stateTopic="LED_Terasse_Lounge/stat/POWER", commandTopic="LED_Terasse_Lounge/cmnd/POWER", on="ON", off="OFF" ]
      Type switch : PowerSwitchRes "Switch State" [ stateTopic="LED_Terasse_Lounge/tele/STATE", transformationPattern="JSONPATH:$.POWER",on="ON",off="OFF"]
      Type color : colorRGB "Colour" [	stateTopic="LED_Terasse_Lounge/stat/RESULT", commandTopic="LED_Terasse_Lounge/cmnd/HSBColor",transformationPattern="REGEX:(.*HSBColor.*)∩JSONPATH:$.HSBColor"]
      Type dimmer : dimmer "Dimmer" [stateTopic="LED_Terasse_Lounge/stat/RESULT", commandTopic="LED_Terasse_Lounge/cmnd/DIMMER", transformationPattern="REGEX:(.*Dimmer.*)∩JSONPATH:$.Dimmer"]  
      Type number : colorcw "Colour CW" [stateTopic="LED_Terasse_Lounge/stat/RESULT", commandTopic="LED_Terasse_Lounge/cmnd/CT", transformationPattern="REGEX:(.*CT.*)∩JSONPATH:$.CT"]  
        }   

It seems that /stat/POWER instead of /stat/RESULT solves the problem …

1 Like

Install the regex transformation

Change line for each switch channel using JSONPATH to

 transformationPattern="REGEX:(.*POWER.*)∩JSONPATH:$.POWER"

∩ is not N or n

So the logic is regex checks if POWER is found in the string and if so send it to jsonpath

1 Like