Command 'off' from channel 'mqtt:topic:statusdisplay:status' not supported by type 'OnOffValue': No enum constant org.openhab.core.library.types.OnOffType.off
this is my thing configuration:
Thing mqtt:topic:statusdisplay (mqtt:broker:mosquitto) {
Type switch : status "Status" [ stateTopic="HomeStatusDisplay/status", on="ON", off="OFF"]
}
I’m a bit old school on here and still write my items and things files. I’m sure there’s someone on here that can tell you an easier way to do it via the openhab webui.
The lowercase string 'off' is what is coming through from your mqtt topic. However, you have not configured your channel to handle this situation:
Because 'off' does not match either 'ON' or 'OFF', the channel passes the received value directly onto the the linked switch item, and 'off' is not a valid command for a switch item.
When the docs say:
The switch channel by default recognizes "ON" and "OFF" .
what this means is that if those two values are the ones that come through from your topic, then you don’t have to configure the on and off properties. In your case, it appears that the ON state is supposed to be triggered by 'on' and the off state by 'off', so these are the values you have to put into the properties.
Thing mqtt:topic:statusdisplay (mqtt:broker:mosquitto) {
Type switch : status "Status" [ stateTopic="HomeStatusDisplay/status", on="on", off="off"]
}
In this case, you could get the same effect by writing a quick script that converts the incoming values to uppercase and applying that script as the transformationPattern. Then you wouldn’t have to have the on or off properties because the channel would be handling 'ON' and 'OFF' inputs instead.