Skip to content

Value API

Marcus Davies edited this page Apr 12, 2022 · 21 revisions

The Z-Wave JS Value API, is very much used to drive User Interfaces (as such, is used on the UI tab).
You can however, still use it via a message only protocol.

We recommend using this API as apposed to the CCAPI.

Important Note:
Values received from this API, are from a cache, and not directly from the device.
Of course the cache itself, is updated as and when Z-Wave devices send updates.

The Value API works with ValueID's. These ID's are not numerical ID's
They are objects, that uniquely identify to what CC, Endpoint and Property a value belongs to.

You can obtain a ValueID for a property by double clicking the property title in the UI.

getDefinedValueIDs

Get the list of ValueIDs for a Node.

let Message = {
    "payload": {
        "mode": "ValueAPI",
        "node": 2,
        "method": "getDefinedValueIDs",
    }
}
return Message

getValueMetadata

Get the metadata/structure of a Value.

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

setValue

Sets a Value.

let Message = {
    "payload": {
        "mode": "ValueAPI",
        "node": 2,
        "method": "setValue",
        "params": [<ValueID>,<Value>]
    }
}
return Message

setValue (With options)

Sets a Value, whilst adding some behavioural properties to it.

let Options = {
    transitionDuration:"1m10s", // Multilevel Switch
    volume: 30 // Sound Switch
}
let Message = {
    "payload": {
        "mode": "ValueAPI",
        "node": 2,
        "method": "setValue",
        "params": [<ValueID>,<Value>,Options]
    }
}
return Message

getValue

Obtains a Value.

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

pollValue

Poll the device, causing a Cached Value to be updated.

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