Skip to content

Controller API

Marcus Davies edited this page Aug 6, 2021 · 36 revisions

The Controller API, is used for network wide operations, but offers some utility methods also.
Its responsible for starting or stopping an Inclusion process for an example, as well as healing your network.

beginFirmwareUpdate

Update the Firmware for a ZWave Device

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "beginFirmwareUpdate",
        params: [<NodeID>, <TargetChipID>, <FileName>, <DataBuffer>]
    }
}
return Message

abortFirmwareUpdate

Aborts a firmware update

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "abortFirmwareUpdate",
        params: [<NodeID>]
    }
}
return Message

getRFRegion

Obtains the RF Region of your USB Stick

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "getRFRegion"
    }
}
return Message

setRFRegion

Sets the RF Region of your USB Stick.
Go Here for a list of regions

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "setRFRegion",
        params: ["Europe"]
    }
}
return Message

toggleRF

Turns on or off the usb Radio

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "toggleRF",
        params: [true]
    }
}
return Message

getNodes

Fetches a list of all nodes

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "getNodes"
    }
}
return Message

keepNodeAwake

Keeps a node awake, until it's been allowed to fall back to sleep.
Remember to switch back to false, else you could drain the battery of your device

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "keepNodeAwake",
        params: [<NodeID>, true | false]
    }
}
return Message

getNodeNeighbors

Returns the reported Neighbors, for a node as reported by the controller

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "getNodeNeighbors",
        params: [<NodeID>]
    }
}
return Message

setNodeName

Sets the name of a node.
If the Node supports the Node Naming and Location CC, the value is also written to the device

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "setNodeName",
        params: [<NodeID>,'Some Name']
    }
}
return Message

setNodeLocation

Sets the location of the node
If the Node supports the Node Naming and Location CC, the value is also written to the device

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "setNodeLocation",
        params: [<NodeID>,'Some Location']
    }
}
return Message

refreshInfo

Re-interviews a z-wave device

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "refreshInfo",
        params: [<NodeID>]
    }
}
return Message

hardReset

Resets your USB Z-Wave stick

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "hardReset"
    }
}
return Message

beginHealingNetwork

Start a network wide heal

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "beginHealingNetwork"
    }
}
return Message

stopHealingNetwork

Stops a network heal that is in progress.

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "stopHealingNetwork"
    }
}
return Message

removeFailedNode

Removes a no longer communicating node from the network

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "removeFailedNode",
        params: [<NodeID>]
    }
}
return Message

replaceFailedNode

Replaces a no longer communicating node from the network.
The 2nd parameter states if the inclusion process for the replacement node, will be non secure,
if not provided - inclusion will be attempted in secure mode.

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "replaceFailedNode",
        params: [<NodeID>, true]
    }
}
return Message

beginInclusion

Begins an inclusion process The parameter states if the inclusion process for the new node, will be non secure,
if not provided - inclusion will be attempted in secure mode.

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "beginInclusion",
        params: [true]
    }
}
return Message

stopInclusion

Stop an inclusion process

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "stopInclusion"
    }
}
return Message

beginExclusion

Begins an exclusion process

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "beginExclusion"
    }
}
return Message

stopExclusion

Stop an exclusion process

let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "stopExclusion"
    }
}
return Message

proprietaryFunction

Some controllers have proprietary functions built in.
One example is to disable the LED on the Aeotec Gen5 Z Stick.

The first argument is the manufacture function ID, and the 2nd is the data portion for that request.
As an example, the byte array -> [0x01, 0x08, 0x00, 0xF2, 0x51, 0x01, 0x00, 0x05, 0x01, 0x51]
disables the LED on the GEN 5 Z-Stick, breaking it down we have the following Z-Wave serial API payload:

0x01 - SOF 0x08 - Total Length
0x00 - REQ
0xF2 - Aeotec Set Configuration Function
0x51 - LED Configuration
0x01 - Configuration Value Size
0x00 - Value
0x05 - ??
0x01 - ??
0x51 - Serial API Checksum

This means we do:

/* 
┌ Serial API Stuff
| 0x01 - SOF 0x08 - Total Length
| 0x00 - REQ
| 0xF2 - Aeotec Set Configuration Function
└ Serial API Stuff
┌ User Request Data
| 0x51 - LED Configuration
| 0x01 - Configuration Value Size
| 0x00 - Value
| 0x05 - ??
| 0x01 - ??
└ User Request Data
┌ Serial API Stuff
| 0x51 - Serial API Checksum
└ Serial API Stuff
*/
let OffBufferData = Buffer.from([0x51, 0x01, 0x00, 0x05, 0x01]) /* User Request Data */
let Message = {
    payload: {
        mode: "ControllerAPI",
        method: "proprietaryFunction",
        params: [0xF2, OffBufferData]
    }
}
return Message

SOF, Total Length, REQ & the Serial API Checksum will be provided for you.