MQTT and xiaomi switch

Tags: #<Tag:0x00007f2fb32a6e78> #<Tag:0x00007f2fb32a6b80>

After upgrading to 2.4; I managed to make sensors working again (thanks to other forum entries). Now I am trying add https://www.zigbee2mqtt.io/devices/QBKG12LM.html but I am missing some bits.

I don’t know how to define it at .things neither at .items

The mqtt message when switching is

topic 'zigbee2mqtt/laundryswitch', 
payload '{"power":0,
"consumption":0,
"temperature":33,
"linkquality":80,
"state_left":"ON",
"state_right":"OFF",
"click":"",
"device":{"ieeeAddr":"0x00158d0002a6de0e","friendlyName":"laundryswitch","type":"Router","nwkAddr":2841,"manufId":4447,"manufName":"LUMI","powerSource":"Mains (single phase)","modelId":"lumi.ctrl_ln2.aq1","hwVersion":18,"swBuildId":"unknown","dateCode":"06-25-2018","status":"online"}}'

I have defined the thing as

    Thing topic lightlaundry "Light" @ "FF_LaundryRoom" {
    Channels:
        Type switch : PowerSwitch  [ stateTopic="zigbee2mqtt/laundryswitch" , commandTopic="zigbee2mqtt/laundryswitch/left/set", on="ON", off="OFF" ]
    }

and item as

Switch lightlaundry "Light" <light> (FF_LaundryRoom) {channel="mqtt:topic:mosquitto:laundryswitch" }

You haven’t got a channel named laundryswitch. You did make one called PowerSwitch belonging to a thing called lightlaundry.

That will give you all of the JSON payload. I expect you’ll want to parse out some part of the JSON using a JSONPATH transformationPattern

You are right, I messed (sometimes I mess labels with keywords), still learning…

Thanks a lot, now it is working.