Security System

UUID: 0000007E-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 "Security System" Homebridge plugin.
// Example Security System Plugin

module.exports = (api) => {
  api.registerAccessory('ExampleSecuritySystemPlugin', ExampleSecuritySystemAccessory);
};

class ExampleSecuritySystemAccessory {

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

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

      this.service.getCharacteristic(this.Characteristic.SecuritySystemTargetState)
        .on('get', this.handleSecuritySystemTargetStateGet.bind(this))
        .on('set', this.handleSecuritySystemTargetStateSet.bind(this));

  }

  /**
   * Handle requests to get the current value of the "Security System Current State" characteristic
   */
  handleSecuritySystemCurrentStateGet(callback) {
    this.log.debug('Triggered GET SecuritySystemCurrentState');

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

    callback(null, currentValue);
  }


  /**
   * Handle requests to get the current value of the "Security System Target State" characteristic
   */
  handleSecuritySystemTargetStateGet(callback) {
    this.log.debug('Triggered GET SecuritySystemTargetState');

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

    callback(null, currentValue);
  }

  /**
   * Handle requests to set the "Security System Target State" characteristic
   */
  handleSecuritySystemTargetStateSet(value, callback) {
    this.log.debug('Triggered SET SecuritySystemTargetState:' value);

    callback(null);
  }

}