WiFi Router
UUID: 0000020A-0000-1000-8000-0026BB765291
Required Characteristics
Example
The example below is automatically generated and may not be a complete example of what is required to create a working "WiFi Router" Homebridge plugin. Note
// Example WiFi Router Plugin module.exports = (api) => { api.registerAccessory('ExampleWiFiRouterPlugin', ExampleWiFiRouterAccessory); }; class ExampleWiFiRouterAccessory { 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 WiFi Router service this.service = new this.Service(this.Service.WiFiRouter); // create handlers for required characteristics this.service.getCharacteristic(this.Characteristic.ConfiguredName) .on('get', this.handleConfiguredNameGet.bind(this)) .on('set', this.handleConfiguredNameSet.bind(this)); this.service.getCharacteristic(this.Characteristic.ManagedNetworkEnable) .on('get', this.handleManagedNetworkEnableGet.bind(this)) .on('set', this.handleManagedNetworkEnableSet.bind(this)); this.service.getCharacteristic(this.Characteristic.RouterStatus) .on('get', this.handleRouterStatusGet.bind(this)); } /** * Handle requests to get the current value of the "Configured Name" characteristic */ handleConfiguredNameGet(callback) { this.log.debug('Triggered GET ConfiguredName'); // set this to a valid value for ConfiguredName const currentValue = 1; callback(null, currentValue); } /** * Handle requests to set the "Configured Name" characteristic */ handleConfiguredNameSet(value, callback) { this.log.debug('Triggered SET ConfiguredName:' value); callback(null); } /** * Handle requests to get the current value of the "Managed Network Enable" characteristic */ handleManagedNetworkEnableGet(callback) { this.log.debug('Triggered GET ManagedNetworkEnable'); // set this to a valid value for ManagedNetworkEnable const currentValue = 1; callback(null, currentValue); } /** * Handle requests to set the "Managed Network Enable" characteristic */ handleManagedNetworkEnableSet(value, callback) { this.log.debug('Triggered SET ManagedNetworkEnable:' value); callback(null); } /** * Handle requests to get the current value of the "Router Status" characteristic */ handleRouterStatusGet(callback) { this.log.debug('Triggered GET RouterStatus'); // set this to a valid value for RouterStatus const currentValue = 1; callback(null, currentValue); } }