Unable to use value from MQTT State topic - No enum constant org.openhab.core.library.types.OnOffType.on

OH 4.0.4 Docker.


Type switch : LandingCeilingLight [ stateTopic="shellies/bulb-2/color/0", commandTopic="shellies/bulb-2/color/0/set", on="{\"turn\":\"on\",\"mode\":
\"white\",\"brightness\":\"100\",\"temp\":\"3000\"}", off="{\"turn\":\"off\",\"mode\":\"white\"}" ]


Switch swLandingCeilingLight "Ceiling Light[]" <switch> (groupSwitch_MAPDB, groupAllOff, groupAlarmPartArmLightsOff, groupAlarmFullArmLightsOff) {chan

This all works, apart from the error I am seeing in the log :slight_smile:

2023-11-29 20:43:07.781 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command 'off' from channel 'mqtt:topic:mosquitto:shelly:LandingCeilingLight' not supported by type 'OnOffValue': No enum constant org.openhab.core.library.types.OnOffType.off

Output from MQTT that feeds into stateTopic:

shellies/bulb-2/color/0 off

I cannot for the life of me see why I am getting this error, the binding does not seem to accept the value ‘off’ (or ‘on’ for that matter) any suggestions would be gratefully received, I am at a loss.

FWIW if I remove the stateTopic section completely it all still works and the error goes away, however if the state is changed outside of OH control it is then not reflected within OH, which makes me sad.


Case matters. on is not the same as ON and a Switch Item requires ON.

You need to set an incoming state transformation to extract the value and convert it to upper case. Once you do that, you might need to do the same because I’m not sure the order that the transform is processed and the onValue/offValue properties are applied.

Thanks for getting back to me:

I made a change to the item:

Switch swLandingCeilingLight "Ceiling Light[]" <switch> (groupSwitch_MAPDB, groupAllOff, groupAlarmPartArmLightsOff, groupAlarmFullArmLightsOff) {channel="mqtt:topic:mosquitto:shelly:LandingCeilingLight"[profile="transform:MAP", function="shelly.map"]}



This has worked for other items without issue, sadly in this case the error is unchanged.

Have I misunderstood your advice?

I would apply the transform on the Thing. There’s no need to use a profile.

Superb, thank you for the pointer, I made this change (after removing the transformation from the item)

Type switch : LandingCeilingLight [ stateTopic="shellies/bulb-2/color/0", transformationPattern="MAP:shelly.map", commandTopic="shellies/bulb-2/color/0/set", on="{\"turn\":\"on\",\"mode\":\"white\",\"brightness\":\"100\",\"temp\":\"3000\"}", off="{\"turn\":\"off\",\"mode\":\"white\"}" ]

Seems to be working as desired now, thank you kind sir!