Tuya WHD02 zigbee2mqtt

Hi everybody !

I’ve just received some Tuya WHD02 zigbee switches.
I thought after pairing in z2m that I will found some switches in the entities. But not.
So after reading tons of websites, I’ve finally found how to configure them. The exact syntax was hard to find !
I share for those who could be still searching :slight_smile:

In my configuration.yaml file, I’ve just added this (of course, replace Name_Given_In_Z2M by the real name you’ve typed) :

mqtt:
    switch:
      - state_topic: "zigbee2mqtt/Name_Given_In_Z2M"
        command_topic: "zigbee2mqtt/Name_Given_In_Z2M/set"
        unique_id: myswitch
        name: "My Switch"
        value_template: "{{ value_json.state }}"
        payload_on: '{"state": "ON"}'
        payload_off: '{"state": "OFF"}'
        state_on: "ON"
        state_off: "OFF"

Hope that can help.

2 Likes

Thank you a lot!!!