You are currently viewing the Homey Apps SDK v2 documentation. New apps should use Homey Apps SDK v3 ››

Homey.ManagerZwave

const { ManagerZwave } = require('homey');

Table of Contents

Methods

getNode(device, callbackopt) → {Promise}

Get a ZwaveNode instance for a Device

Parameters:
Name Type Attributes Description
device Device

An instance of Device

callback function <optional>
Name Type Description
err Error
node ZwaveNode
Returns:
Type:
Promise
Example
const Homey = require('homey');
class MyZwaveDevice extends Homey.Device {

  onInit() {

    Homey.ManagerZwave.getNode( this )
      .then( node => {

        node.CommandClass['COMMAND_CLASS_BASIC'].on('report', ( command, report ) => {
          this.log('onReport', command, report);
        })

        node.CommandClass['COMMAND_CLASS_BASIC'].BASIC_SET({
          'Value': 0xFF
        })
          .then( this.log )
          .catch( this.error )
      })
      .catch( this.error );
  }

}