Fan
UUID: 00000040-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 "Fan" Homebridge plugin. Note
// Example Fan Plugin module.exports = (api) => { api.registerAccessory('ExampleFanPlugin', ExampleFanAccessory); }; class ExampleFanAccessory { 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 Fan service this.service = new this.Service(this.Service.Fan); // create handlers for required characteristics this.service.getCharacteristic(this.Characteristic.On) .on('get', this.handleOnGet.bind(this)) .on('set', this.handleOnSet.bind(this)); } /** * Handle requests to get the current value of the "On" characteristic */ handleOnGet(callback) { this.log.debug('Triggered GET On'); // set this to a valid value for On const currentValue = 1; callback(null, currentValue); } /** * Handle requests to set the "On" characteristic */ handleOnSet(value, callback) { this.log.debug('Triggered SET On:' value); callback(null); } }