Help to set up an mqtt switch

Hi
I have connected a switch in mosquito but I can not set up correctly and use it as a switch

{
    "header": {
        "messageId": "86adf5befc781cb501c41c65dd4d09c9",
        "namespace": "Appliance.Control.ToggleX",
        "method": "PUSH",
        "payloadVersion": 1,
        "from": "/appliance/1812013756539529087334298f18976e/publish",
        "timestamp": 1622382506,
        "timestampMs": 491,
        "sign": "c8b470128e93148ea9537786a2a22ef1"
    },
    "payload": {
        "togglex": [
            {
                "channel": 0,
                "onoff": 1,
                "lmTime": 1622382505
            }
        ]
    }
}

I tried the following but it is not working.

- platform: mqtt
    name: Meross Dinning
    state_topic: "/appliance/1812013756539529087334298f18976e/publish"
    command_topic: "/appliance/1812013756539529087334298f18976e/subscribe"
    qos: 1
    payload_on: "1"
    payload_off: "0"
    retain: false 

Can someone help a little please?

In the last example leave only name and command topic.
Then go to mqtt integration, listen to that topic. Insert entitie card for the switch and try it.
Why these topic names so long and strange? :joy::joy::joy:

1 Like