Skip to content

Value API

Marcus Davies edited this page Jul 14, 2021 · 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.

It's a little more involved, and is generally not as straight forward to use. One benefit however, is that it confirms that Values are actually updated.

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 device send updates.

getDefinedValueIDs

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

getValueMetadata

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

setValue

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

setValue (With options)

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

getValue

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

pollValue

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