homebridge-withings-environment-data 1.3.1 → 1.3.2
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 +23 -0
- package/README.md +8 -5
- package/config.schema.json +8 -3
- package/index.js +9 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## [1.3.2] - 2026-08-04
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- "Retain" checkbox in the MQTT fieldset (default off) to control whether
|
|
13
|
+
published MQTT messages set the retain flag
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- "Publish to MQTT" checkbox moved into the collapsed "MQTT" fieldset,
|
|
17
|
+
as its first item
|
|
18
|
+
- MQTT publishing now pauses once the newest reading is past the Stale
|
|
19
|
+
Data Warning Threshold, resuming once a fresher reading comes in —
|
|
20
|
+
previously it kept republishing the same stale reading on every poll
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- MQTT messages are no longer published with the retain flag set by
|
|
24
|
+
default (previously always retained)
|
|
25
|
+
- "Publish to MQTT" and "Retain" checkboxes now actually default to
|
|
26
|
+
unchecked in Config UI (an explicit `"default": false` wasn't being
|
|
27
|
+
applied by the schema form and rendered checked instead)
|
|
28
|
+
- When Retain is off, the plugin now clears any stale retained message
|
|
29
|
+
left on the broker from before (publishing with `retain:false` doesn't
|
|
30
|
+
remove an existing retained message on its own)
|
|
31
|
+
|
|
9
32
|
## [1.3.1] - 2026-08-03
|
|
10
33
|
|
|
11
34
|
### Fixed
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Withings Environment Data v1.3.
|
|
1
|
+
# Withings Environment Data v1.3.2
|
|
2
2
|
|
|
3
3
|
**This Homebridge plugin has been 100% vibe coded with Claude.**
|
|
4
4
|
|
|
@@ -55,9 +55,11 @@ turned on or off in Configuration:
|
|
|
55
55
|
plugin still polls Withings (and still publishes to MQTT, if enabled),
|
|
56
56
|
but doesn't create or update any HomeKit accessory.
|
|
57
57
|
- **Publish to MQTT** (default off): when on, every successful poll
|
|
58
|
-
publishes a
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
publishes a message to topic `withingsenv/ws-50` on the configured
|
|
59
|
+
broker, shaped like `{"temperature": 25.2, "co2_levels": 674}`. Messages
|
|
60
|
+
aren't retained unless the Retain option is enabled. Publishing pauses
|
|
61
|
+
once the data is stale (see Stale Data Warning Threshold below) and
|
|
62
|
+
resumes once a fresh reading comes in.
|
|
61
63
|
|
|
62
64
|
### Configuration
|
|
63
65
|
|
|
@@ -85,9 +87,10 @@ Fields:
|
|
|
85
87
|
Anything above the Inferior boundary is reported as Poor.
|
|
86
88
|
- **Expose sensors as HomeKit Accessories**: see [Usage](#usage) above.
|
|
87
89
|
Default on.
|
|
88
|
-
- **Publish to MQTT / Host / Port / Username / Password**: see
|
|
90
|
+
- **Publish to MQTT / Host / Port / Username / Password / Retain**: see
|
|
89
91
|
[Usage](#usage) above. Publishing is off by default; Port defaults to
|
|
90
92
|
1883. Username/Password are optional, for brokers that require auth.
|
|
93
|
+
Retain is off by default.
|
|
91
94
|
- **Stale Data Warning Threshold (hours)**: if the newest reading from the
|
|
92
95
|
scale itself (not the plugin's poll) is older than this many hours — e.g.
|
|
93
96
|
nobody's stood on the scale in a while — a warning is logged on every
|
package/config.schema.json
CHANGED
|
@@ -82,7 +82,6 @@
|
|
|
82
82
|
"publishToMqtt": {
|
|
83
83
|
"title": "Publish to MQTT",
|
|
84
84
|
"type": "boolean",
|
|
85
|
-
"default": false,
|
|
86
85
|
"description": "Publish sensor data to configured MQTT broker. Topic name: \"withingsenv/ws-50\""
|
|
87
86
|
},
|
|
88
87
|
"mqttHost": {
|
|
@@ -107,6 +106,11 @@
|
|
|
107
106
|
"type": "password"
|
|
108
107
|
}
|
|
109
108
|
},
|
|
109
|
+
"mqttRetain": {
|
|
110
|
+
"title": "Retain",
|
|
111
|
+
"type": "boolean",
|
|
112
|
+
"description": "Publish messages with the MQTT retain flag set, so new subscribers immediately get the last known reading."
|
|
113
|
+
},
|
|
110
114
|
"noResponseAfterMissedPolls": {
|
|
111
115
|
"title": "No Response After Missed Polls",
|
|
112
116
|
"type": "integer",
|
|
@@ -143,17 +147,18 @@
|
|
|
143
147
|
]
|
|
144
148
|
},
|
|
145
149
|
"exposeAsHomekitAccessories",
|
|
146
|
-
"publishToMqtt",
|
|
147
150
|
{
|
|
148
151
|
"type": "fieldset",
|
|
149
152
|
"title": "MQTT",
|
|
150
153
|
"expandable": true,
|
|
151
154
|
"expanded": false,
|
|
152
155
|
"items": [
|
|
156
|
+
"publishToMqtt",
|
|
153
157
|
"mqttHost",
|
|
154
158
|
"mqttPort",
|
|
155
159
|
"mqttUsername",
|
|
156
|
-
"mqttPassword"
|
|
160
|
+
"mqttPassword",
|
|
161
|
+
"mqttRetain"
|
|
157
162
|
]
|
|
158
163
|
},
|
|
159
164
|
{
|
package/index.js
CHANGED
|
@@ -239,13 +239,21 @@ class WithingsEnvironmentDataPlatform {
|
|
|
239
239
|
password: this.config.mqttPassword || undefined,
|
|
240
240
|
});
|
|
241
241
|
this.mqttClient.on('error', (err) => this.log.warn(`MQTT connection error: ${err.message}`));
|
|
242
|
+
if (this.config.mqttRetain !== true) {
|
|
243
|
+
// A publish with retain:false does NOT clear a previously-retained message —
|
|
244
|
+
// the broker keeps serving the last retained one until something explicitly
|
|
245
|
+
// clears it. Do that once per connect so turning Retain off actually stops
|
|
246
|
+
// new subscribers from seeing stale data.
|
|
247
|
+
this.mqttClient.on('connect', () => this.mqttClient.publish(MQTT_TOPIC, '', { retain: true }));
|
|
248
|
+
}
|
|
242
249
|
this.api.on('shutdown', () => this.mqttClient.end());
|
|
243
250
|
}
|
|
244
251
|
|
|
245
252
|
publishMqttReading() {
|
|
246
253
|
if (!this.mqttClient) return;
|
|
254
|
+
if (this.isDataStale()) return;
|
|
247
255
|
const payload = JSON.stringify({ temperature: this.lastReading.temperature, co2_levels: this.lastReading.co2 });
|
|
248
|
-
this.mqttClient.publish(MQTT_TOPIC, payload, { retain: true });
|
|
256
|
+
this.mqttClient.publish(MQTT_TOPIC, payload, { retain: this.config.mqttRetain === true });
|
|
249
257
|
}
|
|
250
258
|
|
|
251
259
|
setupServices(accessory) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-withings-environment-data",
|
|
3
3
|
"displayName": "Withings Environment Data",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.2",
|
|
5
5
|
"description": "Homebridge plugin exposing ambient CO2/air-quality and room temperature readings from a Withings WS-50 scale as HomeKit sensors",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|