# Howto set a Zigbee switch

**URL:** <https://discourse.nodered.org/t/howto-set-a-zigbee-switch/45227>\
**Category:** General\
**Created:** [5 May 2021 15:30 UTC](https://discourse.nodered.org/t/howto-set-a-zigbee-switch/45227 "2021-05-05T15:30:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwyrp](https://avatars.discourse-cdn.com/v4/letter/q/278dde/32.png) [@qwyrp](https://discourse.nodered.org/u/qwyrp)\
**Post date:** [5 May 2021 15:30 UTC](https://discourse.nodered.org/t/howto-set-a-zigbee-switch/45227/1 "2021-05-05T15:30:57Z")

</div>

I'm using Sonoff Zigbee Bridge with Tasmota. Furthermore I'm using Node-red but whatever I do I can't set my Zigbee switch. I'm familliar with the following topic: [Tradfri / ZBbridge (zigbee) / Tasmota commands in Node-Red](https://discourse.nodered.org/t/tradfri-zbbridge-zigbee-tasmota-commands-in-node-red/32969) and this helps me a little but further but I don't got it to work. They stated the following:

```auto
{
  "topic":"cmnd/yourbridge/ZbSend",
  "payload":{"Device":"0x7509","Send":{"Power":"off"}}
}

```

On my bridge console I can see the following:

> tele/zigbee/SENSOR = {"ZbReceived":{" Aq1":{"Device":"0xF885","Name":" Aq1","Illuminance":15,"Occupancy":1,"Endpoint":1,"LinkQuality":58}}}

Hereby my flow:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/5/458d0be9712c240ace98995390cbfaa75ace7c41.png)

[{"id":"434ba335.1c8b7c","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"25ebc363.49ce9c","type":"mqtt out","z":"434ba335.1c8b7c","name":"","topic":"tele/zigbee/SENSOR","qos":"2","retain":"","broker":"89bfc099.8b73e","x":560,"y":240,"wires":},{"id":"68581e1e.8842","type":"inject","z":"434ba335.1c8b7c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{"Device":"0xDA52","Send":{"Power":"Toggle"}}","payloadType":"json","x":150,"y":240,"wires":[["25ebc363.49ce9c"]]},{"id":"89bfc099.8b73e","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.232","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

What am I doing wrong? It would help me a lot if somebodye shows me a flow that actually works

---

<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:** [5 May 2021 18:02 UTC](https://discourse.nodered.org/t/howto-set-a-zigbee-switch/45227/2 "2021-05-05T18:02:37Z")

</div>

Hi,

With the Tasmota Zigbee bridge I'm using  
`cmnd/ZigbeeBridge/Zbsend` as topic and

```auto
{
    "device": "TestLamp",
    "send": {
        "Dimmer": 25
    }
}

```

as payload.

Here's a sample flow:

```auto
[{"id":"2ae88aaf.e2fa8e","type":"mqtt out","z":"c4d9fae1.52009","name":"TestLamp","topic":"","qos":"0","retain":"","broker":"2f537664.491afa","x":1100,"y":4820,"wires":[]},{"id":"e13c799b.23f4f8","type":"inject","z":"c4d9fae1.52009","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/ZigbeeBridge/Zbsend","payload":"{\"device\":\"TestLamp\",\"send\":{\"Dimmer\":25}}","payloadType":"json","x":770,"y":4820,"wires":[["2ae88aaf.e2fa8e"]]},{"id":"2f537664.491afa","type":"mqtt-broker","name":"MosquittoLocal","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":false,"protocolVersion":4,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

```

This works fine for me.  
You can adapt this sample very easy to use it with a switch.

---

<div class="post-metadata">

**Author:** ![qwyrp](https://avatars.discourse-cdn.com/v4/letter/q/278dde/32.png) [@qwyrp](https://discourse.nodered.org/u/qwyrp)\
**Post date:** [8 May 2021 14:13 UTC](https://discourse.nodered.org/t/howto-set-a-zigbee-switch/45227/3 "2021-05-08T14:13:15Z")

</div>

Thanks but I still can't get it to work 😢

My payload is: `{"device":"zbSchakelaar","send":{"Power":"Toggle"}}`  
My Topic is:` tele/zigbee/SENSOR/ZbSend`  
Hereby the flow I'm using:

> `[{"id":"434ba335.1c8b7c","type":"tab","label":"Zigbee","disabled":false,"info":""},{"id":"41e6870f.95be88","type":"mqtt out","z":"434ba335.1c8b7c","name":"TestZigbee","topic":"","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"89bfc099.8b73e","x":510,"y":440,"wires":[]},{"id":"1338adea.a0c8d2","type":"inject","z":"434ba335.1c8b7c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"tele/zigbee/SENSOR/ZbSend","payload":"{\"device\":\"zbSchakelaar\",\"send\":{\"Power\":\"Toggle\"}}","payloadType":"json","x":170,"y":440,"wires":[["41e6870f.95be88","6d573cbe.79f4d4"]]},{"id":"6d573cbe.79f4d4","type":"debug","z":"434ba335.1c8b7c","name":"ZIGBEE","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":460,"y":540,"wires":[]},{"id":"89bfc099.8b73e","type":"mqtt-broker","name":"","broker":"192.168.1.232","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]`

But no sign of activity in the console when I activate the flow.

The only thing that's working is when I directly enter the following command in the console `ZbSend { "device":"zbSchakelaar", "send":{"Power":"Toggle"} }`

I do have strong doubts about the correctness of the used topic: **tele/zigbee/SENSOR/ZbSen** d but I've tried several other options.

Hopefully can somebody help me

---

<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:** [8 May 2021 17:37 UTC](https://discourse.nodered.org/t/howto-set-a-zigbee-switch/45227/4 "2021-05-08T17:37:33Z")

</div>

Topic should start with `cmnd`, rest of the topic depends on the settings you made in Tasmota web interface.  
**Tele** topic is what the Tasmota bridge send to you, **cmnd** is what you want that the Tasmota bridge to do.

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [8 May 2021 19:56 UTC](https://discourse.nodered.org/t/howto-set-a-zigbee-switch/45227/5 "2021-05-08T19:56:48Z")

</div>

`"topic":"cmnd/yourbridge/ZbSend"` I do not use zigbee2tasmota (I use zigbee2MQTT) but I think that `yourbridge` should be replaced with the name of your bridge. For example edje11 uses `ZigbeeBridge`

I also use MQTT-Explorer for checking MQTT messages. Helps when you want to see exactly what is being sent & received

---

<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:** [8 May 2021 21:15 UTC](https://discourse.nodered.org/t/howto-set-a-zigbee-switch/45227/6 "2021-05-08T21:15:32Z")

</div>

Goto your Tasmota webinterface, then goto the **Information** button.  
Half way the page you find the needed topic under **Mqtt Full topic**.  
Use this topic and add **/ZbSend** to it for your topic in Node-red.

![Tasmota](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/44c1ee0cb98e4cc962f0cc8f5b5f0e3d2929e2be.png)

---

<div class="post-metadata">

**Author:** ![qwyrp](https://avatars.discourse-cdn.com/v4/letter/q/278dde/32.png) [@qwyrp](https://discourse.nodered.org/u/qwyrp)\
**Post date:** [10 May 2021 14:11 UTC](https://discourse.nodered.org/t/howto-set-a-zigbee-switch/45227/7 "2021-05-10T14:11:34Z")

</div>

Thanks I finally got it working. My **MQTT FULL TOPIC** turns out to be _cmnd/zigbee_ so the topic _cmnd/zigbee/ZbSend_ and payload {"Device":"ZbSchak1","send":{"Power":"Toggle"}} did it form me.  
Thank you all guys!

---

<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:** [24 May 2021 14:11 UTC](https://discourse.nodered.org/t/howto-set-a-zigbee-switch/45227/8 "2021-05-24T14:11:57Z")

</div>

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