homebridge-flume 0.4.0 → 1.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 +32 -0
- package/README.md +18 -14
- package/config.schema.json +15 -15
- package/lib/connection/http.js +93 -8
- package/lib/device/valve.js +44 -5
- package/lib/homebridge-ui/public/index.html +11 -0
- package/lib/index.js +13 -8
- package/lib/utils/constants.js +4 -4
- package/lib/utils/lang-en.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to homebridge-flume will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 1.0.0 (2021-11-29)
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Plugin logo
|
|
10
|
+
|
|
11
|
+
## 0.7.0 (2021-11-24)
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `StatusFault` and `StatusLowBattery` characteristics to the `LeakSensor` service
|
|
16
|
+
|
|
17
|
+
## 0.6.0 (2021-11-24)
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- Leak sensor service
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Minimum refresh interval increased to two minutes
|
|
26
|
+
|
|
27
|
+
## 0.5.0 (2021-11-23)
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- Make use of the debug logging option for HTTP responses
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- `client_id` and `client_secret` config options changed to `clientId` and `clientSecret` for consistency
|
|
36
|
+
|
|
5
37
|
## 0.4.0 (2021-11-23)
|
|
6
38
|
|
|
7
39
|
### Added
|
package/README.md
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://github.com/bwp91/homebridge-flume"><img src="https://user-images.githubusercontent.com/43026681/143831753-ed67cad2-909a-4337-9b18-dd8e65dfdf5e.png" width="600px"></a>
|
|
3
|
+
</p>
|
|
1
4
|
<span align="center">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
|
|
6
|
+
# homebridge-flume
|
|
7
|
+
|
|
8
|
+
Homebridge plugin to integrate Flume devices into HomeKit
|
|
9
|
+
|
|
10
|
+
[](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
|
|
11
|
+
[](https://www.npmjs.com/package/homebridge-flume)
|
|
12
|
+
[](https://github.com/bwp91/homebridge-flume/wiki/Beta-Version)
|
|
13
|
+
[](https://www.npmjs.com/package/homebridge-flume)
|
|
14
|
+
[](https://standardjs.com)
|
|
15
|
+
[](https://discord.com/channels/784827113378676736/784827113378676739)
|
|
16
|
+
[](https://discord.com/channels/432663330281226270/742733745743855627)
|
|
17
|
+
|
|
15
18
|
</span>
|
|
16
19
|
|
|
17
20
|
### Plugin Information
|
|
@@ -40,7 +43,8 @@
|
|
|
40
43
|
|
|
41
44
|
### Credits
|
|
42
45
|
|
|
43
|
-
- This is a forked rewrite of the [homebridge-flume-water-sensor](https://www.npmjs.com/package/homebridge-flume-water-sensor) plugin by @weallknowwhoisatfaulthere
|
|
46
|
+
- This is a forked rewrite of the [homebridge-flume-water-sensor](https://www.npmjs.com/package/homebridge-flume-water-sensor) plugin by @weallknowwhoisatfaulthere.
|
|
47
|
+
- To the creator of the awesome plugin header logo: [Keryan Belahcene](https://www.instagram.com/keryan.me).
|
|
44
48
|
- To the creators/contributors of [Homebridge](https://homebridge.io) who make this plugin possible.
|
|
45
49
|
|
|
46
50
|
### Disclaimer
|
package/config.schema.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"singular": true,
|
|
5
5
|
"customUi": true,
|
|
6
6
|
"customUiPath": "./lib/homebridge-ui",
|
|
7
|
-
"headerDisplay": "<p align=\"center\">For help and support please visit our <a href=\"https://github.com/bwp91/homebridge-
|
|
7
|
+
"headerDisplay": "<p align=\"center\"><img width=\"60%\" src=\"https://user-images.githubusercontent.com/43026681/143831753-ed67cad2-909a-4337-9b18-dd8e65dfdf5e.png\"></p><p align=\"center\">For help and support please visit our <a href=\"https://github.com/bwp91/homebridge-thermobit/wiki\">GitHub Wiki</a>. We hope you find this plugin useful!</p>",
|
|
8
8
|
"schema": {
|
|
9
9
|
"type": "object",
|
|
10
10
|
"properties": {
|
|
@@ -17,39 +17,39 @@
|
|
|
17
17
|
"title": "Username",
|
|
18
18
|
"type": "string",
|
|
19
19
|
"required": true,
|
|
20
|
-
"description": "Your
|
|
20
|
+
"description": "Your Flume username."
|
|
21
21
|
},
|
|
22
22
|
"password": {
|
|
23
23
|
"title": "Password",
|
|
24
24
|
"type": "string",
|
|
25
25
|
"required": true,
|
|
26
|
-
"description": "Your
|
|
26
|
+
"description": "Your Flume password."
|
|
27
27
|
},
|
|
28
|
-
"
|
|
28
|
+
"clientId": {
|
|
29
29
|
"title": "Client ID",
|
|
30
30
|
"type": "string",
|
|
31
|
-
"placeholder": "
|
|
31
|
+
"placeholder": "1234567890ABCD",
|
|
32
32
|
"required": true,
|
|
33
|
-
"description": "Your Client ID
|
|
33
|
+
"description": "Your Flume Client ID, found at https://portal.flumetech.com."
|
|
34
34
|
},
|
|
35
|
-
"
|
|
35
|
+
"clientSecret": {
|
|
36
36
|
"title": "Client Secret",
|
|
37
37
|
"type": "string",
|
|
38
|
-
"placeholder": "
|
|
38
|
+
"placeholder": "1234567890ABCDEFGHIJ",
|
|
39
39
|
"required": true,
|
|
40
|
-
"description": "Your Client Secret
|
|
40
|
+
"description": "Your Flume Client Secret, found at https://portal.flumetech.com."
|
|
41
41
|
},
|
|
42
42
|
"refreshInterval": {
|
|
43
|
-
"title": "Refresh
|
|
43
|
+
"title": "Refresh Interval",
|
|
44
44
|
"type": "integer",
|
|
45
|
-
"placeholder":
|
|
46
|
-
"description": "Number of minutes between updates.
|
|
45
|
+
"placeholder": 2,
|
|
46
|
+
"description": "Number of minutes between updates. Must be 2 or more."
|
|
47
47
|
},
|
|
48
48
|
"threshold": {
|
|
49
|
-
"title": "
|
|
49
|
+
"title": "Threshold",
|
|
50
50
|
"type": "number",
|
|
51
51
|
"placeholder": 0,
|
|
52
|
-
"description": "
|
|
52
|
+
"description": "Ignore a steady water draw below this value in gallons per refresh interval. Must be 0 or more."
|
|
53
53
|
},
|
|
54
54
|
"disableDeviceLogging": {
|
|
55
55
|
"type": "boolean",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
{
|
|
73
73
|
"type": "fieldset",
|
|
74
74
|
"title": "Required Settings",
|
|
75
|
-
"items": ["username", "password", "
|
|
75
|
+
"items": ["username", "password", "clientId", "clientSecret"]
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
"type": "fieldset",
|
package/lib/connection/http.js
CHANGED
|
@@ -15,8 +15,8 @@ module.exports = class connectionHTTP {
|
|
|
15
15
|
this.log = platform.log
|
|
16
16
|
this.username = platform.config.username
|
|
17
17
|
this.password = platform.config.password
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
18
|
+
this.clientId = platform.config.clientId
|
|
19
|
+
this.clientSecret = platform.config.clientSecret
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async obtainToken () {
|
|
@@ -24,8 +24,8 @@ module.exports = class connectionHTTP {
|
|
|
24
24
|
// Generate the JSON data to send
|
|
25
25
|
const body = {
|
|
26
26
|
grant_type: 'password',
|
|
27
|
-
client_id: this.
|
|
28
|
-
client_secret: this.
|
|
27
|
+
client_id: this.clientId,
|
|
28
|
+
client_secret: this.clientSecret,
|
|
29
29
|
username: this.username,
|
|
30
30
|
password: this.password
|
|
31
31
|
}
|
|
@@ -62,6 +62,11 @@ module.exports = class connectionHTTP {
|
|
|
62
62
|
}
|
|
63
63
|
*/
|
|
64
64
|
|
|
65
|
+
// Log the response if in debug mode
|
|
66
|
+
if (this.debug) {
|
|
67
|
+
this.log('[HTTP obtainToken()] %s.', JSON.stringify(res.data))
|
|
68
|
+
}
|
|
69
|
+
|
|
65
70
|
// Make the token available in other functions
|
|
66
71
|
this.accessToken = res.data.data[0].access_token
|
|
67
72
|
this.refreshToken = res.data.data[0].refresh_token
|
|
@@ -95,11 +100,16 @@ module.exports = class connectionHTTP {
|
|
|
95
100
|
|
|
96
101
|
async renewToken () {
|
|
97
102
|
try {
|
|
103
|
+
// Check we have a refresh token
|
|
104
|
+
if (!this.refreshToken) {
|
|
105
|
+
throw new Error(this.lang.noRefreshToken)
|
|
106
|
+
}
|
|
107
|
+
|
|
98
108
|
// Generate the JSON data to send
|
|
99
109
|
const body = {
|
|
100
110
|
grant_type: 'refresh_token',
|
|
101
|
-
client_id: this.
|
|
102
|
-
client_secret: this.
|
|
111
|
+
client_id: this.clientId,
|
|
112
|
+
client_secret: this.clientSecret,
|
|
103
113
|
refresh_token: this.refreshToken
|
|
104
114
|
}
|
|
105
115
|
const now = Date.now()
|
|
@@ -114,6 +124,11 @@ module.exports = class connectionHTTP {
|
|
|
114
124
|
throw new Error(this.lang.noDataReceived)
|
|
115
125
|
}
|
|
116
126
|
|
|
127
|
+
// Log the response if in debug mode
|
|
128
|
+
if (this.debug) {
|
|
129
|
+
this.log('[HTTP renewToken()] %s.', JSON.stringify(res.data))
|
|
130
|
+
}
|
|
131
|
+
|
|
117
132
|
/*
|
|
118
133
|
{
|
|
119
134
|
success: true,
|
|
@@ -154,7 +169,7 @@ module.exports = class connectionHTTP {
|
|
|
154
169
|
async getDevices () {
|
|
155
170
|
try {
|
|
156
171
|
// Check we have a user id
|
|
157
|
-
if (!this.userId) {
|
|
172
|
+
if (!this.userId || !this.accessToken) {
|
|
158
173
|
throw new Error(this.lang.noUserId)
|
|
159
174
|
}
|
|
160
175
|
|
|
@@ -169,6 +184,11 @@ module.exports = class connectionHTTP {
|
|
|
169
184
|
throw new Error(this.lang.noDataReceived)
|
|
170
185
|
}
|
|
171
186
|
|
|
187
|
+
// Log the response if in debug mode
|
|
188
|
+
if (this.debug) {
|
|
189
|
+
this.log('[HTTP getDevices()] %s.', JSON.stringify(res.data))
|
|
190
|
+
}
|
|
191
|
+
|
|
172
192
|
return res.data.data
|
|
173
193
|
} catch (err) {
|
|
174
194
|
if (err.code && this.consts.httpRetryCodes.includes(err.code)) {
|
|
@@ -182,7 +202,37 @@ module.exports = class connectionHTTP {
|
|
|
182
202
|
}
|
|
183
203
|
}
|
|
184
204
|
|
|
185
|
-
async getDeviceInfo (deviceId
|
|
205
|
+
async getDeviceInfo (deviceId) {
|
|
206
|
+
// Refresh the access token if it has expired already
|
|
207
|
+
if (Date.now() > this.expiresIn) {
|
|
208
|
+
await this.renewToken()
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Send the request
|
|
212
|
+
const res = await axios.get(
|
|
213
|
+
'https://api.flumetech.com/users/' + this.userId + '/devices/' + deviceId,
|
|
214
|
+
{
|
|
215
|
+
headers: {
|
|
216
|
+
Authorization: 'Bearer ' + this.accessToken
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
// Check to see we got a response
|
|
222
|
+
if (!res.data) {
|
|
223
|
+
throw new Error(this.lang.noDataReceived)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Log the response if in debug mode
|
|
227
|
+
if (this.debug) {
|
|
228
|
+
this.log('[HTTP getDeviceInfo()] %s.', JSON.stringify(res.data))
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Parse the response
|
|
232
|
+
return res.data.data[0]
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
async getWaterInfo (deviceId, fromWhen) {
|
|
186
236
|
// Refresh the access token if it has expired already
|
|
187
237
|
if (Date.now() > this.expiresIn) {
|
|
188
238
|
await this.renewToken()
|
|
@@ -217,6 +267,41 @@ module.exports = class connectionHTTP {
|
|
|
217
267
|
throw new Error(this.lang.noDataReceived)
|
|
218
268
|
}
|
|
219
269
|
|
|
270
|
+
// Log the response if in debug mode
|
|
271
|
+
if (this.debug) {
|
|
272
|
+
this.log('[HTTP getWaterInfo()] %s.', JSON.stringify(res.data))
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Parse the response
|
|
276
|
+
return res.data.data[0]
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
async getLeakInfo (deviceId) {
|
|
280
|
+
// Refresh the access token if it has expired already
|
|
281
|
+
if (Date.now() > this.expiresIn) {
|
|
282
|
+
await this.renewToken()
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Send the request
|
|
286
|
+
const res = await axios.get(
|
|
287
|
+
'https://api.flumetech.com/users/' + this.userId + '/devices/' + deviceId + '/leaks/active',
|
|
288
|
+
{
|
|
289
|
+
headers: {
|
|
290
|
+
Authorization: 'Bearer ' + this.accessToken
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
// Check to see we got a response
|
|
296
|
+
if (!res.data) {
|
|
297
|
+
throw new Error(this.lang.noDataReceived)
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Log the response if in debug mode
|
|
301
|
+
if (this.debug) {
|
|
302
|
+
this.log('[HTTP getLeakInfo()] %s.', JSON.stringify(res.data))
|
|
303
|
+
}
|
|
304
|
+
|
|
220
305
|
// Parse the response
|
|
221
306
|
return res.data.data[0]
|
|
222
307
|
}
|
package/lib/device/valve.js
CHANGED
|
@@ -6,24 +6,63 @@ module.exports = class deviceValve {
|
|
|
6
6
|
constructor (platform, accessory) {
|
|
7
7
|
// Set up variables from the platform
|
|
8
8
|
this.accessory = accessory
|
|
9
|
-
this.disableDeviceLogging = platform.config.disableDeviceLogging
|
|
10
9
|
this.funcs = platform.funcs
|
|
11
10
|
this.threshold = platform.config.threshold
|
|
12
11
|
this.hapChar = platform.api.hap.Characteristic
|
|
13
12
|
this.hapErr = platform.api.hap.HapStatusError
|
|
14
13
|
this.hapServ = platform.api.hap.Service
|
|
15
14
|
this.lang = platform.lang
|
|
16
|
-
this.log = platform.log
|
|
15
|
+
this.log = platform.config.disableDeviceLogging ? () => {} : platform.log
|
|
17
16
|
this.name = accessory.displayName
|
|
18
17
|
this.platform = platform
|
|
19
18
|
this.refreshInterval = platform.config.refreshInterval
|
|
19
|
+
|
|
20
|
+
// Add the leak sensor service if it doesn't exist already
|
|
21
|
+
this.leakService =
|
|
22
|
+
this.accessory.getService(this.hapServ.LeakSensor) ||
|
|
23
|
+
this.accessory.addService(this.hapServ.LeakSensor)
|
|
24
|
+
|
|
25
|
+
this.cacheLeak = !!this.leakService.getCharacteristic(this.hapChar.LeakDetected).value
|
|
26
|
+
this.cacheBatt = !this.leakService.getCharacteristic(this.hapChar.StatusLowBattery).value
|
|
27
|
+
this.cacheStatus = !this.leakService.getCharacteristic(this.hapChar.StatusFault).value
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
externalUpdate (params) {
|
|
23
|
-
//
|
|
31
|
+
// Check the data for leak detection
|
|
32
|
+
if (
|
|
33
|
+
this.funcs.hasProperty(params.leakInfo, 'active') &&
|
|
34
|
+
params.leakInfo.active !== this.cacheLeak
|
|
35
|
+
) {
|
|
36
|
+
this.cacheLeak = params.leakInfo.active
|
|
37
|
+
this.leakService.updateCharacteristic(this.hapChar.LeakDetected, this.cacheLeak ? 1 : 0)
|
|
38
|
+
this.log('[%s] current leak status [%sdetected].', this.name, this.cacheLeak ? '' : 'not ')
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Check the data for battery level, cacheBatt is true for OK and false for LOW
|
|
42
|
+
if (
|
|
43
|
+
this.funcs.hasProperty(params.devInfo, 'battery_level') &&
|
|
44
|
+
(params.devInfo.battery_level !== 'low') !== this.cacheBatt
|
|
45
|
+
) {
|
|
46
|
+
this.cacheBatt = params.devInfo.battery_level !== 'low'
|
|
47
|
+
this.leakService.updateCharacteristic(this.hapChar.StatusLowBattery, this.cacheBatt ? 0 : 1)
|
|
48
|
+
this.log('[%s] current battery [%s].', this.name, this.cacheBatt ? 'ok' : 'low')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Check the data for connectivity, cacheStatus is true for OK and false for NOT CONNECTED
|
|
52
|
+
if (
|
|
53
|
+
this.funcs.hasProperty(params.devInfo, 'connected') &&
|
|
54
|
+
params.devInfo.connected !== this.cacheStatus
|
|
55
|
+
) {
|
|
56
|
+
this.cacheStatus = params.devInfo.connected
|
|
57
|
+
this.leakService.updateCharacteristic(this.hapChar.StatusFault, this.cacheStatus ? 0 : 1)
|
|
58
|
+
this.log('[%s] current status [%sconnected].', this.name, this.cacheStatus ? '' : 'not ')
|
|
59
|
+
}
|
|
60
|
+
|
|
24
61
|
const usage =
|
|
25
|
-
params.
|
|
26
|
-
|
|
62
|
+
params.waterInfo.currentusage &&
|
|
63
|
+
params.waterInfo.currentusage[0] &&
|
|
64
|
+
params.waterInfo.currentusage[0].value
|
|
65
|
+
? params.waterInfo.currentusage[0].value
|
|
27
66
|
: 0
|
|
28
67
|
if (usage > this.threshold) {
|
|
29
68
|
this.log(
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
<p class="text-center">
|
|
2
|
+
<img
|
|
3
|
+
src="https://user-images.githubusercontent.com/43026681/143831753-ed67cad2-909a-4337-9b18-dd8e65dfdf5e.png"
|
|
4
|
+
alt="homebridge-flume logo"
|
|
5
|
+
style="width: 60%;"
|
|
6
|
+
/>
|
|
7
|
+
</p>
|
|
1
8
|
<div id="pageIntro" class="text-center" style="display: none;">
|
|
2
9
|
<p class="lead">Thank you for installing <strong>homebridge-flume</strong></p>
|
|
3
10
|
<p>
|
|
@@ -83,6 +90,10 @@
|
|
|
83
90
|
>
|
|
84
91
|
plugin by @weallknowwhoisatfaulthere
|
|
85
92
|
</li>
|
|
93
|
+
<li>
|
|
94
|
+
To the creator of the awesome plugin header logo:
|
|
95
|
+
<a href="https://www.instagram.com/keryan.me" target="_blank">Keryan Belahcene</a>.
|
|
96
|
+
</li>
|
|
86
97
|
<li>
|
|
87
98
|
To the creators/contributors of
|
|
88
99
|
<a href="https://homebridge.io" target="_blank">Homebridge</a> who make this plugin possible.
|
package/lib/index.js
CHANGED
|
@@ -88,8 +88,8 @@ class FlumePlatform {
|
|
|
88
88
|
// Begin applying the user's config
|
|
89
89
|
for (const [key, val] of Object.entries(config)) {
|
|
90
90
|
switch (key) {
|
|
91
|
-
case '
|
|
92
|
-
case '
|
|
91
|
+
case 'clientId':
|
|
92
|
+
case 'clientSecret':
|
|
93
93
|
case 'password':
|
|
94
94
|
case 'username':
|
|
95
95
|
if (typeof val !== 'string' || val === '') {
|
|
@@ -161,8 +161,8 @@ class FlumePlatform {
|
|
|
161
161
|
if (
|
|
162
162
|
!this.config.username ||
|
|
163
163
|
!this.config.password ||
|
|
164
|
-
!this.config.
|
|
165
|
-
!this.config.
|
|
164
|
+
!this.config.clientId ||
|
|
165
|
+
!this.config.clientSecret
|
|
166
166
|
) {
|
|
167
167
|
throw new Error(this.lang.noCreds)
|
|
168
168
|
}
|
|
@@ -233,15 +233,20 @@ class FlumePlatform {
|
|
|
233
233
|
|
|
234
234
|
async flumeSync () {
|
|
235
235
|
try {
|
|
236
|
-
const
|
|
236
|
+
const since = this.lastSync
|
|
237
237
|
.toISOString()
|
|
238
238
|
.substring(0, 19)
|
|
239
239
|
.replace('T', ' ')
|
|
240
240
|
this.devicesInHB.forEach(async accessory => {
|
|
241
241
|
try {
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
const toReturn = { since }
|
|
243
|
+
const devInfo = await this.httpClient.getDeviceInfo(accessory.context.deviceId)
|
|
244
|
+
toReturn.devInfo = devInfo
|
|
245
|
+
const waterInfo = await this.httpClient.getWaterInfo(accessory.context.deviceId, since)
|
|
246
|
+
toReturn.waterInfo = waterInfo
|
|
247
|
+
const leakInfo = await this.httpClient.getLeakInfo(accessory.context.deviceId)
|
|
248
|
+
toReturn.leakInfo = leakInfo
|
|
249
|
+
accessory.control.externalUpdate(toReturn)
|
|
245
250
|
} catch (err) {
|
|
246
251
|
const eText = this.funcs.parseError(err)
|
|
247
252
|
this.log.warn('[%s] %s %s.', accessory.displayName, this.lang.devNotRef, eText)
|
package/lib/utils/constants.js
CHANGED
|
@@ -7,8 +7,8 @@ module.exports = {
|
|
|
7
7
|
name: 'Flume',
|
|
8
8
|
username: '',
|
|
9
9
|
password: '',
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
clientId: '',
|
|
11
|
+
clientSecret: '',
|
|
12
12
|
refreshInterval: 1,
|
|
13
13
|
threshold: 0,
|
|
14
14
|
disableDeviceLogging: false,
|
|
@@ -18,12 +18,12 @@ module.exports = {
|
|
|
18
18
|
},
|
|
19
19
|
|
|
20
20
|
defaultValues: {
|
|
21
|
-
refreshInterval:
|
|
21
|
+
refreshInterval: 2,
|
|
22
22
|
threshold: 0
|
|
23
23
|
},
|
|
24
24
|
|
|
25
25
|
minValues: {
|
|
26
|
-
refreshInterval:
|
|
26
|
+
refreshInterval: 2,
|
|
27
27
|
threshold: 0
|
|
28
28
|
},
|
|
29
29
|
|
package/lib/utils/lang-en.js
CHANGED
|
@@ -31,6 +31,7 @@ module.exports = {
|
|
|
31
31
|
initialising: 'Initialising plugin',
|
|
32
32
|
noCreds: 'Flume username and/or password and/or client id/secret not configured',
|
|
33
33
|
noDataReceived: 'No data received from request',
|
|
34
|
+
noRefreshToken: 'No refresh token has been retrieved',
|
|
34
35
|
noUserId: 'No user id has been retrieved',
|
|
35
36
|
pluginNotConf: 'Plugin has not been configured',
|
|
36
37
|
syncFailed: 'Sync process failed as',
|