Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 );
}
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 );
}