Camera Operating Mode

UUID: 0000021A-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 "Camera Operating Mode" Homebridge plugin.
// Example Camera Operating Mode Plugin

module.exports = (api) => {
  api.registerAccessory('ExampleCameraOperatingModePlugin', ExampleCameraOperatingModeAccessory);
};

class ExampleCameraOperatingModeAccessory {

  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 Camera Operating Mode service
      this.service = new this.Service(this.Service.CameraOperatingMode);

      // create handlers for required characteristics
      this.service.getCharacteristic(this.Characteristic.EventSnapshotsActive)
        .on('get', this.handleEventSnapshotsActiveGet.bind(this))
        .on('set', this.handleEventSnapshotsActiveSet.bind(this));

      this.service.getCharacteristic(this.Characteristic.HomeKitCameraActive)
        .on('get', this.handleHomeKitCameraActiveGet.bind(this))
        .on('set', this.handleHomeKitCameraActiveSet.bind(this));

  }

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

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

    callback(null, currentValue);
  }

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

    callback(null);
  }

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

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

    callback(null, currentValue);
  }

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

    callback(null);
  }

}