Slat

UUID: 000000B9-0000-1000-8000-0026BB765291

Required Characteristics

Optional Characteristics

Example

Note

The example below is automatically generated and may not be a complete example of what is required to create a working "Slat" Homebridge plugin.
// Example Slat Plugin

module.exports = (api) => {
  api.registerAccessory('ExampleSlatPlugin', ExampleSlatAccessory);
};

class ExampleSlatAccessory {

  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 Slat service
      this.service = new this.Service(this.Service.Slat);

      // create handlers for required characteristics
      this.service.getCharacteristic(this.Characteristic.SlatType)
        .on('get', this.handleSlatTypeGet.bind(this));

      this.service.getCharacteristic(this.Characteristic.CurrentSlatState)
        .on('get', this.handleCurrentSlatStateGet.bind(this));

  }

  /**
   * Handle requests to get the current value of the "Slat Type" characteristic
   */
  handleSlatTypeGet(callback) {
    this.log.debug('Triggered GET SlatType');

    // set this to a valid value for SlatType
    const currentValue = 1;

    callback(null, currentValue);
  }


  /**
   * Handle requests to get the current value of the "Current Slat State" characteristic
   */
  handleCurrentSlatStateGet(callback) {
    this.log.debug('Triggered GET CurrentSlatState');

    // set this to a valid value for CurrentSlatState
    const currentValue = 1;

    callback(null, currentValue);
  }


}