homebridge-verisure 2.0.0-rc.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 2.0.0 (Mar 20, 2023)
2
+
3
+ ### Config
4
+
5
+ * __BREAKING__: Property `cookies` replaces `token`. See README for how to get and configure.
6
+
7
+ ### Plugin & accessories
8
+
9
+ * Use Verisure GraphQL API.
10
+
11
+ ### Dependencies
12
+
13
+ * Bump `verisure` module to support GraphQL requests.
14
+
1
15
  ## 1.16.0 (Aug 27, 2022)
2
16
 
3
17
  ### Plugin
@@ -35,6 +35,8 @@ class DoorLock extends VerisureAccessory {
35
35
  }
36
36
 
37
37
  getDoorLockState() {
38
+ this.log('Getting current lock state.', 'debug');
39
+
38
40
  return this.installation.client(overviewOperation)
39
41
  .then((overview) => overview.installation.doorlocks
40
42
  .find((doorlock) => doorlock.device.deviceLabel === this.serialNumber))
@@ -47,8 +49,6 @@ class DoorLock extends VerisureAccessory {
47
49
  }
48
50
 
49
51
  getCurrentLockState(callback) {
50
- this.log('Getting current lock state.', 'debug');
51
-
52
52
  // TODO: Use this.cachedValue, if available?
53
53
 
54
54
  this.getDoorLockState().then((doorLock) => {
@@ -116,8 +116,7 @@ class DoorLock extends VerisureAccessory {
116
116
  this.log('Getting current auto lock config.');
117
117
 
118
118
  this.installation.client(doorLockConfigOperation(this.serialNumber))
119
- .then(({ installation: { smartLock } }) => {
120
- this.log(`Got config: ${JSON.stringify(smartLock)}`, 'debug');
119
+ .then(({ installation: { smartLocks: [smartLock] } }) => {
121
120
  this.autoLockState = DoorLock.resolveAutoLockState(smartLock.configuration);
122
121
  callback(null, this.autoLockState);
123
122
  })
@@ -144,8 +143,7 @@ class DoorLock extends VerisureAccessory {
144
143
  this.log('Getting current audio config.');
145
144
 
146
145
  this.installation.client(doorLockConfigOperation(this.serialNumber))
147
- .then(({ installation: { smartLock } }) => {
148
- this.log(`Got config: ${JSON.stringify(smartLock)}`, 'debug');
146
+ .then(({ installation: { smartLocks: [smartLock] } }) => {
149
147
  this.audioState = smartLock.configuration.volume !== this.platformConfig.audioOffValue;
150
148
  callback(null, this.audioState);
151
149
  })
@@ -159,6 +157,8 @@ class DoorLock extends VerisureAccessory {
159
157
  ? this.platformConfig.audioOnValue
160
158
  : this.platformConfig.audioOffValue;
161
159
 
160
+ this.log(`Setting audio volume to: ${volume}`);
161
+
162
162
  this.installation.client(
163
163
  doorLockUpdateConfigOperation(this.serialNumber, { volume }),
164
164
  )
package/lib/operations.js CHANGED
@@ -190,7 +190,7 @@ module.exports = {
190
190
  },
191
191
  query: `query DoorLockConfiguration($giid: String!, $deviceLabel: String!) {
192
192
  installation(giid: $giid) {
193
- smartLock: smartLocks(filter: {deviceLabels: [$deviceLabel]}) {
193
+ smartLocks(filter: {deviceLabels: [$deviceLabel]}) {
194
194
  device {
195
195
  area
196
196
  deviceLabel
package/lib/platform.js CHANGED
@@ -17,6 +17,7 @@ class VerisurePlatform {
17
17
  VERISURE_EMAIL,
18
18
  VERISURE_PASSWORD,
19
19
  VERISURE_COOKIES,
20
+ VERISURE_TOKEN, // Deprecated.
20
21
  } = process.env;
21
22
 
22
23
  const {
@@ -31,6 +32,7 @@ class VerisurePlatform {
31
32
  showAudioSwitch = true,
32
33
  audioOffValue = 'LOW',
33
34
  audioOnValue = 'HIGH',
35
+ token, // Deprecated.
34
36
  } = config;
35
37
 
36
38
  this.config = {
@@ -50,6 +52,10 @@ class VerisurePlatform {
50
52
  this.homebridge = homebridge;
51
53
  this.logger = logger;
52
54
 
55
+ if (VERISURE_TOKEN || token) {
56
+ this.logger.error('DEPRECATED: Property "token" in config. Please see README to get and configure "cookies".');
57
+ }
58
+
53
59
  this.verisure = new Verisure(
54
60
  this.config.email,
55
61
  this.config.password,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-verisure",
3
- "version": "2.0.0-rc.3",
3
+ "version": "2.0.0",
4
4
  "description": "Verisure plugin for homebridge: https://github.com/nfarina/homebridge",
5
5
  "license": "MIT",
6
6
  "keywords": [