homebridge-august
Advanced tools
Comparing version 0.1.0-beta.6 to 0.1.0-beta.7
@@ -54,2 +54,3 @@ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'; | ||
setLockTargetState(value: CharacteristicValue): Promise<void>; | ||
cacheState(): Promise<void>; | ||
config(device: device & devicesConfig): Promise<void>; | ||
@@ -56,0 +57,0 @@ refreshRate(device: device & devicesConfig): Promise<void>; |
@@ -19,8 +19,3 @@ "use strict"; | ||
this.config(device); | ||
if (this.LockCurrentState === undefined) { | ||
this.LockCurrentState = this.accessory.context.LockCurrentState | this.platform.Characteristic.LockCurrentState.UNKNOWN; | ||
} | ||
if (this.LockTargetState === undefined) { | ||
this.LockTargetState = this.accessory.context.LockTargetState | this.platform.Characteristic.LockTargetState.UNSECURED; | ||
} | ||
this.cacheState(); | ||
// default placeholders | ||
@@ -30,2 +25,4 @@ // this is subject we use to track when we need to POST changes to the August API | ||
this.lockUpdateInProgress = false; | ||
// Initial Device Parse | ||
this.refreshStatus(); | ||
// set accessory information | ||
@@ -47,4 +44,2 @@ accessory | ||
//Required Characteristics" see https://developers.homebridge.io/#/service/LockMechanism | ||
// Initial Device Parse | ||
this.refreshStatus(); | ||
// Create handlers for required characteristics | ||
@@ -243,2 +238,3 @@ this.lockService.getCharacteristic(this.platform.Characteristic.LockTargetState).onSet(this.setLockTargetState.bind(this)); | ||
else { | ||
this.accessory.context.BatteryLevel = this.BatteryLevel; | ||
this.batteryService.updateCharacteristic(this.platform.Characteristic.BatteryLevel, this.BatteryLevel); | ||
@@ -259,2 +255,3 @@ this.debugLog(`Lock: ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.BatteryLevel}`); | ||
else { | ||
this.accessory.context.ContactSensorState = this.ContactSensorState; | ||
this.contactSensorService?.updateCharacteristic(this.platform.Characteristic.ContactSensorState, this.ContactSensorState); | ||
@@ -269,2 +266,24 @@ this.debugLog(`Lock: ${this.accessory.displayName} updateCharacteristic ContactSensorState: ${this.ContactSensorState}`); | ||
} | ||
async cacheState() { | ||
if (this.LockCurrentState === undefined) { | ||
this.LockCurrentState = this.accessory.context.LockCurrentState | this.platform.Characteristic.LockCurrentState.SECURED; | ||
} | ||
if (this.LockTargetState === undefined) { | ||
this.LockTargetState = this.accessory.context.LockTargetState | this.platform.Characteristic.LockTargetState.SECURED; | ||
} | ||
if (this.ContactSensorState === undefined) { | ||
this.ContactSensorState = this.accessory.context.ContactSensorState | this.platform.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED; | ||
} | ||
if (this.BatteryLevel === undefined) { | ||
this.BatteryLevel = this.accessory.context.BatteryLevel | 100; | ||
} | ||
if (this.StatusLowBattery === undefined) { | ||
if (this.BatteryLevel < 15) { | ||
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW; | ||
} | ||
else { | ||
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL; | ||
} | ||
} | ||
} | ||
async config(device) { | ||
@@ -271,0 +290,0 @@ let config = {}; |
{ | ||
"displayName": "Homebridge August", | ||
"name": "homebridge-august", | ||
"version": "0.1.0-beta.6", | ||
"version": "0.1.0-beta.7", | ||
"description": "The [Homebridge](https://homebridge.io) August plugin allows you to access your [August](https://august.com) & [Yale](https://shopyalehome.com) device(s) from HomeKit.", | ||
@@ -6,0 +6,0 @@ "author": "donavanbecker", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
122162
1240