How to use the onoff.opt1 function in onoff

To help you get started, we’ve selected a few onoff examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ArjanKranenburg / virtual-devices / drivers / multi / device.js View on Github external
onAdded() {
    this.log('Adding multi: ' + this.getName() + ' (' + this.getData().id + ')');

    // 1) Set first capability to true
    this.setCapabilityValue('onoff.opt1', true)
      .catch( this.error );

    // 2) Set capability with TOKEN_NAME to first capability name
    console.log('Data is: ' + JSON.stringify(this.getData()));
    console.log('State names is: ' + JSON.stringify(this.getData().state_names));
    console.log('Setting state to: ' + this.getData().state_names["onoff.opt1"]);
    this.setCapabilityValue(TOKEN_NAME, this.getData().state_names["onoff.opt1"])
      .catch( this.error );
  }
github ArjanKranenburg / virtual-devices / drivers / multi / device.js View on Github external
onAdded() {
    this.log('Adding multi: ' + this.getName() + ' (' + this.getData().id + ')');

    // 1) Set first capability to true
    this.setCapabilityValue('onoff.opt1', true)
      .catch( this.error );

    // 2) Set capability with TOKEN_NAME to first capability name
    console.log('Data is: ' + JSON.stringify(this.getData()));
    console.log('State names is: ' + JSON.stringify(this.getData().state_names));
    console.log('Setting state to: ' + this.getData().state_names["onoff.opt1"]);
    this.setCapabilityValue(TOKEN_NAME, this.getData().state_names["onoff.opt1"])
      .catch( this.error );
  }

onoff

GPIO access and interrupt detection with Node.js

MIT
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis

Popular onoff functions