Class: ZigBeeDevice

ZigBeeDevice()

new ZigBeeDevice()

Extends

Members

energyMap

Stub getter, can be overriden by subclass to provide energy properties per zb_product_id.

Example
class DimmableBulb extends ZigBeeDevice {
	    get energyMap() {
			return {
				'TRADFRI bulb E14 W op/ch 400lm': {
					approximation: {
						usageOff: 0,
						usageOn: 10
					}
				}
			}
		}
	}

Methods

disableDebug()

Disable debugging to the console

Inherited From:

enableDebug()

Enable debugging to the console

Inherited From:

getClusterEndpoint(clusterName)

Method that searches for the first occurrence of a clusterName in a device's endpoints and returns the endpoint id.

Parameters:
Name Type Description
clusterName string

onDeleted()

Remove all listeners and intervals from node

Inherited From:

printNode()

Print the current Node information with Endpoints and Clusters

(async) registerAttrReportListener(clusterId, attrId, minInt, maxInt, repChange, triggerFn, endpointIdopt) → {Promise}

Register an attribute report listener, which is called when a report has been received for the provided endpoint cluster and attribute combination.

Parameters:
Name Type Attributes Default Description
clusterId string

The ID of the cluster (e.g. genBasic)

attrId string

The ID of the attribute (e.g. onOff)

minInt number

The minimal reporting interval in seconds (e.g. 10 (seconds))

maxInt number

The maximal reporting interval in seconds (e.g. 300 (seconds))

repChange number null

Reportable change; the attribute should report its value when the value is changed more than this setting, for attributes of analog data type this argument is mandatory.

triggerFn function

Function that will be called when attribute report data is received

endpointId number <optional>
0

The endpoint index (e.g. 0)

Returns:

Resolves if configuration succeeded

Type
Promise

registerCapability(capabilityId, clusterId, userOptsopt)

Register a Homey Capability with a Cluster.

Parameters:
Name Type Attributes Description
capabilityId string

The Homey capability id (e.g. onoff)

clusterId string

The Cluster id (e.g. genBasic)

userOpts Object <optional>

The object with options for this capability/cluster combination. These will extend system options, if available (/lib/zigbee/system/)

Properties
Name Type Attributes Default Description
get string <optional>

The command to get a value (e.g. onOff)

getParser string <optional>

The function that is called when a GET request is made. Should return an Object.

getOpts Object
Properties
Name Type Attributes Description
getOnStart Boolean <optional>

Get the value on App start

getOnOnline Boolean <optional>

Get the value when the device is marked as online

pollInterval Number | string <optional>

Interval (in ms) to poll with a GET request. When provided a string, the device's setting with the string as ID will be used (e.g. poll_interval)

set string <optional>

The command to set a value (e.g. on)

setParser function <optional>

The function that is called when a SET request is made. Should return an Object.

Properties
Name Type Attributes Description
value * <optional>

The value of the Homey capability

opts Object <optional>

Options for the capability command

report string <optional>

The command to report a value (e.g. onOff)

reportParser function <optional>

The function that is called when a REPORT request is made. Should return an Object.

Properties
Name Type Attributes Description
report Object <optional>

The report object

endpoint number <optional>
0

An index to identify the endpoint to use for this capability

registerMultipleCapabilities(capabilitiesOpts, fn)

Register multiple Homey Capabilities with a Cluster. When a capability is changed, the event will be debounced with the other capabilities in the capabilitiesOpts array.

Parameters:
Name Type Description
capabilitiesOpts Array.<Object>
Properties
Name Type Attributes Description
capability string
cluster string
opts Object <optional>

The object with options for this capability/cluster combination. These will extend system options, if available (/lib/zigbee/system/)

Properties
Name Type Attributes Default Description
get string <optional>

The command to get a value (e.g. onOff)

getParser string <optional>

The function that is called when a GET request is made. Should return an Object.

getOpts Object <optional>
Properties
Name Type Attributes Description
getOnStart Boolean <optional>

Get the value on App start

getOnOnline Boolean <optional>

Get the value when the device is marked as online

pollInterval Number | string <optional>

Interval to poll with a GET request. When provided a string, the device's setting with the string as ID will be used (e.g. poll_interval)

set string <optional>

The command to set a value (e.g. on)

setParser function <optional>

The function that is called when a SET request is made. Should return an Object.

Properties
Name Type Attributes Description
value * <optional>

The value of the Homey capability

opts Object <optional>

Options for the capability command

report string <optional>

The command to report a value (e.g. onOff)

reportParser function <optional>

The function that is called when a REPORT request is made. Should return an Object.

Properties
Name Type Attributes Description
report Object <optional>

The report object

endpoint number <optional>
0

An index to identify the endpoint to use for this capability

fn function

registerReportListener(clusterId, commandId, triggerFn, endpointIdopt)

Register a endpoint command listener, which is called when a command has been received from the provided endpoint cluster combination.

Parameters:
Name Type Attributes Default Description
clusterId string

The ID of the cluster (e.g. genBasic)

commandId string

The ID of the Command (e.g. onOff)

triggerFn function
Properties
Name Type Description
rawReport Object

The raw report

parsedReport Object

The parsed report (parsed by the first available reportParser method)

endpointId number <optional>
0

The endpoint index (e.g. 0)