Light Sensor
UUID: 00000084-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 "Light Sensor" Homebridge plugin. Note
// Example Light Sensor Plugin module.exports = (api) => { api.registerAccessory('ExampleLightSensorPlugin', ExampleLightSensorAccessory); }; class ExampleLightSensorAccessory { 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 Light Sensor service this.service = new this.Service(this.Service.LightSensor); // create handlers for required characteristics this.service.getCharacteristic(this.Characteristic.CurrentAmbientLightLevel) .on('get', this.handleCurrentAmbientLightLevelGet.bind(this)); } /** * Handle requests to get the current value of the "Current Ambient Light Level" characteristic */ handleCurrentAmbientLightLevelGet(callback) { this.log.debug('Triggered GET CurrentAmbientLightLevel'); // set this to a valid value for CurrentAmbientLightLevel const currentValue = 1; callback(null, currentValue); } }