Accessory Information
UUID: 0000003E-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 "Accessory Information" Homebridge plugin. Note
// Example Accessory Information Plugin module.exports = (api) => { api.registerAccessory('ExampleAccessoryInformationPlugin', ExampleAccessoryInformationAccessory); }; class ExampleAccessoryInformationAccessory { 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 Accessory Information service this.service = new this.Service(this.Service.AccessoryInformation); // create handlers for required characteristics this.service.getCharacteristic(this.Characteristic.Identify) .on('set', this.handleIdentifySet.bind(this)); this.service.getCharacteristic(this.Characteristic.Manufacturer) .on('get', this.handleManufacturerGet.bind(this)); this.service.getCharacteristic(this.Characteristic.Model) .on('get', this.handleModelGet.bind(this)); this.service.getCharacteristic(this.Characteristic.Name) .on('get', this.handleNameGet.bind(this)); this.service.getCharacteristic(this.Characteristic.SerialNumber) .on('get', this.handleSerialNumberGet.bind(this)); this.service.getCharacteristic(this.Characteristic.FirmwareRevision) .on('get', this.handleFirmwareRevisionGet.bind(this)); } /** * Handle requests to set the "Identify" characteristic */ handleIdentifySet(value, callback) { this.log.debug('Triggered SET Identify:' value); callback(null); } /** * Handle requests to get the current value of the "Manufacturer" characteristic */ handleManufacturerGet(callback) { this.log.debug('Triggered GET Manufacturer'); // set this to a valid value for Manufacturer const currentValue = 1; callback(null, currentValue); } /** * Handle requests to get the current value of the "Model" characteristic */ handleModelGet(callback) { this.log.debug('Triggered GET Model'); // set this to a valid value for Model const currentValue = 1; callback(null, currentValue); } /** * Handle requests to get the current value of the "Name" characteristic */ handleNameGet(callback) { this.log.debug('Triggered GET Name'); // set this to a valid value for Name const currentValue = 1; callback(null, currentValue); } /** * Handle requests to get the current value of the "Serial Number" characteristic */ handleSerialNumberGet(callback) { this.log.debug('Triggered GET SerialNumber'); // set this to a valid value for SerialNumber const currentValue = 1; callback(null, currentValue); } /** * Handle requests to get the current value of the "Firmware Revision" characteristic */ handleFirmwareRevisionGet(callback) { this.log.debug('Triggered GET FirmwareRevision'); // set this to a valid value for FirmwareRevision const currentValue = 1; callback(null, currentValue); } }