Interrogating z wave thermostat using node-red-contrib-zwave-js

Hi i am using the Zwave JS node.
I am trying to get the "Air temperature" from the configuration file for the Secure SRT321 thermostat,
just not sure how to interrogate the Zwave data to obtain it? i want to move it into msg.payload . I can view it in the configuration file in the Zwave JS UI. i can see it is CommandClass Multilever Sensor.

Thanks for any help :slight_smile:

Hi @magicman,

In the UI, double click the title for Air temperature - this will give you a ValueID (copy it)

Then,
Send the below to the controller node or a device-node - depending on your setup.
You will get a response on the other end - for which you can do as you please.

The event type will be GET_VALUE_RESPONSE
The value can be found at msg.payload.object.response

The device does not have to be awake, its taken from the last known values, which is updated when your device sends any updates.

A Value ID represents, what command class, endpoint and a property a value is located.
Example: swapping Air temperature for Illuminance will give you the lux value from the sensor
(if its supported)

You can also use the cmd factory to do the same thing, below is assuming the use of a function node.

const MyValueID = {
      "commandClassName": "Multilevel Sensor",
      "commandClass": 49,
      "endpoint": 0,
      "property": "Air temperature",
      "propertyName": "Air temperature"
}

const Message = {
    "payload": {
        "mode": "ValueAPI",
        "node": 6,
        "method": "getValue",
        "params": [MyValueID]
    }
}
return Message

Value API Wiki (as well as the others)

1 Like

I have taken the liberty if demoing the CMD Factory and Event Filter nodes.
see the exported flow.

[{"id":"ce4f8243d5fb07ee","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"9de7d0266b6a6386","type":"cmd-factory","z":"ce4f8243d5fb07ee","name":"ZWave CMD Factory","node":"node","endpoint":"","cc":"Select Command Class","method":"Select Method","params":"payload","noEvent":false,"forceUpdate":"forceUpdate","api":"ValueAPI","vapiMode":"getValue","vapiValue":"","vapiValueId":"ValueToFetch","vapiOptions":"","x":600,"y":340,"wires":[["a634a8eabf2560b6"]]},{"id":"613527d7c5989bcf","type":"function","z":"ce4f8243d5fb07ee","name":"Set Command Properties","func":"msg.ValueToFetch = {\n    \"commandClassName\": \"Multilevel Sensor\",\n    \"commandClass\": 49,\n    \"endpoint\": 0,\n    \"property\": \"Air temperature\",\n    \"propertyName\": \"Air temperature\"\n}\nmsg.node = 4\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":470,"y":280,"wires":[["9de7d0266b6a6386"]]},{"id":"801c6ffbfb33931d","type":"inject","z":"ce4f8243d5fb07ee","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":440,"y":220,"wires":[["613527d7c5989bcf"]]},{"id":"a634a8eabf2560b6","type":"debug","z":"ce4f8243d5fb07ee","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":340,"wires":[]},{"id":"a782d6cf8313799c","type":"comment","z":"ce4f8243d5fb07ee","name":"Connect here a device node or controller node","info":"","x":380,"y":540,"wires":[]},{"id":"4e510edf71d6dc37","type":"event-filter","z":"ce4f8243d5fb07ee","name":"Split Value Changes","filters":[{"index":0,"name":"Air Temp Changes","valueIds":[{"commandClassName":"Multilevel Sensor","commandClass":49,"endpoint":0,"property":"Air temperature","propertyName":"Air temperature"}],"events":["VALUE_UPDATED","GET_VALUE_RESPONSE"],"strict":false,"id":"186827","_id":0},{"index":1,"name":"Illuminance Chnages","valueIds":[{"commandClassName":"Multilevel Sensor","commandClass":49,"endpoint":0,"property":"Illuminance","propertyName":"Illuminance"}],"events":["VALUE_UPDATED","GET_VALUE_RESPONSE"],"strict":false,"id":"228397","_id":1}],"outputs":2,"changeDate":"2022-01-09T11:08:50.673Z","x":600,"y":500,"wires":[["3291d428ae7db96f"],["f0e455876fd2d507"]]},{"id":"f0e455876fd2d507","type":"debug","z":"ce4f8243d5fb07ee","name":"This wire carries Illuminance changes","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":950,"y":520,"wires":[]},{"id":"3291d428ae7db96f","type":"debug","z":"ce4f8243d5fb07ee","name":"This wire carries Ait Temp changes","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":940,"y":480,"wires":[]},{"id":"ccf534b4444cd3bc","type":"comment","z":"ce4f8243d5fb07ee","name":"Connect here a device node or controller node","info":"","x":980,"y":300,"wires":[]}]

Thank you so much @marcus-j-davies i will look at it as soon as i can, thanks for your time again :slight_smile:

every day is a school day! thank you so much @marcus-j-davies

hi @marcus-j-davies thanks for your help.

I am now interrogating values using the functions etc you pointed me to and it is working but the values are cached values and therefore not "live data". is there any way i can make the unit give live data? i am assuming i need to wake it? or is there an easier way?
hope you understand what i am trying to say?

thanks again @magicman

hi @marcus-j-davies
i found this shortly after the first message but not sure how to use it :slight_smile:

pollValue
Poll the device, causing a Cached Value to be updated.
Note: The ValueID is an object, and not a numerical value.

let Message = {
    "payload": {
        "mode": "ValueAPI",
        "node": 2,
        "method": "pollValue",
        "params": [<ValueID>]`Preformatted text`
    }
}
return Message

Blockquote

Hi @magicman,

The cache is updated everytime your devices send an update.
getValue will always return the latest information.

pollValue just forces it to get updated - 99.9999% of the time it is unnecessary.
pollValue will indeed need the device to be awake (hence the poll will be queued)

I think thermos don't actually sleep - as they need to receive new set points pretty instantly - I could be wrong.

use getValue - it will be current, and doesn't need things to be awake.

image

Also note.
When your devices do send an update, not only is the cache updated - but you will get a message into your flow with an event of VALUE_UPDATED

:wink:

thanks @marcus-j-davies i am still working with the filter node and it seemed the temperature values were delayed but was my flow not the z wave.node.

Thanks again

Hi @magicman,

The nodes zwave-device, cmd-factory, and event-filter put together can conjure a very potent mix, and help design some really clean and powerful automation.

the module is more of a zwave framework (a toolkit almost) - with great power comes great responsibility :wink: