homebridge-lg-thinq-2 2.0.5 → 2.0.6

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## v2.0.6
4
+
5
+ ### Reliability
6
+
7
+ * The default refresh interval is now 60 seconds, matching `config.schema.json`, instead of 5 seconds. The plugin asked LG for the full device list every 5 seconds as a fallback to MQTT, and LG now answers that with HTTP 429 (result code `9012`, "Please consider using the official API"). Invalid or zero values also fall back to 60 seconds. From [nVuln/homebridge-lg-thinq#395](https://github.com/nVuln/homebridge-lg-thinq/pull/395) by Frank Aune, fixing [nVuln/homebridge-lg-thinq#385](https://github.com/nVuln/homebridge-lg-thinq/issues/385).
8
+ * ThinQ1 devices, which only get updates from this refresh, now update every 60 seconds unless `refresh_interval` is set in the config.
9
+ * Documented the `refresh_interval` option in the README. The Homebridge UI does not show it, so it is set by editing the config JSON.
10
+
3
11
  ## v2.0.5
4
12
 
5
13
  Fixes from [nVuln/homebridge-lg-thinq#401](https://github.com/nVuln/homebridge-lg-thinq/pull/401) by Vojtech Knyttl, which was never merged in the original repository.
package/README.md CHANGED
@@ -107,6 +107,7 @@ To enable or configure only specific devices, list them by device id:
107
107
  | `language` | Yes | LG account language code, for example `en-US`. |
108
108
  | `devices` | No | Empty or omitted enables all supported discovered devices. |
109
109
  | `thinq1` | No | Advanced legacy option. Set to `true` manually to enable ThinQ1 devices. |
110
+ | `refresh_interval` | No | Seconds between device status refreshes from LG. Default `60`. ThinQ2 devices also get instant updates over MQTT, so this is only a fallback for them; ThinQ1 devices are updated only by this refresh. Low values can make LG reject requests with HTTP 429 (too many requests). |
110
111
 
111
112
  Device type is detected from LG discovery data. Device-specific settings appear in the Homebridge UI after devices have been discovered.
112
113
 
@@ -8,9 +8,14 @@ export function hasRequiredThinQConfig(config) {
8
8
  export function isThinQ1Enabled(config) {
9
9
  return config.thinq1 === true;
10
10
  }
11
+ // Matches the `refresh_interval` default declared in config.schema.json. ThinQ2
12
+ // devices receive real-time updates over MQTT, so polling is only a fallback and
13
+ // must not run aggressively or LG's API returns HTTP 429 (too many requests).
14
+ export const DEFAULT_REFRESH_INTERVAL_SECONDS = 60;
11
15
  export function refreshIntervalMs(config) {
12
- const seconds = Number(config.refresh_interval ?? 5);
13
- return Number.isFinite(seconds) && seconds > 0 ? seconds * 1000 : 5000;
16
+ const seconds = Number(config.refresh_interval ?? DEFAULT_REFRESH_INTERVAL_SECONDS);
17
+ const safeSeconds = Number.isFinite(seconds) && seconds > 0 ? seconds : DEFAULT_REFRESH_INTERVAL_SECONDS;
18
+ return safeSeconds * 1000;
14
19
  }
15
20
  export function isDeviceEnabled(config, device) {
16
21
  const devices = configuredDevices(config);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Homebridge LG ThinQ 2",
3
3
  "name": "homebridge-lg-thinq-2",
4
- "version": "2.0.5",
4
+ "version": "2.0.6",
5
5
  "description": "Community-maintained continuation of homebridge-lg-thinq: a Homebridge plugin for controlling/monitoring LG ThinQ devices via the LG ThinQ platform.",
6
6
  "license": "Apache-2.0",
7
7
  "type": "module",