Bridging State
UUID: 00000062-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 "Bridging State" Homebridge plugin. Note
// Example Bridging State Plugin module.exports = (api) => { api.registerAccessory('ExampleBridgingStatePlugin', ExampleBridgingStateAccessory); }; class ExampleBridgingStateAccessory { 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 Bridging State service this.service = new this.Service(this.Service.BridgingState); // create handlers for required characteristics this.service.getCharacteristic(this.Characteristic.Reachable) .on('get', this.handleReachableGet.bind(this)); this.service.getCharacteristic(this.Characteristic.LinkQuality) .on('get', this.handleLinkQualityGet.bind(this)); this.service.getCharacteristic(this.Characteristic.AccessoryIdentifier) .on('get', this.handleAccessoryIdentifierGet.bind(this)); this.service.getCharacteristic(this.Characteristic.Category) .on('get', this.handleCategoryGet.bind(this)); } /** * Handle requests to get the current value of the "Reachable" characteristic */ handleReachableGet(callback) { this.log.debug('Triggered GET Reachable'); // set this to a valid value for Reachable const currentValue = 1; callback(null, currentValue); } /** * Handle requests to get the current value of the "Link Quality" characteristic */ handleLinkQualityGet(callback) { this.log.debug('Triggered GET LinkQuality'); // set this to a valid value for LinkQuality const currentValue = 1; callback(null, currentValue); } /** * Handle requests to get the current value of the "Accessory Identifier" characteristic */ handleAccessoryIdentifierGet(callback) { this.log.debug('Triggered GET AccessoryIdentifier'); // set this to a valid value for AccessoryIdentifier const currentValue = 1; callback(null, currentValue); } /** * Handle requests to get the current value of the "Category" characteristic */ handleCategoryGet(callback) { this.log.debug('Triggered GET Category'); // set this to a valid value for Category const currentValue = 1; callback(null, currentValue); } }