The package name of this class is zigbee
. So, to use in an app or driver you, would reference it with zigbee
, e.g., zigbee.on()
.
Return ZHA cluster information.
ZigbeeCluster clusterLookup(int value)
ZigbeeCluster clusterLookup(String value)
value
- the integer value to lookup value or the hex string value to lookup
ZigbeeCluster
- Cluster entry, null
if no matching entry found.
def zbc = zigbee.clusterLookup(0x0006)
def zbc = zigbee.clusterLookup("0x0006")
def zbc = zigbee.clusterLookup("0006")
zbc == ON_OFF_CLUSTER
zbc.clusterEnum == ON_OFF_CLUSTER
zbc.clusterLabel == On/Off
zbc.clusterInt == 6
Generates a Zigbee command string based on the specified parameters.
List<String> command(Integer cluster, Integer command, Map additionalParams, int delay = STANDARD_DELAY_INT, String... payload)
List<String> command(Integer cluster, Integer command, String... payload)
cluster
- The Zigbee cluster IDcommand
- The Zigbee command IDadditionalParams
- Optional Map specifying additional parameters, any of:
destEndpoint
- Destination endpoint for messagemfgCode
- Manufacturer specific codedelay
- Optional milliseconds of delay after commandpayload
- Optional hex string in little-endian format of appropriate width for data typeA Zigbee command string (suitable for use in a HubMultiAction
, returning from a command method implementation, etc.) based on the parameters provided. For example, zigbee.command(0x0006, 0x01)
would return a string similar to "he cmd 0x${device.deviceNetworkId} 0x${device.endpointId} 0x0006 1 {}"
(where the variables have been substituted with their actual values). This itself would be similar to zigbee.on()
.
// turn on:
zigbee.command(0x0006, 0x01)
// set level to max (0xFE) with 2-second (0x0002) transition time:
zigbee.command(0x0008, 0x04, "FE", "0200")
// turn off endpoint 2:
zigbee.command(0x006, 0x00, [destEndpoint: 2])
Generate the on command for the on/off Zigbee cluster
Signature
List<String> on()
List<String> on(int delay)
Parameters
delay
- the number of milliseconds to delay after sending the command; if omitted then the standard delay of 2000ms is used.
Returns
List<String>
- a list of Zigbee commands to be sent to the device
Example
def cmds = zigbee.on(200)
Generate the off command for the on/off Zigbee cluster
List<String> off()
List<String> off(int delay)
delay
- the number of milliseconds to delay after sending the command; if omitted then the standard delay of 2000ms is used.
List<String>
- a list of Zigbee commands to be sent to the device
def cmds = zigbee.off(500)
Generate the on command for the on/off ZigBee cluster for a group
List<String> groupOn(Integer groupID)
List<String> groupOn(Integer groupID, int delay)
delay
- the number of milliseconds to delay after sending the command; if omitted then the standard delay of 2000ms is used.
List
- a list of Zigbee commands to be sent to the group
def cmds = zigbee.groupOn(0x0202, 200)
Generate the off command for the on/off ZigBee cluster for a group
List<String> groupOff(Integer groupID)
List<String> groupOff(Integer groupID, int delay)
delay
- the number of milliseconds to delay after sending the command; if omitted then the standard delay of 2000ms is used.
List<String>
- a list of Zigbee commands to be sent to the group
def cmds = zigbee.groupOff(0x0156, 300)
Parse a Zigbee message into a Map
. This method currently handles messages that start with “catchall” or “read attr”.
Map parseDescriptionAsMap(String description)
description
- the Zigbee message to parse.
Map
- a Map
of key/value pairs that have been parsed from the Zigbee message.
def msgMap = zigbee.parseDescriptionAsMap("catchall: 0104 0008 0A 01 0140 00 1A67 00 00 0000 0B 01 0400")
Generates a Zigbee read attribute command.
List<String> readAttribute(Integer cluster, Integer attributeId, Map additionalParams = [:], int delay = STANDARD_DELAY_INT)
List<String> readAttribute(Integer cluster, List<Integer> attributeIds, Map additionalParams = [:], int delay = STANDARD_DELAY_INT)
cluster
- Zigbee cluster IDattributeId
or attributeIDs
- Attribute ID or list of attribute IDs (can be used if reading multiple attributes from same cluster)additionalParams
- as specified for zigbee.command()
delay
- the number of milliseconds to delay after sending the command; if omitted then the standard delay of 2000ms is used.List of Zigbee commands formatted based on the specified parameters.
zigbee.readAttribute(0x0006, 0x0000) // fetch on/off state
zigbee.readAttribute(0x0008, 0x0000, [destEndpoint: 2], 0) // fetch level for endpoint 2
Generates a Zigbee write attribute command.
List writeAttribute(Integer cluster, Integer attributeId, Integer dataType, Integer value, Map additionalParams = [:], int delay = STANDARD_DELAY_INT)
cluster
- Zigbee cluster IDattributeId
- Attribute IDdataType
- The Zigbee data type (ultimately the numeric value per the ZCL specification, though com.hubitat.zcl.DataType
offers easy-to-use equivalents like UINT8
, BOOLEAN
, or INT24
)additionalParams
- as specified for zigbee.command()
delay
- the number of milliseconds to delay after sending the command; if omitted then the standard delay of 2000ms is used.List of Zigbee commands formatted based on the specified parameters.
// where MFR_CUSTOM_CLUSTER is a manufacturer custom cluster and MFR_MFG_CODE is
// the manufacturing code, both defined elsewhere: writes 0x01 to attribute 0x05 of
// unsigned 8-bit integer type on endpoint 2 with no delay after
zigbee.writeAttribute(MFR_CUSTOM_CLUSTER, 0x05, com.hubitat.zigbee.DataType.UINT8,
0x01, [destEndpoint: 2, mfgCode: MFR_MFG_CODE], 0)
List writeAttribute(Integer cluster, Integer attributeId, Integer dataType, Integer value, Map additionalParams = [:], int delay = STANDARD_DELAY_INT)
List onOffConfig()
List onOffConfig(Integer minRefreshInterval, Integer maxRefreshInterval)
List levelRefresh()
List levelRefresh(int delay)
List levelConfig()
List colorTemperatureRefresh()
List colorTemperatureRefresh(int delay)
List colorTemperatureConfig()
List batteryConfig()
List refreshData(String attr1, String attr2)
List electricMeasurementPowerRefresh(int delay = STANDARD_DELAY_INT)
List setColorTemperature(BigDecimal value, int delay = STANDARD_DELAY_INT)
List setColorTemperature(String value ,int delay = STANDARD_DELAY_INT)
List setColorTemperature(Integer value, int delay = STANDARD_DELAY_INT)
List setGroupColorTemperature(Integer groupID, BigDecimal value, int delay = STANDARD_DELAY_INT)
List setGroupColorTemperature(Integer groupID, String value, int delay = STANDARD_DELAY_INT)
List setGroupColorTemperature(Integer groupID, Integer value, int delay = STANDARD_DELAY_INT)
List setSaturation(Integer value, int delay = STANDARD_DELAY_INT)
List setHue(Integer value, int delay = STANDARD_DELAY_INT)
List setColor(Map value, int delay = STANDARD_DELAY_INT)
List setLevel(BigDecimal level)
List setLevel(Integer level, Integer rate = 0xFFFF)
List setLevel(Integer level, Integer rate = 0xFFFF)
List setGroupLevel(Integer groupID, BigDecimal level)
List setGroupLevel(Integer groupID, Integer level)
List setGroupLevel(Integer groupID, BigDecimal level, BigDecimal rate)
List setGroupLevel(Integer groupID, Integer level, Integer rate)
List temperatureConfig()
List temperatureConfig(Integer minRefreshInterval, Integer maxRefreshInterval)
List configureReporting(Integer clusterId, Integer attributeId, Integer dataType, Integer minReportTime, Integer maxReportTime, Integer reportableChange = null, Map additionalParams=[:], int delay = STANDARD_DELAY_INT)
List enrollResponse()
Map getEvent(String description)
Map getKnownDescription(String description)
ZoneStatus parseZoneStatus(String description)
SmartShield parse(String description)
String convertToHexString(Integer value, Integer width)
Integer convertHexToInt(String value)
String hex2String(String arg)
String swapOctets(String bytes)