Smart Speaker
UUID: 00000228-0000-1000-8000-0026BB765291
Required Characteristics
Optional Characteristics
Example
The example below is automatically generated and may not be a complete example of what is required to create a working "Smart Speaker" Homebridge plugin. Note
// Example Smart Speaker Plugin module.exports = (api) => { api.registerAccessory('ExampleSmartSpeakerPlugin', ExampleSmartSpeakerAccessory); }; class ExampleSmartSpeakerAccessory { constructor(log, config, api) { this.log = log; this.config = config; this.api = api; this.Service = this.api.hap.Service; this.Characteristic = this.api.hap.Characteristic; // extract name from config this.name = config.name; // create a new Smart Speaker service this.service = new this.Service(this.Service.SmartSpeaker); // create handlers for required characteristics this.service.getCharacteristic(this.Characteristic.CurrentMediaState) .on('get', this.handleCurrentMediaStateGet.bind(this)); this.service.getCharacteristic(this.Characteristic.TargetMediaState) .on('get', this.handleTargetMediaStateGet.bind(this)) .on('set', this.handleTargetMediaStateSet.bind(this)); } /** * Handle requests to get the current value of the "Current Media State" characteristic */ handleCurrentMediaStateGet(callback) { this.log.debug('Triggered GET CurrentMediaState'); // set this to a valid value for CurrentMediaState const currentValue = 1; callback(null, currentValue); } /** * Handle requests to get the current value of the "Target Media State" characteristic */ handleTargetMediaStateGet(callback) { this.log.debug('Triggered GET TargetMediaState'); // set this to a valid value for TargetMediaState const currentValue = 1; callback(null, currentValue); } /** * Handle requests to set the "Target Media State" characteristic */ handleTargetMediaStateSet(value, callback) { this.log.debug('Triggered SET TargetMediaState:' value); callback(null); } }