homebridge-winix-purifiers 1.2.0 → 1.3.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/README.md +23 -11
- package/config.schema.json +3 -2
- package/dist/accessory.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# homebridge-winix-purifiers
|
|
2
2
|
|
|
3
|
+
[](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
|
|
3
4
|
[](https://github.com/regaw-leinad/homebridge-winix-purifiers/actions)
|
|
4
5
|
[](https://www.npmjs.com/package/homebridge-winix-purifiers)
|
|
5
6
|
|
|
@@ -30,6 +31,15 @@ The following features are optionally supported:
|
|
|
30
31
|
* Expose ambient light
|
|
31
32
|
* Expose switch to turn Plasmawave `on` / `off`
|
|
32
33
|
|
|
34
|
+
### Winix API Response Caching
|
|
35
|
+
|
|
36
|
+
By default, all individual responses from the Winix API are cached for `60` seconds. This helps prevent rate limiting
|
|
37
|
+
and reduces the number of requests made to the Winix API. The value can be configured with the `cacheIntervalSeconds`
|
|
38
|
+
property (see [Properties](#properties) below).
|
|
39
|
+
|
|
40
|
+
I personally have `cacheIntervalSeconds` set to `600` seconds (10 minutes) since I don't need to know the air quality
|
|
41
|
+
every minute - this significantly reduces the number of requests made to the Winix API.
|
|
42
|
+
|
|
33
43
|
## Device Support
|
|
34
44
|
|
|
35
45
|
Currently, this plugin supports the following Winix air purifiers
|
|
@@ -62,7 +72,8 @@ In your `config.json`, add and update the following under the `accessories` sect
|
|
|
62
72
|
"serialNumber": "WNXAI40001234",
|
|
63
73
|
"exposeAirQuality": true,
|
|
64
74
|
"exposeAmbientLight": false,
|
|
65
|
-
"exposePlasmawave": false
|
|
75
|
+
"exposePlasmawave": false,
|
|
76
|
+
"cacheIntervalSeconds": 60
|
|
66
77
|
}
|
|
67
78
|
]
|
|
68
79
|
}
|
|
@@ -70,16 +81,17 @@ In your `config.json`, add and update the following under the `accessories` sect
|
|
|
70
81
|
|
|
71
82
|
### Properties
|
|
72
83
|
|
|
73
|
-
|
|
|
74
|
-
|
|
75
|
-
| `accessory`
|
|
76
|
-
| `name`
|
|
77
|
-
| `model`
|
|
78
|
-
| `deviceId`
|
|
79
|
-
| `serialNumber`
|
|
80
|
-
| `exposeAirQuality`
|
|
81
|
-
| `exposeAmbientLight` |
|
|
82
|
-
| `exposePlasmawave`
|
|
84
|
+
| Name | Default Value | Note |
|
|
85
|
+
|------------------------|---------------|---------------------------------------------------------------------------------|
|
|
86
|
+
| `accessory` | Required | must always be set to `WinixPurifier` |
|
|
87
|
+
| `name` | Required | a human-readable name for the air purifier |
|
|
88
|
+
| `model` | Required | the model of the [supported air purifier](#Device-Support) |
|
|
89
|
+
| `deviceId` | Required | the unique identifier of the device (see below for details on how to find this) |
|
|
90
|
+
| `serialNumber` | null | the serial number of the device |
|
|
91
|
+
| `exposeAirQuality` | `false` | whether to expose an air quality sensor |
|
|
92
|
+
| `exposeAmbientLight` | `false` | whether to expose an ambient light sensor |
|
|
93
|
+
| `exposePlasmawave` | `false` | whether to expose Plasmawave control as a `Switch` |
|
|
94
|
+
| `cacheIntervalSeconds` | `60` | the amount of seconds to cache the responses from the Winix API |
|
|
83
95
|
|
|
84
96
|
## Device ids
|
|
85
97
|
|
package/config.schema.json
CHANGED
|
@@ -63,8 +63,9 @@
|
|
|
63
63
|
"cacheIntervalSeconds": {
|
|
64
64
|
"title": "Winix Response Cache Interval (seconds)",
|
|
65
65
|
"description": "Time, in seconds, for how long to reuse the cached response from Winix",
|
|
66
|
-
"type": "
|
|
67
|
-
"default":
|
|
66
|
+
"type": "integer",
|
|
67
|
+
"default": 60,
|
|
68
|
+
"minimum": 1,
|
|
68
69
|
"required": true
|
|
69
70
|
}
|
|
70
71
|
}
|
package/dist/accessory.js
CHANGED
|
@@ -11,7 +11,7 @@ class WinixPurifierAccessory {
|
|
|
11
11
|
const deviceName = config.name;
|
|
12
12
|
this.deviceId = config.deviceId;
|
|
13
13
|
this.latestStatus = {};
|
|
14
|
-
this.
|
|
14
|
+
this.cacheIntervalMs = config.cacheIntervalSeconds * 1000 || 60000;
|
|
15
15
|
this.lastWinixPoll = -1;
|
|
16
16
|
this.services = [];
|
|
17
17
|
// Create services
|
|
@@ -350,7 +350,7 @@ class WinixPurifierAccessory {
|
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
shouldUseCachedValue(v) {
|
|
353
|
-
return v !== undefined && Date.now() - this.lastWinixPoll < this.
|
|
353
|
+
return v !== undefined && Date.now() - this.lastWinixPoll < this.cacheIntervalMs;
|
|
354
354
|
}
|
|
355
355
|
polledWinix() {
|
|
356
356
|
this.lastWinixPoll = Date.now();
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"private": false,
|
|
3
3
|
"displayName": "Winix Air Purifiers",
|
|
4
4
|
"name": "homebridge-winix-purifiers",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.3.0",
|
|
6
6
|
"description": "Homebridge plugin for Winix air purifiers",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"repository": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"winix air purifier"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"axios": "
|
|
42
|
+
"axios": "1.6.0",
|
|
43
43
|
"winix-api": "1.1.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|