# Problem with Zigbee2mqtt out node

**URL:** <https://discourse.nodered.org/t/problem-with-zigbee2mqtt-out-node/30019>\
**Category:** General\
**Created:** [13 July 2020 19:57 UTC](https://discourse.nodered.org/t/problem-with-zigbee2mqtt-out-node/30019 "2020-07-13T19:57:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sapster77](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sapster77/32/14335_2.png) [@sapster77](https://discourse.nodered.org/u/sapster77)\
**Post date:** [13 July 2020 19:57 UTC](https://discourse.nodered.org/t/problem-with-zigbee2mqtt-out-node/30019/1 "2020-07-13T19:57:13Z")

</div>

Hi,  
Hoping someone can assist me with an issue using zigbee2mqtt out node (node-red-contrib-zigbee2mqtt) and an Aqara wireless dual relay.  
I am receiving correct states from the relay:

```auto
Jul 13 20:55:08 lysekil npm[12867]: zigbee2mqtt:info 2020-07-13 20:55:08: MQTT publish: topic 'zigbee2mqtt/0x00158d000444ebab', payload '{"power":0.03,"consumption":0,"temperature":30,"linkquality":10,"state":"ON","state_l1":"OFF","state_l2":"OFF"}'

```

I am unable to inject a correct command to the out node in order to turn on the two relays and this is the first time using the this node, as my other sensors are motion sensors, which only use the "in"-node.

The documentation on [zigbee2mqtt.io](http://zigbee2mqtt.io) states that this sensor take the following commands:

```auto
switch:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
    availability_topic: "zigbee2mqtt/bridge/state"
    payload_off: "OFF"
    payload_on: "ON"
    value_template: "{{ value_json.state_l1 }}"
    command_topic: "zigbee2mqtt/<FRIENDLY_NAME>/l1/set"

```

l1 for relay 1 and l2 for relay 2.  
So my inject and out node looks like this:

```auto
[{"id":"396506a0.bf435a","type":"inject","z":"75d53786.992d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"zigbee2mqtt/0x00158d000444ebab//l1/set","payload":"{\"state\":\"ON\"}","payloadType":"json","x":250,"y":360,"wires":[["23bdb543.5a12ea","9ac0fee2.5060d"]]},{"id":"9ac0fee2.5060d","type":"zigbee2mqtt-out","z":"75d53786.992d","name":"Switch out","server":"2965400e.bf4508","friendly_name":"0x00158d000444ebab","device_id":"0x00158d000444ebab","command":"state","commandType":"z2m_cmd","payload":"on","payloadType":"z2m_payload","transition":0,"x":470,"y":360,"wires":[]},{"id":"2965400e.bf4508","type":"zigbee2mqtt-server","z":"","name":"","host":"localhost","mqtt_port":"1883","mqtt_username":"xxxxxx","mqtt_password":"xxxxxx.","base_topic":"zigbee2mqtt"}]

```

Basically I am trying to inject a payload {"state":"ON"} to this topic zigbee2mqtt/0x00158d000444ebab//l1/set , but that is obviously wrong as  
it gives me this error:

```auto
Jul 13 21:32:04 lysekil npm[12867]: zigbee2mqtt:info 2020-07-13 21:32:04: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"zigbee_publish_error","message":"Publish 'set' 'state' to '0x00158d000444ebab' failed: 'Error: Command 0x00158d000444ebab/1 genOnOff.off({}, {\"timeout\":10000,\"disableResponse\":false,\"disableDefaultResponse\":false,\"direction\":0,\"srcEndpoint\":null,\"reservedBits\":0,\"manufacturerCode\":null,\"transactionSequenceNumber\":null}) failed (Error: Data request failed with error: 'MAC no ack' (233))'","meta":{"friendly_name":"0x00158d000444ebab"}}'

```

Furthermore I am a little puzzled as to how to set the "command" and "payload" options in the the "out" node.

I hope all this makes sense - otherwise please ask. Basically just looking for the correct message to inject to out node, in order to turn on/off the 2 relays.

Thanks!

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [13 July 2020 21:50 UTC](https://discourse.nodered.org/t/problem-with-zigbee2mqtt-out-node/30019/2 "2020-07-13T21:50:02Z")

</div>

> [@sapster77](#):
>
> Basically I am trying to inject a payload {"state":"ON"} to this topic zigbee2mqtt/0x00158d000444ebab//l1/set , but that is obviously wrong as  
> it gives me this error:

I didn't check your flow but here you have 2 slashes `//` in the topic instead of one. Also based on the documentation you sent, I think the payload should be just `"ON"` or `"OFF`.

---

<div class="post-metadata">

**Author:** ![sapster77](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sapster77/32/14335_2.png) [@sapster77](https://discourse.nodered.org/u/sapster77)\
**Post date:** [14 July 2020 10:17 UTC](https://discourse.nodered.org/t/problem-with-zigbee2mqtt-out-node/30019/3 "2020-07-14T10:17:42Z")

</div>

Thanks a lot for your reply. The double slash was an error that I had already fixed, but the ON instead of "state":"ON" fixed it 🙂  
Thanks!

---

<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:** [28 July 2020 10:26 UTC](https://discourse.nodered.org/t/problem-with-zigbee2mqtt-out-node/30019/4 "2020-07-28T10:26:33Z")

</div>

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