Humidity Sensor

UUID: 00000082-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 "Humidity Sensor" Homebridge plugin.
// Example Humidity Sensor Plugin

module.exports = (api) => {
  api.registerAccessory('ExampleHumiditySensorPlugin', ExampleHumiditySensorAccessory);
};

class ExampleHumiditySensorAccessory {

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

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

  }

  /**
   * Handle requests to get the current value of the "Current Relative Humidity" characteristic
   */
  handleCurrentRelativeHumidityGet(callback) {
    this.log.debug('Triggered GET CurrentRelativeHumidity');

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

    callback(null, currentValue);
  }


}