homebridge-flume 1.1.0 → 1.2.3
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 +27 -0
- package/README.md +2 -1
- package/config.schema.json +15 -15
- package/lib/connection/http.js +22 -4
- package/lib/device/leak-sensor.js +13 -0
- package/lib/index.js +2 -1
- package/lib/utils/constants.js +2 -2
- package/lib/utils/custom-chars.js +13 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to homebridge-flume will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 1.2.3 (2022-01-03)
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- HOOBS certified badge on README
|
|
10
|
+
- Plugin will log HAPNodeJS version on startup
|
|
11
|
+
- Bump `homebridge` recommended version to v1.3.9
|
|
12
|
+
|
|
13
|
+
## 1.2.2 (2021-12-21)
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Some config options rearranged for easier access
|
|
18
|
+
|
|
19
|
+
## 1.2.1 (2021-12-08)
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Bump `homebridge` recommended version to v1.3.8
|
|
24
|
+
- Bump `node` recommended versions to v14.18.2 or v16.13.1
|
|
25
|
+
|
|
26
|
+
## 1.2.0 (2021-12-01)
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Previous month usage custom characteristic (viewable in HomeKit apps like Eve)
|
|
31
|
+
|
|
5
32
|
## 1.1.0 (2021-11-30)
|
|
6
33
|
|
|
7
34
|
### Added
|
package/README.md
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
Homebridge plugin to integrate Flume devices into HomeKit
|
|
9
9
|
|
|
10
|
-
[](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
|
|
10
|
+
[](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
|
|
11
|
+
[](https://plugins.hoobs.org/plugin/homebridge-thermobit)
|
|
11
12
|
[](https://www.npmjs.com/package/homebridge-flume)
|
|
12
13
|
[](https://github.com/bwp91/homebridge-flume/wiki/Beta-Version)
|
|
13
14
|
[](https://www.npmjs.com/package/homebridge-flume)
|
package/config.schema.json
CHANGED
|
@@ -39,17 +39,6 @@
|
|
|
39
39
|
"required": true,
|
|
40
40
|
"description": "Your Flume Client Secret, found at https://portal.flumetech.com."
|
|
41
41
|
},
|
|
42
|
-
"refreshInterval": {
|
|
43
|
-
"title": "Refresh Interval",
|
|
44
|
-
"type": "integer",
|
|
45
|
-
"placeholder": 2,
|
|
46
|
-
"description": "Number of minutes between updates. Must be 2 or more."
|
|
47
|
-
},
|
|
48
|
-
"disableDeviceLogging": {
|
|
49
|
-
"type": "boolean",
|
|
50
|
-
"title": "Disable Device Logging",
|
|
51
|
-
"description": "Global logging setting for accessory status changes. If true then accessory status changes will not be logged."
|
|
52
|
-
},
|
|
53
42
|
"debug": {
|
|
54
43
|
"title": "Debug Logging",
|
|
55
44
|
"type": "boolean",
|
|
@@ -59,6 +48,17 @@
|
|
|
59
48
|
"title": "Disable Plugin",
|
|
60
49
|
"type": "boolean",
|
|
61
50
|
"description": "If true, the plugin will remove all accessories and not load the plugin on restart."
|
|
51
|
+
},
|
|
52
|
+
"disableDeviceLogging": {
|
|
53
|
+
"type": "boolean",
|
|
54
|
+
"title": "Disable Device Logging",
|
|
55
|
+
"description": "Global logging setting for accessory status changes. If true then accessory status changes will not be logged."
|
|
56
|
+
},
|
|
57
|
+
"refreshInterval": {
|
|
58
|
+
"title": "Refresh Interval",
|
|
59
|
+
"type": "integer",
|
|
60
|
+
"placeholder": 2,
|
|
61
|
+
"description": "Number of minutes between updates. Must be 2 or more."
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
},
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
{
|
|
67
67
|
"type": "fieldset",
|
|
68
68
|
"title": "Required Settings",
|
|
69
|
-
"items": ["username", "password", "clientId", "clientSecret"]
|
|
69
|
+
"items": ["username", "password", "clientId", "clientSecret", "debug", "disablePlugin"]
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
"type": "fieldset",
|
|
73
|
-
"title": "
|
|
74
|
-
"description": "
|
|
73
|
+
"title": "Advanced Settings",
|
|
74
|
+
"description": "Advanced settings for the plugin, including refresh options.",
|
|
75
75
|
"expandable": true,
|
|
76
|
-
"items": ["
|
|
76
|
+
"items": ["disableDeviceLogging", "refreshInterval"]
|
|
77
77
|
}
|
|
78
78
|
]
|
|
79
79
|
}
|
package/lib/connection/http.js
CHANGED
|
@@ -237,8 +237,18 @@ module.exports = class connectionHTTP {
|
|
|
237
237
|
if (Date.now() > this.expiresIn) {
|
|
238
238
|
await this.renewToken()
|
|
239
239
|
}
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
|
|
241
|
+
// Generate dates for the query data
|
|
242
|
+
const date = new Date()
|
|
243
|
+
const startOfToday = date.toISOString().substring(0, 10) + ' 00:00:00'
|
|
244
|
+
|
|
245
|
+
// Set the date to the first of the current month
|
|
246
|
+
date.setDate(1)
|
|
247
|
+
const startOfCurrMonth = date.toISOString().substring(0, 10) + ' 00:00:00'
|
|
248
|
+
|
|
249
|
+
// Set the month to the previous month
|
|
250
|
+
date.setMonth(date.getMonth() - 1)
|
|
251
|
+
const startOfPrevMonth = date.toISOString().substring(0, 10) + ' 00:00:00'
|
|
242
252
|
|
|
243
253
|
// Generate the JSON data to send
|
|
244
254
|
const body = {
|
|
@@ -246,14 +256,22 @@ module.exports = class connectionHTTP {
|
|
|
246
256
|
{
|
|
247
257
|
request_id: 'today',
|
|
248
258
|
bucket: 'DAY',
|
|
249
|
-
since_datetime:
|
|
259
|
+
since_datetime: startOfToday,
|
|
250
260
|
operation: 'SUM',
|
|
251
261
|
units: 'GALLONS'
|
|
252
262
|
},
|
|
253
263
|
{
|
|
254
264
|
request_id: 'month',
|
|
255
265
|
bucket: 'MON',
|
|
256
|
-
since_datetime:
|
|
266
|
+
since_datetime: startOfCurrMonth,
|
|
267
|
+
operation: 'SUM',
|
|
268
|
+
units: 'GALLONS'
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
request_id: 'prevMonth',
|
|
272
|
+
bucket: 'MON',
|
|
273
|
+
since_datetime: startOfPrevMonth,
|
|
274
|
+
until_datetime: startOfCurrMonth,
|
|
257
275
|
operation: 'SUM',
|
|
258
276
|
units: 'GALLONS'
|
|
259
277
|
}
|
|
@@ -33,6 +33,9 @@ module.exports = class deviceLeakSensor {
|
|
|
33
33
|
if (!this.leakService.testCharacteristic(this.cusChar.MonthUsage)) {
|
|
34
34
|
this.leakService.addCharacteristic(this.cusChar.MonthUsage)
|
|
35
35
|
}
|
|
36
|
+
if (!this.leakService.testCharacteristic(this.cusChar.PrevMonthUsage)) {
|
|
37
|
+
this.leakService.addCharacteristic(this.cusChar.PrevMonthUsage)
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
externalUpdate (params) {
|
|
@@ -88,6 +91,16 @@ module.exports = class deviceLeakSensor {
|
|
|
88
91
|
params.waterInfo.month[0].value
|
|
89
92
|
)
|
|
90
93
|
}
|
|
94
|
+
if (
|
|
95
|
+
params.waterInfo.prevMonth &&
|
|
96
|
+
params.waterInfo.prevMonth[0] &&
|
|
97
|
+
this.funcs.hasProperty(params.waterInfo.prevMonth[0], 'value')
|
|
98
|
+
) {
|
|
99
|
+
this.leakService.updateCharacteristic(
|
|
100
|
+
this.cusChar.PrevMonthUsage,
|
|
101
|
+
params.waterInfo.prevMonth[0].value
|
|
102
|
+
)
|
|
103
|
+
}
|
|
91
104
|
}
|
|
92
105
|
}
|
|
93
106
|
}
|
package/lib/index.js
CHANGED
|
@@ -38,11 +38,12 @@ class FlumePlatform {
|
|
|
38
38
|
|
|
39
39
|
// Log some environment info for debugging
|
|
40
40
|
this.log(
|
|
41
|
-
'%s v%s | Node %s | HB v%s%s...',
|
|
41
|
+
'%s v%s | Node %s | HB v%s | HAPNodeJS v%s%s...',
|
|
42
42
|
this.lang.initialising,
|
|
43
43
|
plugin.version,
|
|
44
44
|
process.version,
|
|
45
45
|
api.serverVersion,
|
|
46
|
+
api.hap.HAPLibraryVersion(),
|
|
46
47
|
config.plugin_map
|
|
47
48
|
? ' | HOOBS v3'
|
|
48
49
|
: require('os')
|
package/lib/utils/constants.js
CHANGED
|
@@ -9,10 +9,10 @@ module.exports = {
|
|
|
9
9
|
password: '',
|
|
10
10
|
clientId: '',
|
|
11
11
|
clientSecret: '',
|
|
12
|
-
refreshInterval: 1,
|
|
13
|
-
disableDeviceLogging: false,
|
|
14
12
|
debug: false,
|
|
15
13
|
disablePlugin: false,
|
|
14
|
+
disableDeviceLogging: false,
|
|
15
|
+
refreshInterval: 1,
|
|
16
16
|
platform: 'Flume'
|
|
17
17
|
},
|
|
18
18
|
|
|
@@ -8,7 +8,8 @@ module.exports = class customCharacteristics {
|
|
|
8
8
|
this.hapChar = api.hap.Characteristic
|
|
9
9
|
this.uuids = {
|
|
10
10
|
todayUsage: 'E966F001-079E-48FF-8F27-9C2605A29F52',
|
|
11
|
-
monthUsage: 'E966F002-079E-48FF-8F27-9C2605A29F52'
|
|
11
|
+
monthUsage: 'E966F002-079E-48FF-8F27-9C2605A29F52',
|
|
12
|
+
prevMonthUsage: 'E966F003-079E-48FF-8F27-9C2605A29F52'
|
|
12
13
|
}
|
|
13
14
|
const self = this
|
|
14
15
|
this.TodayUsage = function () {
|
|
@@ -29,10 +30,21 @@ module.exports = class customCharacteristics {
|
|
|
29
30
|
})
|
|
30
31
|
this.value = this.getDefaultValue()
|
|
31
32
|
}
|
|
33
|
+
this.PrevMonthUsage = function () {
|
|
34
|
+
self.hapChar.call(this, 'Previous Month', self.uuids.prevMonthUsage)
|
|
35
|
+
this.setProps({
|
|
36
|
+
format: self.hapChar.Formats.UINT32,
|
|
37
|
+
perms: [self.hapChar.Perms.READ, self.hapChar.Perms.NOTIFY],
|
|
38
|
+
unit: 'Gallons'
|
|
39
|
+
})
|
|
40
|
+
this.value = this.getDefaultValue()
|
|
41
|
+
}
|
|
32
42
|
const inherits = require('util').inherits
|
|
33
43
|
inherits(this.TodayUsage, this.hapChar)
|
|
34
44
|
inherits(this.MonthUsage, this.hapChar)
|
|
45
|
+
inherits(this.PrevMonthUsage, this.hapChar)
|
|
35
46
|
this.TodayUsage.UUID = this.uuids.todayUsage
|
|
36
47
|
this.MonthUsage.UUID = this.uuids.monthUsage
|
|
48
|
+
this.PrevMonthUsage.UUID = this.uuids.prevMonthUsage
|
|
37
49
|
}
|
|
38
50
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-flume",
|
|
3
3
|
"alias": "Flume",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.3",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ben Potter",
|
|
7
7
|
"email": "bwp91@icloud.com"
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"water leak detector"
|
|
24
24
|
],
|
|
25
25
|
"engines": {
|
|
26
|
-
"homebridge": "^1.3.
|
|
27
|
-
"node": "^14.18.
|
|
26
|
+
"homebridge": "^1.3.9",
|
|
27
|
+
"node": "^14.18.2 || ^16.13.1"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|