MQTT Switch State: Command '1' not supported by type 'OnOffValue'

I had the exact same problem that OP describes.
After a lot of mucking around, in the end a reboot of the system seems to have solved the problem: so apparently there was no problem in the configuration at all.
Can anyone confirm this, or was I just very lucky?
Cheers

What version of openHAB are you running? Version 2.5.3 and/or 2.5.4 (and maybe older ones) had a known bug which meant that any changes to a Things file required a restart of openHABā€¦

Iā€™m sorry, I do not remember. I have upgraded since then, so canā€™t really say:(

Is someone is still trying to make this work, for me the JSONPATH and JS transformation combined worked.

Original JSON

{"ZbReceived":{"0xxxx":{"Device":"0xxxx","Name":"PuertaOficina","0500<00":"000000000000","ZoneStatusChange":0,"Contact":0,"Endpoint":1,"LinkQuality":118}}}

xx.thing

 Type contact : PuertaOficina [stateTopic="tele/zigbee_bridge/xxx/SENSOR", transformationPattern="JSONPATH:$.ZbReceived.xxxx.Contactāˆ©JS:js/mapContactStatus.js" ]

transform/js/mapContactStatus.js

(function(data) {
        var indices = { 1: "OPEN", 0: "CLOSED"}
        return indices[data];
})(input)

In my case i have a separated channel for each device, but you could combine this with the REGEX trick if you need to filter by device

1 Like