# Zwave understanding

**URL:** <https://discourse.nodered.org/t/zwave-understanding/100808>\
**Category:** General\
**Created:** [20 April 2026 13:04 UTC](https://discourse.nodered.org/t/zwave-understanding/100808 "2026-04-20T13:04:23Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [20 April 2026 13:04 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/1 "2026-04-20T13:04:23Z")

</div>

I could really do with a bit of guidance please  
I have a Fibaro-101 push button  
When i press it twice i get the following

```auto
msg.payload : Object
object
event: "VALUE_NOTIFICATION"
timestamp: 20/04/2026, 13:53:45 [UTC+1]
nodeId: 24
nodeName: "Push Button"
nodeLocation: undefined
eventBody: object
valueId: object
commandClassName: "Central Scene"
commandClass: 91
property: "scene": "001"
propertyName: "scene"
propertyKeyName: "001"
value: 3

```

I have written a if statement to capture the value:3 but it doesn’t seem to work.

Any help would be appreciated

Many thanks  
Andrew

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [20 April 2026 13:11 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/2 "2026-04-20T13:11:15Z")

</div>

What happens if you use a switch node to compare msg.payload.value and (numeric) 3, the output connected to a debug node?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/e/debfeb127b3c9d09aa65ffe97c2bb14d196f3a48.png)

---

<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:** [20 April 2026 13:30 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/3 "2026-04-20T13:30:48Z")

</div>

Hard to help with limited info, showing us the if statement, and a proper output from the debug sidebar copy value, would make it clearer.

But guessing the value 3 would be in  
`msg.payload.eventBody.value`

There’s a great page in the docs ([Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)) that will explain how to use the debug panel to find the right path/value for any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [20 April 2026 13:36 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/4 "2026-04-20T13:36:23Z")

</div>

For **value\_notification**  
It’s **msg.payload.eventBody.value**

See below manual

> <https://github.com/zwave-js/node-red-contrib-zwave-js/blob/main/Event%20Manual.md>

As its value is only good at time of event for this event type. hence its neither **prevValue** or **newValue** 😁

Ie its not stateful

---

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [20 April 2026 23:43 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/5 "2026-04-20T23:43:13Z")

</div>

Hi  
I used the switch node which help me understand the concept.

Thank you for you help

Andrew

---

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [20 April 2026 23:44 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/6 "2026-04-20T23:44:51Z")

</div>

Hi  
I did not know the trick of the side bar it help me greatly

Thank you Andrew

---

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [20 April 2026 23:47 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/7 "2026-04-20T23:47:26Z")

</div>

Hi Marcus  
Yet again you helped me so thank you  
I do try and resolve issues but after a few hours of getting anywhere its time to call for help

Thanks again  
Andrew

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 April 2026 08:02 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/8 "2026-04-21T08:02:51Z")

</div>

> [@fogmajor](#):
>
> I did not know the trick of the side bar it help me greatly

I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You may well learn more useful stuff.

---

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [21 April 2026 11:21 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/9 "2026-04-21T11:21:40Z")

</div>

Thank you

---

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [21 April 2026 11:39 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/10 "2026-04-21T11:39:30Z")

</div>

![Screenshot 2026-04-21 at 12-29-06 Node-RED Flow 20](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/2/723c29776aaafea2ab2873db97db8b2aa6504ee7.png)  
This is my attempt  
Dependent off the number of presses from the Fibaro switch (2 for on - 3 for off)  
The function then calls the Shelly power plug and turns on/off

Function

Thank you for your help

```auto
if (msg.payload.eventBody.value == '3') {
    msg.payload = true;
}
else if (msg.payload.eventBody.value == '4'){
    msg.payload = false;

}

var onoff = msg.payload /*trigger*/

const _nodeId = 23; /* Target Node */
const _value = onoff; /* Value */

const _valueId = {
    "commandClassname": "Binary Switch",
    "commandClass": 37, /* Binary Class */
    "endpoint": 0, /* Target End point - The device might have 2 binary switches */
    "property": "targetValue", /* Property */
}

const Message = {
    payload: {
        cmd: {
            api: 'VALUE',
            method: 'setValue'
        },
        cmdProperties: {
            nodeId: _nodeId,
            valueId: _valueId,
            value: _value
        }
    }
}

return Message;

```

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [21 April 2026 11:47 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/12 "2026-04-21T11:47:42Z")

</div>

Sorry - ignore the above (now deleted)  
Yes that will work 👌

(I’m in work - so little chaotic 😁)

But the minimum for a Value ID only needs

- endpoint
- commandClass
- property
- propertyKey (sometimes - CC Dependant)

The other bits is just metadata

---

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [21 April 2026 12:13 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/13 "2026-04-21T12:13:29Z")

</div>

Hi Marcus  
Thank you for your help, It took me a while but i got there in the end

When you get a minute could you strip out what is unnecessary in my function?

Thank Andrew

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [21 April 2026 17:10 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/14 "2026-04-21T17:10:55Z")

</div>

Hi @fogmajor

What you have will work, but V11 aims to adhere to the "low code" nature of Node RED, so I should be a good teacher here really 😃

You can achieve the above with No `Function` Node in site, and making use of the new features.

**Just Select your Controller in the Device Nodes (might need to reselect the Fibaro Node)**

```auto
[{"id":"8019ba233b043ced","type":"zwavejs-device","z":"42a07040073c9b0e","name":"Fibaro-101","runtimeId":"","nodeMode":"Multiple","filteredNodeId":"24","dataMode":"R","outputs":1,"inputs":0,"x":230,"y":330,"wires":[["f51bf59441a7d8f0"]]},{"id":"f51bf59441a7d8f0","type":"zwavejs-splitter","z":"42a07040073c9b0e","name":"Filter To Central Scene Event","splits":[{"valueId":{"commandClassName":"Central Scene","commandClass":91,"endpoint":0,"property":"scene","propertyKey":"001","propertyName":"scene","propertyKeyName":"001"},"index":0,"name":"CENTRAL_SCENE.SCENE.001"}],"outputs":1,"x":320,"y":380,"wires":[["cf3e9bf0adc814a6"]]},{"id":"575db43b94cdf478","type":"zwavejs-factory","z":"42a07040073c9b0e","valueSetOptionsType":"json","valueSetOptions":"{}","valueType":"jsonata","value":"payload.eventBody.value = 3 ? true : false","valueIdType":"json","valueId":"{\"commandClass\":37,\"endpoint\":0,\"property\":\"targetValue\"}","argsType":"json","args":"[]","endpointType":"num","endpoint":0,"nodeIdType":"num","nodeId":"23","trackingIdType":"msg","trackingId":"id","name":"Create Binary Command","api":"VALUE","method":"setValue","commandClass":"","x":420,"y":470,"wires":[["917ae72f4947e849"]]},{"id":"cf3e9bf0adc814a6","type":"switch","z":"42a07040073c9b0e","name":"Value Between Between 3-4","property":"payload.eventBody.value","propertyType":"msg","rules":[{"t":"btwn","v":"3","vt":"num","v2":"4","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":430,"wires":[["575db43b94cdf478"]]},{"id":"917ae72f4947e849","type":"zwavejs-device","z":"42a07040073c9b0e","name":"Sonos-Kitchen-Power","runtimeId":"","nodeMode":"All","filteredNodeId":"","dataMode":"S","outputs":0,"inputs":1,"x":650,"y":470,"wires":[]}]

```

 ![Screenshot 2026-04-21 at 18.10.45](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/7/87a54a4717f7e07353014913807cca2e9c56fdb9.png)

This uses the power of the Event Splitter, Switch and CMD Factory Nodes (using JSONata)

---

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [26 April 2026 23:11 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/15 "2026-04-26T23:11:55Z")

</div>

Hi Again

I am trying to understand the different messages returned from various zwave devices  
The one i am struggling with is a Fibaro PIR. Is it possible to detect when the new value changes  
from 0 to 255 using a simple function to start with ?

Thank you in anticipation

```auto
object

event: "VALUE_UPDATED"

timestamp: 1777244644479

nodeId: 19

nodeName: undefined

nodeLocation: "Pir"

eventBody: object

valueId: object

newValue: 255

prevValue: 255

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [27 April 2026 06:10 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/16 "2026-04-27T06:10:54Z")

</div>

> [@fogmajor](#):
>
> Is it possible to detect when the new value changes  
> from 0 to 255 using a simple function

That does sound very simple to achieve in a function.

Since a function node does not retain knowledge of message contents once it has processed them you probably need to store msg.payload.newValue in context for comparison when the next message arrives.

One of the videos that @Colin pointed out covers context, but it perhaps goes into too much depth for a newcomer.

A couple of questions:

1. In the sample data you posted there is a key prevValue. Can you not compare this with newValue to spot the value change?
2. Are 0 and 255 the only possible values, or might newValue in successive messages be eg 0, 10, 100, 255?
3. Why do you seek to restrict our responses to the function node? Have you sufficiently explored the standard nodes?
4. What have you tried, and what problems did you encounter?

---

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [27 April 2026 11:34 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/17 "2026-04-27T11:34:36Z")

</div>

Hi and thank you for your prompt response.  
To answer your questions, I am a beginner when nodered is concerned and am learning the basics of zwave.  
I have a zwave stick (usb) AEOTEC and have set up the latest zwavejs with the help of Marcus.

I am trying to understand the messages that come from various zwave devices. I have been partially successful trying to understand the parts of messages.  
With respect to my current problem i try to extract the newValue and prevValue from a fibaro pir as my previous post but it returns undefined.

Thanks again Andrew

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [27 April 2026 13:42 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/18 "2026-04-27T13:42:03Z")

</div>

Use a debug node set to output the complete msg object

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/d/edb651ad9caa282d6d7a9054d1931bb6352ba1a9.png)

Send the VALUE\_UPDATED message from node-red-contrib-zwave-js to the debug node.

Use the "Copy value" button in the debug pane

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

And paste the data here.

---

<div class="post-metadata">

**Author:** ![fogmajor](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fogmajor](https://discourse.nodered.org/u/fogmajor)\
**Post date:** [27 April 2026 16:57 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/19 "2026-04-27T16:57:25Z")

</div>

Thank you it works a treat

---

<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 July 2026 16:57 UTC](https://discourse.nodered.org/t/zwave-understanding/100808/20 "2026-07-26T16:57:57Z")

</div>

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