The zwave object is available in drivers and is used to create and parse Z-Wave commands.
For each supported Z-Wave command class and version, the zwave object has a property (or, equivalently, a getXxxVn() method) that returns an object for creating commands of that class and version. The property name is the command class name with the first letter in lower case, followed by V and the version number. For example, zwave.basicV1.basicSet(value: 0xFF) is the same as new hubitat.zwave.commands.basicv1.BasicSet(value: 0xFF), and zwave.switchMultilevelV3 (or zwave.getSwitchMultilevelV3()) gives access to the commands of version 3 of the Switch Multilevel command class.
The available command classes, commands, and their parameters are listed in Z-Wave Classes.
Parses a Z-Wave command description (as received by the driver's parse() method) into a command object.
Command parse(String description)Command parse(String description, Map options, boolean dropMulticast = false)Command parse(String description, boolean dropMulticast)description - The command description textoptions - Optional; a Map of command class identifiers to the version of that command class to use, e.g., [0x20: 1, 0x25: 1]dropMulticast - Optional; if true, a description marked as multicast produces no command. Defaults to false.The parsed command (Command), or null if the description is filtered or no command is present or recognized
def cmd = zwave.parse(description, [0x20: 1, 0x25: 1])
if (cmd) {
zwaveEvent(cmd)
}
Returns a zwave object given the commandClass, command and an optional version.
Command getCommand(Short commandClass, Short command, List<Short> payload, Integer version = null)Command getCommand(byte commandClass, byte command, byte[] payload, Integer version = null) (with the payload as a byte[])commandClass - The command class identifier (its low byte is used for the lookup)command - The command identifier (its low byte is used for the lookup)payload - A list of the payload byte valuesversion - Optional; the command class version to use for the lookup. If null, the default lookup behavior is used.Command - The matching command object, or null if the command class is not registered
def zwaveEvent(hubitat.zwave.commands.crc16encapv1.Crc16Encap cmd) {
def encapsulatedCommand = zwave.getCommand(cmd.commandClass, cmd.command, cmd.data,1)
if (encapsulatedCommand) {
zwaveEvent(encapsulatedCommand)
} else {
log.warn "Unable to extract CRC16 command from ${cmd}"
}
}