Irrigation System

UUID: 000000CF-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 "Irrigation System" Homebridge plugin.
// Example Irrigation System Plugin

module.exports = (api) => {
  api.registerAccessory('ExampleIrrigationSystemPlugin', ExampleIrrigationSystemAccessory);
};

class ExampleIrrigationSystemAccessory {

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

      // create handlers for required characteristics
      this.service.getCharacteristic(this.Characteristic.Active)
        .on('get', this.handleActiveGet.bind(this))
        .on('set', this.handleActiveSet.bind(this));

      this.service.getCharacteristic(this.Characteristic.ProgramMode)
        .on('get', this.handleProgramModeGet.bind(this));

      this.service.getCharacteristic(this.Characteristic.InUse)
        .on('get', this.handleInUseGet.bind(this));

  }

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

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

    callback(null, currentValue);
  }

  /**
   * Handle requests to set the "Active" characteristic
   */
  handleActiveSet(value, callback) {
    this.log.debug('Triggered SET Active:' value);

    callback(null);
  }

  /**
   * Handle requests to get the current value of the "Program Mode" characteristic
   */
  handleProgramModeGet(callback) {
    this.log.debug('Triggered GET ProgramMode');

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

    callback(null, currentValue);
  }


  /**
   * Handle requests to get the current value of the "In Use" characteristic
   */
  handleInUseGet(callback) {
    this.log.debug('Triggered GET InUse');

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

    callback(null, currentValue);
  }


}