homebridge-flume 3.0.4 → 3.0.5-beta.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/.vscode/settings.json +10 -0
- package/CHANGELOG.md +12 -0
- package/README.md +1 -3
- package/config.schema.json +12 -12
- package/dist/accessory.d.ts +26 -0
- package/dist/accessory.js +112 -0
- package/dist/accessory.js.map +1 -0
- package/dist/homebridge-ui/server.d.ts +1 -0
- package/dist/homebridge-ui/server.js +9 -0
- package/dist/homebridge-ui/server.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/lang/en.d.ts +27 -0
- package/dist/lang/en.js +38 -0
- package/dist/lang/en.js.map +1 -0
- package/dist/model/api.d.ts +34 -0
- package/dist/model/api.js +259 -0
- package/dist/model/api.js.map +1 -0
- package/dist/model/auth.d.ts +7 -0
- package/dist/model/auth.js +11 -0
- package/dist/model/auth.js.map +1 -0
- package/dist/model/device.d.ts +15 -0
- package/dist/model/device.js +39 -0
- package/dist/model/device.js.map +1 -0
- package/dist/model/types.d.ts +46 -0
- package/dist/model/types.js +2 -0
- package/dist/model/types.js.map +1 -0
- package/dist/platform.d.ts +17 -0
- package/dist/platform.js +99 -0
- package/dist/platform.js.map +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +15 -0
- package/dist/utils.js.map +1 -0
- package/example_responses/auth.json +18 -0
- package/example_responses/get_device_data.json +24 -0
- package/example_responses/get_devices.json +34 -0
- package/example_responses/get_leak_data.json +15 -0
- package/example_responses/get_usage_data.json +29 -0
- package/example_responses/jwt.json +9 -0
- package/package.json +6 -3
- package/src/accessory.ts +134 -0
- package/src/index.ts +12 -0
- package/src/lang/en.ts +43 -0
- package/src/model/api.ts +344 -0
- package/src/model/auth.ts +15 -0
- package/src/model/device.ts +53 -0
- package/src/model/types.ts +50 -0
- package/src/platform.ts +146 -0
- package/src/utils.ts +14 -0
- package/tsconfig.json +2 -2
- package/dist/settings.d.ts +0 -8
- package/dist/settings.js +0 -9
- package/dist/settings.js.map +0 -1
- package/lib/connection/http.js +0 -330
- package/lib/device/leak-sensor.js +0 -67
- package/lib/index.js +0 -7
- package/lib/platform.js +0 -334
- package/lib/settings.ts +0 -9
- package/lib/utils/constants.js +0 -22
- package/lib/utils/custom-chars.js +0 -55
- package/lib/utils/functions.js +0 -18
- package/lib/utils/lang-en.js +0 -43
- /package/{lib → src}/homebridge-ui/public/index.html +0 -0
- /package/{lib/homebridge-ui/server.js → src/homebridge-ui/server.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to homebridge-flume will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 3.0.5-beta.0 (2025-05-22)
|
|
6
|
+
|
|
7
|
+
# THIS BETA RELEASE IS A MAJOR REWRITE - PLEASE EXPECT SOME BUGS!
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
While there are no new features, this beta is a major rewrite to cleanup and modernize a lot of very old code. This will make it much easier to maintain and improve this plugin going forwards. As such, please expect some bugs.
|
|
12
|
+
|
|
13
|
+
If you run into any issues, please [open a ticket](https://github.com/mpatfield/homebridge-flume/issues) on GitHub.
|
|
14
|
+
|
|
15
|
+
Thanks for your patience and for helping to test!
|
|
16
|
+
|
|
5
17
|
## 3.0.4 (2025-05-19)
|
|
6
18
|
|
|
7
19
|
- Updating README and other metadata to reflect new plugin ownership
|
package/README.md
CHANGED
|
@@ -25,12 +25,10 @@ Once you have completed [Configuration](https://github.com/mpatfield/homebridge-
|
|
|
25
25
|
|
|
26
26
|
<img src="https://github.com/mpatfield/homebridge-flume/blob/latest/img/screenshot_1.png"> <img src="https://github.com/mpatfield/homebridge-flume/blob/latest/img/screenshot_2.png">
|
|
27
27
|
|
|
28
|
-
If you use a more advanced HomeKit app like
|
|
28
|
+
If you use a more advanced HomeKit app like [Eve](https://apps.apple.com/us/app/eve-for-matter-homekit/id917695792) or [Controller for Homekit](https://apps.apple.com/us/app/controller-for-homekit/id1198176727), you will see some additional information about your water use. Unfortunately, Apple currently doesn't offer a way to display this in the Home app.
|
|
29
29
|
|
|
30
30
|
<img src="https://github.com/mpatfield/homebridge-flume/blob/latest/img/screenshot_3.png">
|
|
31
31
|
|
|
32
|
-
Unfortunately, this is all the plugin is able to do. This is due to limitations in what HomeKit offers.
|
|
33
|
-
|
|
34
32
|
## Configuration
|
|
35
33
|
|
|
36
34
|
You'll need to get your API Access Client ID and Client Secret from the [Flume portal](https://portal.flumetech.com).
|
package/config.schema.json
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
"pluginType": "platform",
|
|
4
4
|
"singular": true,
|
|
5
5
|
"customUi": true,
|
|
6
|
-
"customUiPath": "./
|
|
6
|
+
"customUiPath": "./src/homebridge-ui",
|
|
7
7
|
"headerDisplay": "<p align=\"center\"><img width=\"60%\" src=\"https://github.com/mpatfield/homebridge-flume/blob/latest/img/banner.png\"></p><p align=\"center\">For help and support please visit <a href=\"https://github.com/mpatfield/homebridge-flume/\">GitHub</a>. We hope you find this plugin useful!</p>",
|
|
8
8
|
"schema": {
|
|
9
9
|
"type": "object",
|
|
10
|
+
"required": ["username", "password", "clientId", "clientSecret", "refreshInterval"],
|
|
10
11
|
"properties": {
|
|
11
12
|
"name": {
|
|
12
13
|
"title": "Plugin Name",
|
|
@@ -14,16 +15,14 @@
|
|
|
14
15
|
"default": "Flume"
|
|
15
16
|
},
|
|
16
17
|
"username": {
|
|
17
|
-
"title": "Username",
|
|
18
|
+
"title": "Flume Username",
|
|
18
19
|
"type": "string",
|
|
19
|
-
"required": true
|
|
20
|
-
"description": "Your Flume username."
|
|
20
|
+
"required": true
|
|
21
21
|
},
|
|
22
22
|
"password": {
|
|
23
|
-
"title": "Password",
|
|
23
|
+
"title": "Flume Password",
|
|
24
24
|
"type": "string",
|
|
25
|
-
"required": true
|
|
26
|
-
"description": "Your Flume password."
|
|
25
|
+
"required": true
|
|
27
26
|
},
|
|
28
27
|
"clientId": {
|
|
29
28
|
"title": "Client ID",
|
|
@@ -36,18 +35,20 @@
|
|
|
36
35
|
"type": "string",
|
|
37
36
|
"placeholder": "1234567890ABCDEFGHIJ",
|
|
38
37
|
"required": true,
|
|
39
|
-
"description": "Your Flume Client ID and Client Secret can be found at https://portal.flumetech.com
|
|
38
|
+
"description": "Your Flume Client ID and Client Secret can be found at https://portal.flumetech.com"
|
|
40
39
|
},
|
|
41
40
|
"disableDeviceLogging": {
|
|
42
41
|
"type": "boolean",
|
|
43
42
|
"title": "Disable Device Logging",
|
|
44
|
-
"
|
|
43
|
+
"default": false,
|
|
44
|
+
"description": "If true then accessory status changes will not be logged"
|
|
45
45
|
},
|
|
46
46
|
"refreshInterval": {
|
|
47
47
|
"title": "Refresh Interval",
|
|
48
48
|
"type": "integer",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
49
|
+
"default": 2,
|
|
50
|
+
"minimum": 1,
|
|
51
|
+
"description": "Number of minutes between requests to Flume for leak information"
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
},
|
|
@@ -60,7 +61,6 @@
|
|
|
60
61
|
{
|
|
61
62
|
"type": "fieldset",
|
|
62
63
|
"title": "Advanced Settings",
|
|
63
|
-
"description": "Advanced settings for the plugin, including refresh options.",
|
|
64
64
|
"expandable": true,
|
|
65
65
|
"items": ["disableDeviceLogging", "refreshInterval"]
|
|
66
66
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PlatformAccessory } from 'homebridge';
|
|
2
|
+
import { FlumePlatform } from './platform.js';
|
|
3
|
+
import { Device } from './model/device.js';
|
|
4
|
+
export declare class FlumeAccessory {
|
|
5
|
+
readonly platform: FlumePlatform;
|
|
6
|
+
readonly accessory: PlatformAccessory;
|
|
7
|
+
readonly device: Device;
|
|
8
|
+
private readonly HAP;
|
|
9
|
+
private readonly Characteristic;
|
|
10
|
+
private readonly Service;
|
|
11
|
+
private readonly leakService;
|
|
12
|
+
private isLeakDetected;
|
|
13
|
+
private isBatteryLow;
|
|
14
|
+
private isDisconnected;
|
|
15
|
+
private readonly charLeakDetected;
|
|
16
|
+
private readonly charStatusLowBattery;
|
|
17
|
+
private readonly charStatusFault;
|
|
18
|
+
private readonly todayUsageChar;
|
|
19
|
+
private readonly monthUsageChar;
|
|
20
|
+
private readonly lastMonthUsageChar;
|
|
21
|
+
constructor(platform: FlumePlatform, accessory: PlatformAccessory, device: Device);
|
|
22
|
+
private handleUpdate;
|
|
23
|
+
private updateCharacteristics;
|
|
24
|
+
private attachCustomCharacteristic;
|
|
25
|
+
private logState;
|
|
26
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import strings from './lang/en.js';
|
|
2
|
+
class CustomCharacteristic {
|
|
3
|
+
uuid;
|
|
4
|
+
name;
|
|
5
|
+
constructor(uuid, name) {
|
|
6
|
+
this.uuid = uuid;
|
|
7
|
+
this.name = name;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const TODAY_USAGE = new CustomCharacteristic('f25cc272-83cb-46a7-915a-259fa17364ed', strings.customCharTodayUsage);
|
|
11
|
+
const MONTH_USAGE = new CustomCharacteristic('580e224d-edf2-4c23-af79-cdbebfc509c5', strings.customCharMonthUsage);
|
|
12
|
+
const LAST_MONTH_USAGE = new CustomCharacteristic('69129d54-bdb8-46a1-a93b-f7e8d16d32a8', strings.customCharLastMonth);
|
|
13
|
+
export class FlumeAccessory {
|
|
14
|
+
platform;
|
|
15
|
+
accessory;
|
|
16
|
+
device;
|
|
17
|
+
HAP;
|
|
18
|
+
Characteristic;
|
|
19
|
+
Service;
|
|
20
|
+
leakService;
|
|
21
|
+
isLeakDetected = false;
|
|
22
|
+
isBatteryLow = false;
|
|
23
|
+
isDisconnected = true;
|
|
24
|
+
charLeakDetected;
|
|
25
|
+
charStatusLowBattery;
|
|
26
|
+
charStatusFault;
|
|
27
|
+
todayUsageChar;
|
|
28
|
+
monthUsageChar;
|
|
29
|
+
lastMonthUsageChar;
|
|
30
|
+
constructor(platform, accessory, device) {
|
|
31
|
+
this.platform = platform;
|
|
32
|
+
this.accessory = accessory;
|
|
33
|
+
this.device = device;
|
|
34
|
+
this.HAP = platform.api.hap;
|
|
35
|
+
this.Characteristic = this.HAP.Characteristic;
|
|
36
|
+
this.Service = this.HAP.Service;
|
|
37
|
+
accessory.getService(this.Service.AccessoryInformation)
|
|
38
|
+
.setCharacteristic(this.Characteristic.Name, strings.brand)
|
|
39
|
+
.setCharacteristic(this.Characteristic.ConfiguredName, strings.brand)
|
|
40
|
+
.setCharacteristic(this.Characteristic.Manufacturer, strings.brand)
|
|
41
|
+
.setCharacteristic(this.Characteristic.SerialNumber, device.id)
|
|
42
|
+
.setCharacteristic(this.Characteristic.Model, device.productName)
|
|
43
|
+
.setCharacteristic(this.Characteristic.Identify, true)
|
|
44
|
+
.setCharacteristic(this.Characteristic.FirmwareRevision, platform.packageVersion);
|
|
45
|
+
this.charLeakDetected = this.Characteristic.LeakDetected;
|
|
46
|
+
this.charStatusLowBattery = this.Characteristic.StatusLowBattery;
|
|
47
|
+
this.charStatusFault = this.Characteristic.StatusFault;
|
|
48
|
+
this.leakService = this.accessory.getService(this.HAP.Service.LeakSensor)
|
|
49
|
+
|| this.accessory.addService(this.HAP.Service.LeakSensor);
|
|
50
|
+
this.isLeakDetected = this.leakService.getCharacteristic(this.charLeakDetected).value === this.charLeakDetected.LEAK_DETECTED;
|
|
51
|
+
this.isBatteryLow = this.leakService.getCharacteristic(this.charStatusLowBattery).value === this.charStatusLowBattery.BATTERY_LEVEL_LOW;
|
|
52
|
+
this.isDisconnected = this.leakService.getCharacteristic(this.charStatusFault).value === this.charStatusFault.GENERAL_FAULT;
|
|
53
|
+
this.todayUsageChar = this.attachCustomCharacteristic(TODAY_USAGE);
|
|
54
|
+
this.monthUsageChar = this.attachCustomCharacteristic(MONTH_USAGE);
|
|
55
|
+
this.lastMonthUsageChar = this.attachCustomCharacteristic(LAST_MONTH_USAGE);
|
|
56
|
+
device.setOnUpdateCallback(this.handleUpdate.bind(this));
|
|
57
|
+
this.updateCharacteristics();
|
|
58
|
+
}
|
|
59
|
+
handleUpdate(id) {
|
|
60
|
+
if (id === this.device.id) {
|
|
61
|
+
this.updateCharacteristics();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
updateCharacteristics() {
|
|
65
|
+
if (this.device.isLeakDetected !== this.isLeakDetected) {
|
|
66
|
+
this.isLeakDetected = this.device.isLeakDetected;
|
|
67
|
+
const value = this.isLeakDetected ? this.charLeakDetected.LEAK_DETECTED : this.charLeakDetected.LEAK_NOT_DETECTED;
|
|
68
|
+
this.leakService.updateCharacteristic(this.charLeakDetected, value);
|
|
69
|
+
this.logState(this.isLeakDetected ? "error" /* LogLevel.ERROR */ : "info" /* LogLevel.INFO */, this.isLeakDetected ? strings.leakDetected : strings.leakNotDetected);
|
|
70
|
+
}
|
|
71
|
+
if (this.device.isBatteryLow !== this.isBatteryLow) {
|
|
72
|
+
this.isBatteryLow = this.device.isBatteryLow;
|
|
73
|
+
const value = this.isBatteryLow ? this.charStatusLowBattery.BATTERY_LEVEL_LOW : this.charStatusLowBattery.BATTERY_LEVEL_NORMAL;
|
|
74
|
+
this.leakService.updateCharacteristic(this.charStatusLowBattery, value);
|
|
75
|
+
this.logState(this.isBatteryLow ? "warn" /* LogLevel.WARN */ : "info" /* LogLevel.INFO */, this.isBatteryLow ? strings.batteryLow : strings.batteryNormal);
|
|
76
|
+
}
|
|
77
|
+
if (this.device.isDisconnected !== this.isDisconnected) {
|
|
78
|
+
this.isDisconnected = this.device.isDisconnected;
|
|
79
|
+
const value = this.isDisconnected ? this.charStatusFault.GENERAL_FAULT : this.charStatusFault.NO_FAULT;
|
|
80
|
+
this.leakService.updateCharacteristic(this.charStatusFault, value);
|
|
81
|
+
this.logState(this.isDisconnected ? "warn" /* LogLevel.WARN */ : "info" /* LogLevel.INFO */, this.isDisconnected ? strings.connectionFault : strings.connectionNormal);
|
|
82
|
+
}
|
|
83
|
+
this.todayUsageChar.updateValue(this.device.usageToday);
|
|
84
|
+
this.monthUsageChar.updateValue(this.device.usageMonth);
|
|
85
|
+
this.lastMonthUsageChar.updateValue(this.device.usageLastMonth);
|
|
86
|
+
}
|
|
87
|
+
attachCustomCharacteristic(char) {
|
|
88
|
+
let result;
|
|
89
|
+
if (this.leakService.testCharacteristic(char.name)) {
|
|
90
|
+
result = this.leakService.getCharacteristic(char.name);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const customCharacteristic = class TodayUsage extends this.Characteristic {
|
|
94
|
+
constructor() {
|
|
95
|
+
super(char.name, char.uuid, {
|
|
96
|
+
format: "uint32" /* Formats.UINT32 */,
|
|
97
|
+
perms: ["pr" /* Perms.PAIRED_READ */, "ev" /* Perms.NOTIFY */],
|
|
98
|
+
unit: strings.customCharUnits,
|
|
99
|
+
});
|
|
100
|
+
this.value = this.getDefaultValue();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
result = this.leakService.addCharacteristic(customCharacteristic);
|
|
104
|
+
result.UUID = char.uuid;
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
logState(level, message) {
|
|
109
|
+
this.platform.log.log(level, '[%s] %s', this.device.id, message);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=accessory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessory.js","sourceRoot":"","sources":["../src/accessory.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,cAAc,CAAC;AAGnC,MAAM,oBAAoB;IACH;IAAuB;IAA5C,YAAqB,IAAY,EAAW,IAAY;QAAnC,SAAI,GAAJ,IAAI,CAAQ;QAAW,SAAI,GAAJ,IAAI,CAAQ;IACxD,CAAC;CACF;AAED,MAAM,WAAW,GAAG,IAAI,oBAAoB,CAAC,sCAAsC,EAAE,OAAO,CAAC,oBAAoB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KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF;AAED,CAAC,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,CAAC,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FlumePlatform } from './platform.js';
|
|
2
|
+
export const PLATFORM_ALIAS = 'Flume';
|
|
3
|
+
/**
|
|
4
|
+
* This method registers the platform with Homebridge
|
|
5
|
+
*/
|
|
6
|
+
export default (api) => {
|
|
7
|
+
api.registerPlatform(PLATFORM_ALIAS, FlumePlatform);
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC;;GAEG;AACH,eAAe,CAAC,GAAQ,EAAE,EAAE;IAC1B,GAAG,CAAC,gBAAgB,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;AACtD,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare const langEn: {
|
|
2
|
+
brand: string;
|
|
3
|
+
redacted: string;
|
|
4
|
+
beta: string;
|
|
5
|
+
complete: string;
|
|
6
|
+
initializing: string;
|
|
7
|
+
newDevice: string;
|
|
8
|
+
removeDevice: string;
|
|
9
|
+
restoringDevice: string;
|
|
10
|
+
welcomeMessages: string[];
|
|
11
|
+
badConfig: string;
|
|
12
|
+
noDataReceived: string;
|
|
13
|
+
noDevices: string;
|
|
14
|
+
noRefreshToken: string;
|
|
15
|
+
httpRetry: string;
|
|
16
|
+
batteryLow: string;
|
|
17
|
+
batteryNormal: string;
|
|
18
|
+
connectionFault: string;
|
|
19
|
+
connectionNormal: string;
|
|
20
|
+
leakDetected: string;
|
|
21
|
+
leakNotDetected: string;
|
|
22
|
+
customCharMonthUsage: string;
|
|
23
|
+
customCharLastMonth: string;
|
|
24
|
+
customCharTodayUsage: string;
|
|
25
|
+
customCharUnits: string;
|
|
26
|
+
};
|
|
27
|
+
export default langEn;
|
package/dist/lang/en.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const langEn = {
|
|
2
|
+
// General
|
|
3
|
+
brand: 'Flume',
|
|
4
|
+
redacted: 'redacted',
|
|
5
|
+
// Startup
|
|
6
|
+
beta: 'This is a beta version of Flume. You will experience more logging than normal.',
|
|
7
|
+
complete: '✓ Setup complete',
|
|
8
|
+
initializing: 'Initializing plugin…',
|
|
9
|
+
newDevice: 'Adding new device:',
|
|
10
|
+
removeDevice: 'Removing device:',
|
|
11
|
+
restoringDevice: 'Restoring device:',
|
|
12
|
+
welcomeMessages: [
|
|
13
|
+
'Please ★ this plugin on GitHub if you\'re finding it useful! https://github.com/mpatfield/homebridge-flume',
|
|
14
|
+
'Would you like to sponsor this plugin? https://github.com/sponsors/mpatfield',
|
|
15
|
+
'This plugin currently has a 4★ rating on HOOBS! https://bit.ly/hb-flume-review',
|
|
16
|
+
'Want to see this plugin in your own language? Please create a ticket! https://github.com/mpatfield/homebridge-flume/issues',
|
|
17
|
+
],
|
|
18
|
+
// Errors
|
|
19
|
+
badConfig: 'One or more required variables are missing from the config. Please check the documentation. https://github.com/mpatfield/homebridge-flume',
|
|
20
|
+
noDataReceived: 'No data received from http request',
|
|
21
|
+
noDevices: 'No devices were found in your account',
|
|
22
|
+
noRefreshToken: 'No refresh token has been retrieved. Performing full auth instead…',
|
|
23
|
+
httpRetry: 'Request failed. Retrying in %s seconds…',
|
|
24
|
+
// Status
|
|
25
|
+
batteryLow: 'Battery is low',
|
|
26
|
+
batteryNormal: 'Battery is normal',
|
|
27
|
+
connectionFault: 'No connection detected',
|
|
28
|
+
connectionNormal: 'Connection restored',
|
|
29
|
+
leakDetected: 'Leak detected!',
|
|
30
|
+
leakNotDetected: 'No leaks detected',
|
|
31
|
+
// Custom Characteristic
|
|
32
|
+
customCharMonthUsage: 'Month Usage',
|
|
33
|
+
customCharLastMonth: 'Last Month',
|
|
34
|
+
customCharTodayUsage: 'Today Usage',
|
|
35
|
+
customCharUnits: 'Gallons',
|
|
36
|
+
};
|
|
37
|
+
export default langEn;
|
|
38
|
+
//# sourceMappingURL=en.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/lang/en.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;IAEb,UAAU;IACV,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IAEpB,UAAU;IACV,IAAI,EAAE,gFAAgF;IACtF,QAAQ,EAAE,kBAAkB;IAC5B,YAAY,EAAE,sBAAsB;IACpC,SAAS,EAAE,oBAAoB;IAC/B,YAAY,EAAE,kBAAkB;IAChC,eAAe,EAAE,mBAAmB;IACpC,eAAe,EAAE;QACf,4GAA4G;QAC5G,8EAA8E;QAC9E,gFAAgF;QAChF,4HAA4H;KAC7H;IAED,SAAS;IACT,SAAS,EAAE,2IAA2I;IACtJ,cAAc,EAAE,oCAAoC;IACpD,SAAS,EAAE,uCAAuC;IAClD,cAAc,EAAE,oEAAoE;IACpF,SAAS,EAAE,yCAAyC;IAEpD,SAAS;IACT,UAAU,EAAE,gBAAgB;IAC5B,aAAa,EAAE,mBAAmB;IAClC,eAAe,EAAE,wBAAwB;IACzC,gBAAgB,EAAE,qBAAqB;IACvC,YAAY,EAAE,gBAAgB;IAC9B,eAAe,EAAE,mBAAmB;IAEpC,wBAAwB;IACxB,oBAAoB,EAAE,aAAa;IACnC,mBAAmB,EAAE,YAAY;IACjC,oBAAoB,EAAE,aAAa;IACnC,eAAe,EAAE,SAAS;CAC3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Logger } from 'homebridge';
|
|
2
|
+
import { Device } from './device.js';
|
|
3
|
+
import * as Types from './types.js';
|
|
4
|
+
export declare class FlumeAPI {
|
|
5
|
+
private readonly username;
|
|
6
|
+
private readonly password;
|
|
7
|
+
private readonly clientId;
|
|
8
|
+
private readonly clientSecret;
|
|
9
|
+
private readonly refreshInterval;
|
|
10
|
+
private readonly log;
|
|
11
|
+
private readonly isBeta;
|
|
12
|
+
private auth?;
|
|
13
|
+
private userId?;
|
|
14
|
+
private readonly _devices;
|
|
15
|
+
private syncTimer;
|
|
16
|
+
private lastFullRefresh;
|
|
17
|
+
private constructor();
|
|
18
|
+
static login(username: string, password: string, clientId: string, clientSecret: string, refreshInterval: number, log: Logger, isBeta: boolean): Promise<FlumeAPI>;
|
|
19
|
+
get devices(): Device[];
|
|
20
|
+
teardown(): void;
|
|
21
|
+
private do;
|
|
22
|
+
private retryIfPossible;
|
|
23
|
+
private login;
|
|
24
|
+
private authRefresh;
|
|
25
|
+
private refreshAuthIfNecessary;
|
|
26
|
+
private startSyncTimer;
|
|
27
|
+
private getDevices;
|
|
28
|
+
private getDeviceData;
|
|
29
|
+
getLeakData(deviceId: string): Promise<Types.LeakData | null>;
|
|
30
|
+
private getUsageData;
|
|
31
|
+
private synchronizeData;
|
|
32
|
+
private logHTTP;
|
|
33
|
+
private logIfBeta;
|
|
34
|
+
}
|