# Zigbee2mqtt+Xiaomi Switch - I need help :(

**URL:** <https://discourse.nodered.org/t/zigbee2mqtt-xiaomi-switch-i-need-help/45498>\
**Category:** General\
**Created:** [11 May 2021 15:24 UTC](https://discourse.nodered.org/t/zigbee2mqtt-xiaomi-switch-i-need-help/45498 "2021-05-11T15:24:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Merwenus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/merwenus/32/41604_2.png) [@Merwenus](https://discourse.nodered.org/u/Merwenus)\
**Post date:** [11 May 2021 15:24 UTC](https://discourse.nodered.org/t/zigbee2mqtt-xiaomi-switch-i-need-help/45498/1 "2021-05-11T15:24:47Z")

</div>

Hello,

It took me 4 days to make the new Itead Zigbee 3.0 usb dongle to work and found it it uses different pattern than the Xiaomi gateway and can't use my old nodes.  
I'm dumb and can't find a way to make a simple switch work and can't find a working flow online.

Can someone share a simple Zigbee2mqtt Xiaomi switch flow?  
This is the payload in Zigbee2Mqtt log:

> MQTT publish: topic 'zigbee2mqtt/0x00158d0001bf57fc/action', payload 'single'

Thank you!

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [11 May 2021 21:58 UTC](https://discourse.nodered.org/t/zigbee2mqtt-xiaomi-switch-i-need-help/45498/2 "2021-05-11T21:58:22Z")

</div>

Hi,  
If I understand correct you have installed Zigbee2mqtt firmware on an Itead Zigbee dongle?

If you are using Zigbee2mqtt then you can [node-red-contrib-zigbee2mqtt](https://flows.nodered.org/node/node-red-contrib-zigbee2mqtt) for easy implementation.

Or you can make your own with this simple mqtt example.  
The sample is not specific for Xiaomi switch, but it should not be to difficult to adapt.

```auto
[{"id":"cb09fd.432436","type":"mqtt out","z":"6ebb4e1a.90e7","name":"","topic":"zigbee2mqtt/Salontafel/set","qos":"","retain":"","broker":"e992f40a.2e8898","x":1020,"y":1420,"wires":[]},{"id":"250e1812.045c2","type":"inject","z":"6ebb4e1a.90e7","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"Device\":\"MySwitch\",\"send\":{\"Power\":\"On\"}}","payloadType":"json","x":700,"y":1420,"wires":[["cb09fd.432436"]]},{"id":"e992f40a.2e8898","type":"mqtt-broker","name":"","broker":"192.168.1.127","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

```

---

<div class="post-metadata">

**Author:** ![Merwenus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/merwenus/32/41604_2.png) [@Merwenus](https://discourse.nodered.org/u/Merwenus)\
**Post date:** [12 May 2021 04:34 UTC](https://discourse.nodered.org/t/zigbee2mqtt-xiaomi-switch-i-need-help/45498/3 "2021-05-12T04:34:31Z")

</div>

Yes, you understand correctly.  
I have **Home Assistant** and **Zigbee2mqtt** with this [Xiaomi Switch](https://www.zigbee2mqtt.io/devices/WXKG03LM_rev1.html)

I already have the entities in NodeRed due to Home Assistant, the problem is I have no idea how to make this switch work.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 May 2021 04:35 UTC](https://discourse.nodered.org/t/zigbee2mqtt-xiaomi-switch-i-need-help/45498/4 "2021-05-26T04:35:31Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
