# Zigbeetasmota sensor not working

**URL:** <https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080>\
**Category:** Developing Nodes\
**Created:** [22 May 2021 07:29 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080 "2021-05-22T07:29:42Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![jepe63](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jepe63](https://discourse.nodered.org/u/jepe63)\
**Post date:** [22 May 2021 07:29 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/1 "2021-05-22T07:29:42Z")

</div>

Hi All , this is driving me crazy for a day now , should be simpel , but can't get it to work  
I'm trying my Zigbee sensor to give a simple message if it is closed or open.Probably i'm doing something wrong 🙂 Please direct me in the correct direction before i lose all my hair 😉

 ![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/d/8def65bf7d6386fbc47cd1d32bae42146b48f0d0.png)  
[http://www.midesign.be/zigbee\_flows.json](http://www.midesign.be/zigbee_flows.json)

PS: trying to figure out how to place my files here so bear with me

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 May 2021 08:11 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/2 "2021-05-22T08:11:14Z")

</div>

> [@jepe63](#):
>
> I'm trying my Zigbee sensor to give a simple message if it is closed or open

Hi,

Firstly, dont use JSONata for a simple number compare (unnecessary processing) - use a number  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/6/06925bf2218ce0ea9370617f7580f54acb0416ff.png)

Secondly, there is no need for a separate JSON node (set the MQTT to return a parsed object)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/f/7f1c86acba467b765baeba4831341e96ff01732e.png)

Lastly, your output debug nodes are set to look at `msg.Open` and `msg.Dicht` - these properties do not exist in your message.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 May 2021 08:12 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/3 "2021-05-22T08:12:13Z")

</div>

> [@jepe63](#):
>
> PS: trying to figure out how to place my files here so bear with me

Paste code / flow into your reply. Surround your code with three backticks  
`````  
`like this`  
`````

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![jepe63](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jepe63](https://discourse.nodered.org/u/jepe63)\
**Post date:** [22 May 2021 08:26 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/4 "2021-05-22T08:26:10Z")

</div>

> [@Steve-Mcl](#):
>
> ```auto
> 
> ```

```auto
[{"id":"1bb49c42.6eb8e4","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"213bd662.a9417a","type":"mqtt in","z":"1bb49c42.6eb8e4","name":"Zigbee Sensor","topic":"tele/ZigbeeBridge/SENSOR","qos":"2","datatype":"json","broker":"11f388b0.3a1d17","nl":false,"rap":true,"rh":0,"x":100,"y":300,"wires":[["bec711dd.04984","78f992a0.2f444c"]]},{"id":"bec711dd.04984","type":"switch","z":"1bb49c42.6eb8e4","name":"Open or Closed","property":"payload.ZbReceived[\"0xEAF9\"].Contact","propertyType":"jsonata","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":260,"y":160,"wires":[["66564a87.12f064"],["b8cb4a8e.f004b8"]]},{"id":"78f992a0.2f444c","type":"debug","z":"1bb49c42.6eb8e4","name":"","active":false,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":280,"y":400,"wires":[]},{"id":"66564a87.12f064","type":"debug","z":"1bb49c42.6eb8e4","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":490,"y":100,"wires":[]},{"id":"b8cb4a8e.f004b8","type":"debug","z":"1bb49c42.6eb8e4","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":500,"y":220,"wires":[]},{"id":"11f388b0.3a1d17","type":"mqtt-broker","name":"Domoticz master","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"anything","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

```

---

<div class="post-metadata">

**Author:** ![jepe63](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jepe63](https://discourse.nodered.org/u/jepe63)\
**Post date:** [22 May 2021 08:26 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/5 "2021-05-22T08:26:43Z")

</div>

unfortunally , gives the same, no output...

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 May 2021 08:31 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/6 "2021-05-22T08:31:12Z")

</div>

Without a copy of a sample payload, i cannot help.

Copy the output of the MQTT node (using copy value button)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/9/89ffdb9bbd2e4b3c2258d3af49c74523ae84b88e.png)

paste it in a reply (inside backticks)

---

<div class="post-metadata">

**Author:** ![jepe63](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jepe63](https://discourse.nodered.org/u/jepe63)\
**Post date:** [22 May 2021 08:31 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/7 "2021-05-22T08:31:23Z")

</div>

> [@Steve-Mcl](#):
>
> Lastly, your output debug nodes are set to look at `msg.Open` and `msg.Dicht` - these properties do not exist in your message.

Changed it ot just msg.payload, but nothing comes trough

---

<div class="post-metadata">

**Author:** ![jepe63](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jepe63](https://discourse.nodered.org/u/jepe63)\
**Post date:** [22 May 2021 08:36 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/8 "2021-05-22T08:36:13Z")

</div>

> [@Steve-Mcl](#):
>
> ```auto
> `like this`
> 
> ```

```auto
{"ZbReceived":{"0xEAF9":{"Device":"0xEAF9","Name":" Deurcontact Achterdeur","0500<00":"010000010000","ZoneStatusChange":1,"ZoneStatusChangeZone":1,"Contact":1,"Endpoint":1,"LinkQuality":139}}}

```

It's the Contact i'm trying to capture...

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 May 2021 08:42 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/9 "2021-05-22T08:42:29Z")

</div>

![ofmFqUP8t6](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/9/69eabf26c07aa37492f7508c1eff0e632d3f31c8.gif)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [22 May 2021 09:05 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/10 "2021-05-22T09:05:37Z")

</div>

Hi, just for info the JSONata expression would be  
`payload.ZbReceived.*.Contact` for any device  
`payload.ZbReceived.'0xEAF9'.Contact` for the named device, back ticks or quotes.  
But as Steve points out there is no need to call JSONata as msg will be fine

---

<div class="post-metadata">

**Author:** ![jepe63](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jepe63](https://discourse.nodered.org/u/jepe63)\
**Post date:** [22 May 2021 12:43 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/11 "2021-05-22T12:43:29Z")

</div>

Thx, tought that i tried it already like this , but it's WORKING!

👍 👊 💪

---

<div class="post-metadata">

**Author:** ![jepe63](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jepe63](https://discourse.nodered.org/u/jepe63)\
**Post date:** [22 May 2021 13:07 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/12 "2021-05-22T13:07:07Z")

</div>

New question about new button , this one gives a response on a click , but the object name changes from 0006!02 for a click, 0006!01 for a double click and 0006!00 for a long click , but the value is always "" (empty) , so how do i do this ?

```auto
tele/ZigbeeBridge/SENSOR = {"ZbReceived":{"0x9A61":{"Device":"0x9A61","Name":" Schakelaar Rolluiken","0006!02":"","Power":2,"Endpoint":1,"LinkQuality":131}}}
tele/ZigbeeBridge/SENSOR = {"ZbReceived":{"0x9A61":{"Device":"0x9A61","Name":" Schakelaar Rolluiken","0006!01":"","Power":1,"Endpoint":1,"LinkQuality":120}}}
tele/ZigbeeBridge/SENSOR = {"ZbReceived":{"0x9A61":{"Device":"0x9A61","Name":" Schakelaar Rolluiken","0006!00":"","Power":0,"Endpoint":1,"LinkQuality":120}}}

```

EDIT: SOLVED: there is a value 'is empty' , so this worked, was to fast to post 😌

---

<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:** [5 June 2021 13:08 UTC](https://discourse.nodered.org/t/zigbeetasmota-sensor-not-working/46080/13 "2021-06-05T13:08:06Z")

</div>

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