Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nest AWAY as single switch, rather than an AWAY switch inside every HomeKit Accessory. #64

Closed
leoneleone opened this issue Aug 21, 2018 · 3 comments

Comments

@leoneleone
Copy link

leoneleone commented Aug 21, 2018

@chrisjshull

Is your feature request related to a problem? Please describe.

Yes. Nest AWAY status doesn't work consistently. Most of the time I have to toggle the Away switch twice to get my Nest Cams to 'turn off' correctly according to the AWAY assist rules set up in the Nest app. I believe this may have something to do with the Characteristic.Away that is created by this plugin under every Nest Cam (HomeKit Accessory).

Describe the solution you'd like

It would make more sense to consolidate the Nest AWAY status/control under ONE HomeKit Switch Accessory which tied into the one Nest.structure rather than each Nest.camera.

Describe alternatives you've considered

  1. "Service.OccupancySensor" could be created instead (of Characteristic.Away for every HomeKit Accessory) to represent the Nest.structure AWAY status, with an added Switch/Toggle to control the AWAY status (which like the current Characteristic.Away in the plugin, this switch would not be visible in the native Home.app tile/Accessory, but can be accessed through third party HomeKit apps like Eve.app).

Additional context

Limit Nest Away Switch to inside 1x HomeKit Occupancy Sensor with three Characteristics:

  1. this.addCharacteristic(Characteristic.OccupancyDetected);
    2.*** this.addCharacteristic(Characteristic.SecuritySystemCurrentState);
    3.*** this.addCharacteristic(Characteristic.SecuritySystemTargetState);
/**
 * Service "Occupancy Sensor"
 */

Service.OccupancySensor = function(displayName, subtype) {
  Service.call(this, displayName, '00000086-0000-1000-8000-0026BB765291', subtype);

  // Required Characteristics
  this.addCharacteristic(Characteristic.OccupancyDetected);

  // Optional Characteristics
  this.addOptionalCharacteristic(Characteristic.StatusActive);
  this.addOptionalCharacteristic(Characteristic.StatusFault);
  this.addOptionalCharacteristic(Characteristic.StatusTampered);
  this.addOptionalCharacteristic(Characteristic.StatusLowBattery);
  this.addOptionalCharacteristic(Characteristic.Name);
};

inherits(Service.OccupancySensor, Service);

Service.OccupancySensor.UUID = '00000086-0000-1000-8000-0026BB765291';


/**
 * Characteristic "Occupancy Detected"
 */

Characteristic.OccupancyDetected = function() {
  Characteristic.call(this, 'Occupancy Detected', '00000071-0000-1000-8000-0026BB765291');
  this.setProps({
    format: Characteristic.Formats.UINT8,
    maxValue: 1,
    minValue: 0,
    validValues: [0,1],
    perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY]
  });
  this.value = this.getDefaultValue();
};

inherits(Characteristic.OccupancyDetected, Characteristic);

Characteristic.OccupancyDetected.UUID = '00000071-0000-1000-8000-0026BB765291';

// The value property of OccupancyDetected must be one of the following:
Characteristic.OccupancyDetected.OCCUPANCY_NOT_DETECTED = 0;
Characteristic.OccupancyDetected.OCCUPANCY_DETECTED = 1;

/**
 * Characteristic "Security System Current State"
 */

Characteristic.SecuritySystemCurrentState = function() {
  Characteristic.call(this, 'Security System Current State', '00000066-0000-1000-8000-0026BB765291');
  this.setProps({
    format: Characteristic.Formats.UINT8,
    maxValue: 4,
    minValue: 0,
    validValues: [0,1,2,3,4],
    perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY]
  });
  this.value = this.getDefaultValue();
};

inherits(Characteristic.SecuritySystemCurrentState, Characteristic);

Characteristic.SecuritySystemCurrentState.UUID = '00000066-0000-1000-8000-0026BB765291';

// The value property of SecuritySystemCurrentState must be one of the following:
Characteristic.SecuritySystemCurrentState.STAY_ARM = 0;
Characteristic.SecuritySystemCurrentState.AWAY_ARM = 1;
Characteristic.SecuritySystemCurrentState.NIGHT_ARM = 2;
Characteristic.SecuritySystemCurrentState.DISARMED = 3;
Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED = 4;

/**
 * Characteristic "Security System Target State"
 */

Characteristic.SecuritySystemTargetState = function() {
  Characteristic.call(this, 'Security System Target State', '00000067-0000-1000-8000-0026BB765291');
  this.setProps({
    format: Characteristic.Formats.UINT8,
    maxValue: 3,
    minValue: 0,
    validValues: [0,1,2,3],
    perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE, Characteristic.Perms.NOTIFY]
  });
  this.value = this.getDefaultValue();
};

inherits(Characteristic.SecuritySystemTargetState, Characteristic);

Characteristic.SecuritySystemTargetState.UUID = '00000067-0000-1000-8000-0026BB765291';

// The value property of SecuritySystemTargetState must be one of the following:
Characteristic.SecuritySystemTargetState.STAY_ARM = 0;
Characteristic.SecuritySystemTargetState.AWAY_ARM = 1;
Characteristic.SecuritySystemTargetState.NIGHT_ARM = 2;
Characteristic.SecuritySystemTargetState.DISARM = 3;

@leoneleone
Copy link
Author

@chrisjshull
Any thoughts on this approach?

@chrisjshull
Copy link
Owner

chrisjshull commented Aug 30, 2018 via email

@adriancable
Copy link
Collaborator

Duplicate of #103, now fixed in latest commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants