Constructor
new ZwaveMeteringDevice()
Example
// device.js
const ZwaveMeteringDevice = require('homey-meshdriver').ZwaveMeteringDevice;
class myDevice extends ZwaveMeteringDevice {
async onMeshInit() {
await super.onMeshInit();
this.registerCapability('measure_power', 'METER');
this.registerCapability('meter_power', 'METER');
}
}
Extends
Methods
(async) configurationGet(options) → {*}
Method that retrieves the value of a configuration parameter from the node.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Inherited From:
Returns:
- Type
- *
(async) configurationSet(options, value) → {Promise.<*>}
Wrapper for CONFIGURATION_SET. Provide options.id and/or options.index and options.size. By default options.useSettingParser is true, then the value will first be parsed by the registered setting parser or the system parser before sending. It will only be able to use the registered setting parser if options.id is provided.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Properties
|
|||||||||||||||||||||||||||||||
value |
- Inherited From:
Returns:
- Type
- Promise.<*>
disableDebug()
Disable debugging to the console
- Inherited From:
enableDebug()
Enable debug logging on this device. Logs all incoming reports.
- Inherited From:
(async) executeCapabilitySetCommand(capabilityId, commandClassId, value, opts) → {Promise.<(string|*)>}
This method executes the capability set command for a given capability/commandClass combination. The capability and commandClass must be registered before this method is called.
Parameters:
Name | Type | Description |
---|---|---|
capabilityId |
string | |
commandClassId |
string | |
value |
Mixed | the capability value to set (e.g 0 - 1 for dim) |
opts |
Object | capability options object |
- Inherited From:
Returns:
- Type
- Promise.<(string|*)>
getCommandClass(commandClassId, opts) → {Error|boolean|*}
Method that gets a CommandClass object by commandClassId. Optionally, it can get the object on a multichannel node if the multiChannelNodeId is provided.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
commandClassId |
String | |||||||
opts |
Object |
Properties
|
- Inherited From:
Returns:
- Type
- Error | boolean | *
getManifestSetting(id) → {Object|Error}
Get a specific setting object from the manifest
Parameters:
Name | Type | Description |
---|---|---|
id |
Setting id to retrieve |
- Inherited From:
Returns:
- Type
- Object | Error
getManifestSettings() → {Array}
Method that flattens possibly nested settings and returns a flat settings array.
- Inherited From:
Returns:
- Type
- Array
getMultiChannelNodeIdsByDeviceClassGeneric(deviceClassGeneric) → {Array}
Method that gets all multi channel node ids that have a specific deviceClassGeneric.
Parameters:
Name | Type | Description |
---|---|---|
deviceClassGeneric |
String |
- Inherited From:
Returns:
- Type
- Array
hasCommandClass(commandClassId, opts) → {boolean}
Method that will check if the node has the provided command class
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
commandClassId |
string | For example: SWITCH_BINARY |
||||||
opts |
Object |
Properties
|
- Inherited From:
Returns:
- Type
- boolean
(async) meterReset(multiChannelNodeId) → {Promise.<unknown>}
Method that resets the accumulated power meter value on the node. It tries to find the root node of the device and then looks for the COMMAND_CLASS_METER.
Parameters:
Name | Type | Description |
---|---|---|
multiChannelNodeId |
define the multi channel node id in case the COMMAND_CLASS_METER is on a multi channel node |
- Inherited From:
Returns:
- Type
- Promise.<unknown>
onDeleted()
Remove all listeners and intervals from node
- Inherited From:
(async) onSettings(oldSettings, newSettings, changedKeysArr) → {Promise.<T>}
Method that handles changing settings for Z-Wave devices. It iterates over the changed settings and executes a CONFIGURATION_SET in sync. If all succeed, it will resolve, if one or more fail it will reject with an error of concatenated error messages (to see which settings failed if more than one).
Parameters:
Name | Type | Description |
---|---|---|
oldSettings |
||
newSettings |
||
changedKeysArr |
- Inherited From:
Returns:
- Type
- Promise.<T>
printNode()
Print the current Node information with Command Classes and their versions
- Inherited From:
(async) refreshCapabilityValue(capabilityId,, commandClassId,) → {Promise.<unknown>}
Method that refreshes the capability value once. If you want to poll this value please use the parameter getOpts.pollInterval at ZwaveDevice#registerCapability
Parameters:
Name | Type | Description |
---|---|---|
capabilityId, |
String | the string id of the Homey capability |
commandClassId, |
String | the Z-Wave command class used for this request |
- Inherited From:
Returns:
- Type
- Promise.<unknown>
registerCapability(capabilityId, commandClassId, optsopt)
Register a Homey Capability with a Command Class.
Multiple parser
methods can be provided by appending a version, e.g. getParserV3
. This will make sure that the highest matching version will be used, falling back to getParser
.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
capabilityId |
string | The Homey capability id (e.g. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
commandClassId |
string | The command class id (e.g. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
opts |
Object |
<optional> |
The object with options for this capability/commandclass combination. These will extend system options, if available ( Properties
|
- Inherited From:
registerMultiChannelReportListener(multiChannelNodeId, commandClassId, commandId, triggerFn)
Register a multi channel report listener, which is called when a report has been received.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
multiChannelNodeId |
number | The multi channel node id |
||||||
commandClassId |
string | The ID of the Command Class (e.g. |
||||||
commandId |
string | The ID of the Command (e.g. |
||||||
triggerFn |
function |
Properties
|
- Inherited From:
registerReportListener(commandClassId, commandId, triggerFn)
Register a report listener, which is called when a report has been received.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
commandClassId |
string | The ID of the Command Class (e.g. |
||||||
commandId |
string | The ID of the Command (e.g. |
||||||
triggerFn |
function |
Properties
|
- Inherited From:
registerSetting(settingId, parserFn)
Register a setting parser, which is called when a setting has changed.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
settingId |
string | The setting ID, as specified in |
|||||||||
parserFn |
function | The parser function, must return a Buffer, number or boolean Properties
|
- Inherited From: