homebridge-verisure 1.14.2 → 1.15.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 +6 -0
- package/README.md +4 -2
- package/bin/verisure +4 -3
- package/config.schema.json +8 -0
- package/lib/accessories/verisure.js +1 -1
- package/lib/platform.js +11 -1
- package/package.json +2 -4
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ your array (list) of enabled platform plugins. Example config:
|
|
|
51
51
|
"token": "vid=topSecretToken",
|
|
52
52
|
"alarmCode": "0000",
|
|
53
53
|
"doorCode": "000000",
|
|
54
|
+
"installations": ["Alias"],
|
|
54
55
|
"pollInterval": 60
|
|
55
56
|
}
|
|
56
57
|
]
|
|
@@ -61,16 +62,17 @@ your array (list) of enabled platform plugins. Example config:
|
|
|
61
62
|
* __`token`__ Required string for accounts with MFA enabled.
|
|
62
63
|
* `alarmCode` Optional string containing your security system alarm code.
|
|
63
64
|
* `doorCode` Optional string containing your door lock code.
|
|
65
|
+
* `installations` Optional array for filtering installations based on Verisure alias. Defaults to `[]`
|
|
64
66
|
* `pollInterval` Optional integer containing poll interval in seconds. Defaults to `60`.
|
|
65
67
|
|
|
66
68
|
### Multi-factor authentication
|
|
67
69
|
|
|
68
70
|
> [Verisure] MFA is enabled for user. Please see README.
|
|
69
71
|
|
|
70
|
-
In 2021 Verisure started enrolling MFA which requires you to obtain a long lived token. This token is used instead of a `password` in your config and will need to be renewed yearly. After installing the plugin, run `npx verisure` in your terminal and copy the output values into your config.
|
|
72
|
+
In 2021 Verisure started enrolling MFA which requires you to obtain a long lived token. This token is used instead of a `password` in your config and will need to be renewed yearly. After installing the plugin, run `npx homebridge-verisure` in your terminal and copy the output values into your config.
|
|
71
73
|
|
|
72
74
|
```bash
|
|
73
|
-
$ npx verisure
|
|
75
|
+
$ npx homebridge-verisure
|
|
74
76
|
✔ What is your login email? · foo@bar.com
|
|
75
77
|
✔ What is your password? · ********************
|
|
76
78
|
|
package/bin/verisure
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
2
3
|
|
|
3
4
|
const { prompt, Password } = require('enquirer');
|
|
4
5
|
|
|
@@ -25,7 +26,7 @@ const run = async () => {
|
|
|
25
26
|
await verisure.getToken();
|
|
26
27
|
|
|
27
28
|
if (!verisure.getCookie('vid')) {
|
|
28
|
-
console.log(
|
|
29
|
+
console.log('\n', 'One-time code sent.', '\n');
|
|
29
30
|
|
|
30
31
|
const { code } = await prompt({
|
|
31
32
|
type: 'input',
|
|
@@ -37,13 +38,13 @@ const run = async () => {
|
|
|
37
38
|
await verisure.getToken(code.trim());
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
console.log(
|
|
41
|
+
console.log('\n', 'Your config is ready.', '\n');
|
|
41
42
|
|
|
42
43
|
console.log(JSON.stringify({
|
|
43
44
|
platform: 'verisure',
|
|
44
45
|
name: 'Verisure',
|
|
45
46
|
email,
|
|
46
|
-
token: verisure.getCookie('vid')
|
|
47
|
+
token: verisure.getCookie('vid'),
|
|
47
48
|
}, null, 2));
|
|
48
49
|
};
|
|
49
50
|
|
package/config.schema.json
CHANGED
|
@@ -30,6 +30,14 @@
|
|
|
30
30
|
"type": "string",
|
|
31
31
|
"required": false
|
|
32
32
|
},
|
|
33
|
+
"installations": {
|
|
34
|
+
"title": "Installations",
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
},
|
|
39
|
+
"required": false
|
|
40
|
+
},
|
|
33
41
|
"pollInterval": {
|
|
34
42
|
"title": "Poll interval",
|
|
35
43
|
"type": "integer",
|
package/lib/platform.js
CHANGED
|
@@ -24,6 +24,7 @@ class VerisurePlatform {
|
|
|
24
24
|
email,
|
|
25
25
|
token,
|
|
26
26
|
password,
|
|
27
|
+
installations = [],
|
|
27
28
|
pollInterval = 60,
|
|
28
29
|
} = config;
|
|
29
30
|
|
|
@@ -33,6 +34,7 @@ class VerisurePlatform {
|
|
|
33
34
|
email: VERISURE_EMAIL || email,
|
|
34
35
|
password: VERISURE_PASSWORD || password,
|
|
35
36
|
token: VERISURE_TOKEN || token,
|
|
37
|
+
installations,
|
|
36
38
|
pollInterval,
|
|
37
39
|
};
|
|
38
40
|
|
|
@@ -102,12 +104,20 @@ class VerisurePlatform {
|
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
|
|
105
|
-
this.installations = await this.verisure.getInstallations()
|
|
107
|
+
this.installations = (await this.verisure.getInstallations())
|
|
108
|
+
// Filter out installations based on configuration.
|
|
109
|
+
.filter((installation) => this.config.installations.length === 0
|
|
110
|
+
|| this.config.installations.includes(installation.config.alias));
|
|
106
111
|
} catch (error) {
|
|
107
112
|
this.logger.error(`Unable to get installations. Please check configured credentials: ${error.message}`);
|
|
108
113
|
return callback([]);
|
|
109
114
|
}
|
|
110
115
|
|
|
116
|
+
if (this.installations.length === 0) {
|
|
117
|
+
this.logger.error(`No installations found matching config: ${JSON.stringify(this.config.installations)}`);
|
|
118
|
+
return callback([]);
|
|
119
|
+
}
|
|
120
|
+
|
|
111
121
|
const overviews = await Promise.all(
|
|
112
122
|
this.installations.map((installation) => Promise.all([
|
|
113
123
|
installation,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-verisure",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "Verisure plugin for homebridge: https://github.com/nfarina/homebridge",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -13,9 +13,7 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"test": "eslint lib && jest --coverage"
|
|
15
15
|
},
|
|
16
|
-
"bin":
|
|
17
|
-
"verisure": "bin/verisure"
|
|
18
|
-
},
|
|
16
|
+
"bin": "bin/verisure",
|
|
19
17
|
"bugs": {
|
|
20
18
|
"url": "http://github.com/ptz0n/homebridge-verisure/issues"
|
|
21
19
|
},
|