[Solved] MQTT Command ‘0’ not supported by type ‘OnOffValue’

If you haven’t gone to bed: could you share your full Things file?

And also a full sample of the JSON message sent over MQTT from the device?

Note that you cannot tell which channel is producing these warnings. Confident you are looking at the only channel that could try to process an incoming message “1” ?

Hi Guys,

first of all here’s the complete JSON

{"Time":"2022-03-10T12:24:39","Uptime":"15T19:25:33","UptimeSec":1365933,"Heap":24,
"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":5,"POWER":"OFF",
"Dimmer":100,"Color":"255,191,0,0,0","HSBColor":"45,100,100","White":0,"CT":153,
"Channel":[100,75,0,0,0],"Scheme":0,"Fade":"ON","Speed":1,"LedTable":"OFF",
"Wifi"{"AP":1,"SSId":"XXXXXXX","BSSId":"B0:B9:8A:xx:xx:xx","Channel":13,"Mode":"11n",
"RSSI":90,"Signal":-55,"LinkCount":1,"Downtime":"0T00:00:03"}}

I don’t want to share the whole .things file because there are too many mqtt things in there and there was no warning before adding the new rgb-bulb thing…

this is the complete things declaration

// RGB-Bulb   
    Thing topic RGB-Bulb-01 "MQTT - RGB-Bulb-01" {
        Channels:
            Type switch : switch "Power Switch" [ 
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE", 
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/POWER",
                transformationPattern="JSONPATH:$.POWER",
                ON="ON",
                OFF="OFF"          
            ]
            Type dimmer : dimmer "Dimmer" [
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE",
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/Dimmer",
                transformationPattern="JSONPATH:$.Dimmer"
            ]
            Type string : color "Color" [
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE",
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/Color",
                transformationPattern="JSONPATH:$.Color"
            ]
            Type colorHSB : hsbcolor "HSB Color" [
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE",
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/HSBColor",
                transformationPattern="JSONPATH:$.HSBColor"
            ]
            Type string : channel "Channel" [
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE",
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/Channel",
                transformationPattern="JSONPATH:$.Channel"
            ]
            Type dimmer : ct "Color Temperature" [
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE",
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/CT",
                min=153, max=500, step=10,
                transformationPattern="JSONPATH:$.CT"
            ]
            Type switch : white "White" [
                stateTopic="tele/OpenHAB/RGB-Bulb-01/STATE",
                commandTopic="cmnd/OpenHAB/RGB-Bulb-01/White",
                transformationPattern="JSONPATH:$.White",
                ON="1",
                OFF="0"
            ]
    }

I know… but I think the bulb is new, the warning is new - it would be really mysterious if this occurs now without any other changes. I think if I would define these channels as string instead of switch the warning would be gone but that’s no solution for the problem. :thinking:

All the other Channels in this Thing definition work fine?

Yes, the ones that are in use work fine… I use
dimmer, hsbcolor, ct and switch

The parameters should be in lowercase:

on="1",
off="0"

Throw in a restart afterwards, or do this.

2 Likes

Hm, I have other working mqtt-things defined the same way (ON=“ON”) in uppercase this really shouldn’t be a problem - I also changed that twice yesterday, but I will give it another try…

thanks… I’ll be right back :wink:

The docs have the parameters in lowercase in any case.

But I can see from the previous posts you have tried this before, though do make sure the Things file is properly read each time.

I changed all my uppercase to lowercase, in the whole file now… just restarting OH…

by the way I use this mqtt.things file since OH 2.0 or 1.8 and the uppercase never was a problem… but maybe it’s deprecated now - but now the file is up to date :slight_smile:

Yes I initially struggled with these bulbs but got them to work without the “whitemode” but I would be glad to use a real white instead of a yellowish one through rgb/hsb :wink:

@hafniumzinc So, finally after restarting the warning is gone - maybe I haven’t restarted after every try yesterday… so seems to be deprecated to use uppercase for ON and OFF.

thanks a lot for all your help everyone!!

1 Like

As said before, the things file parser silently ignores made-up syntax. So it would ignore this, and default on= parameter - but by chance the payload is “ON” anyway, no error to report.
This config is broken, but the channel works despite that.

I don’t think ON= was ever supported.

1 Like

maybe, but I could swear I copied this definition from an old documentation ages before :wink: or maybe from a forum post about mqtt…

never had any problems… but I’m glad it was just a syntax error and this will never happen to me again…

I know that I repeat myself: this wouldn‘t have happened if the configuration had been done in UI.

2 Likes

Yes sure… would be nice if you could take the time to add various things items and rules to the UI for me then… there are just 59 things and 1460 items - have fun!

sry but this is really a dumbass comment Jan…

How much time did you spend sorting this glitch out …

I still use files for what I think are good reasons (for me). But I recognise that I have to be precise. When I mess up, it’s me that’s messed up. Not the fault of deprecation or someone elses’s posting etc.

1 Like

You can import the items file in 10s, there‘s an option for that in the UI.

For things: you can retrieve all things as JSON, remove file and add them back (individually) via the REST API. This takes about 20-30s per thing. Finding this mistake took way longer.

In general it’s hard for me to understand why the devs obviously don’t have much love for textual configs anymore… all new features according to the model etc. aren’t documented what syntax one should use for textual config. I use openhab since it’s birth, in 2015 I think. I have taken part in all the time watched every change - the useful and the not so useful. but until OH 2.5 most of the first-time users used config files - I don’t know why this is unwanted nowadays.

Instead of supporting and renewing textual config use there is a noticeable aversion from many responsible openhab maintainers…

In my case: exactly because of the issue presented here. Misconfigurations are hard to find and sometimes result in unpredictable behavior that looks like a bug.

in UI it’s also possible to misconfigure items and things. Tried that for a time in OH 2.2 with PaperUI…
I never had so much inconsistency with my textual config.

And in general it wouldn’t be easier to configure a mqtt device in UI because you have to link the channels manually and understand which datatype the mqtt-topics are.

Only the uppercase error would’ve been prevented. But there’s no automatic detection…