[SOLVED] MQTT2 Switch Thing - not being transformed

Hi ive been using the MQtt bunding for ages, but not as it seems to switch any of my Mysensors devices…in this case a swimming pool light.

I have a thing and an item configured, but when i toggle the switch the MQTT broker receives “ON” or “OFF”…and my device wants to receive 0 or 1


Type switch : poollight     "Pool Light"      [ stateTopic="mygateway1-out/6/7/1/0/2", commandTopic="mygateway1-in/6/7/1/0/2", on="1", off="0" ]


Switch PoolLightMMQTT “Pool Light” (gPool) [“Switchable”,“iss:room:Pool”,“iss:type:DevSwitch”] { channel=“mqtt:topic:mosquitto:mys6:poollight” }

additionally these appear in the log:

2019-12-27 21:19:43.618 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command ‘0’ not supported by type ‘OnOffValue’: No enum constant org.eclipse.smarthome.core.library.types.OnOffType.0

I feel im missing something really simple… but cannot find what!

Which switch the mySensor device or the sitemap?

I do not think on/off transform works until binding versions 2.5 ?

It’s not a transformation it’s a state change:
on="1", off="0"
But perhaps you are kind of correct and it doesn’t work on outbound

Does sending the stateTopic with a payload of 0 or 1 toggles the openHAB switch?

I’m curious on this error.
It sounds to me as if openHAB (not the device) is complaining about 0/1 instead of ON/OFF. Since the command is set to send 0/1 I would expect this message to be complaining about the 0/1 state message from the device. In this case an incoming transformation might be needed.
However this is only guess-work!

Thanks for your replies guys :wink:

Via the sitemap.

I am running 2.5…

Yes the device reports back periodically its state ( 0 or 1 ) to mqtt.

Ive got this working, but not via the Things file entry. I created in PaperUI a new thing and set the “Custom on/Open value” to 1 and “Custom Off/Closed Value” to 0… then linked this to my item and that now works…
I checked out the entry within the jsondb file to see what it sets:

“label”: “PoolLight2”,
“configuration”: {
“properties”: {
“commandTopic”: “mygateway1-in/6/7/1/0/2”,
“stateTopic”: “mygateway1-out/6/7/1/0/2”,
“off”: “0”,
“on”: “1”

seems to be the same as what ive set in the things file… why does this work but not the things file?

It (almost) always work with PaperUI. I highly recommend using the paperUI to define your things.
The things files are touchy and delicate things…

Could you tick the solution, please?