@homebridge-plugins/homebridge-govee 11.33.2-beta.2 → 11.33.2-beta.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 CHANGED
@@ -10,6 +10,7 @@ All notable changes to `@homebridge-plugins/homebridge-govee` will be documented
10
10
  - fix: stop the purifiers reporting their startup status as unrecognised scenes (#1340)
11
11
  - fix: report unrecognised device status as status rather than as scenes (#1340)
12
12
  - fix: include the payload when reporting an undecoded sensor's messages (#1340)
13
+ - feat: show the kettle's water temperature, once a reading has actually arrived (#1337)
13
14
 
14
15
  ## v11.33.1 (2026-08-04)
15
16
 
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  base64ToHex,
3
+ farToCen,
3
4
  getTwoItemPosition,
5
+ hexToDecimal,
4
6
  hexToTwoItems,
5
7
  sleep,
6
8
  } from '../utils/functions.js'
@@ -23,6 +25,32 @@ import GoveeDevice from './base.js'
23
25
  Black Tea/Boil: MwUABQAAAAAAAAAAAAAAAAAAADM= 3305000500000000000000000000000000000033 [switch]
24
26
  MwEBBQAAAAAAAAAAAAAAAAAAADY= 3301010500000000000000000000000000000036 [enable]
25
27
  */
28
+ /**
29
+ * The water temperature out of a status frame, in celsius.
30
+ *
31
+ * The frame carries it as two bytes of hundredths of a degree fahrenheit. That
32
+ * layout has never been confirmed against a kettle sitting at a known
33
+ * temperature, so the result is checked before it is used: a kettle holds
34
+ * water, and a figure outside freezing to a little past boiling is not a
35
+ * temperature at all - it means this model packs the frame differently.
36
+ * Returning nothing then leaves the tile absent rather than wrong.
37
+ *
38
+ * @param {string[]} hexParts the frame split into bytes
39
+ * @returns {number|undefined} the reading in celsius, or undefined if the
40
+ * frame does not look like one
41
+ */
42
+ function readingToCelsius(hexParts) {
43
+ const fahrenheit = hexToDecimal(
44
+ `${getTwoItemPosition(hexParts, 4)}${getTwoItemPosition(hexParts, 5)}`,
45
+ ) / 100
46
+
47
+ if (!Number.isFinite(fahrenheit) || fahrenheit < 32 || fahrenheit > 230) {
48
+ return undefined
49
+ }
50
+
51
+ return farToCen(fahrenheit)
52
+ }
53
+
26
54
  export default class extends GoveeDevice {
27
55
  constructor(platform, accessory) {
28
56
  super(platform, accessory)
@@ -125,10 +153,15 @@ export default class extends GoveeDevice {
125
153
  this.accessory.removeService(this.service6)
126
154
  }
127
155
 
128
- // Remove the temperature sensor service if it exists
129
- if (this.accessory.getService(this.hapServ.TemperatureSensor)) {
130
- this.accessory.removeService(this.accessory.getService(this.hapServ.TemperatureSensor))
131
- }
156
+ // The temperature tile is added the first time a reading actually arrives,
157
+ // not here - see readingToCelsius below. This device had one added up front
158
+ // once before, and because nothing ever updated it, owners were left with a
159
+ // tile stuck at its starting value. A number that never moves cannot be
160
+ // told apart from a real reading, so it is worse than no tile at all.
161
+ this.serviceTemp = this.accessory.getService(this.hapServ.TemperatureSensor)
162
+ this.cacheTemp = this.serviceTemp
163
+ ? this.serviceTemp.getCharacteristic(this.hapChar.CurrentTemperature).value
164
+ : undefined
132
165
 
133
166
  // Add a contact sensor service to reflect whether the kettle is on its base
134
167
  this.serviceOnBase = this.accessory.getService('On Base')
@@ -235,6 +268,32 @@ export default class extends GoveeDevice {
235
268
  }
236
269
  }
237
270
 
271
+ /**
272
+ * Show the water temperature, adding the tile the first time there is a real
273
+ * reading to put in it.
274
+ *
275
+ * @param {string} hexString the whole frame, for the log if it cannot be read
276
+ * @param {string[]} hexParts the frame split into bytes
277
+ */
278
+ updateCurrentTemperature(hexString, hexParts) {
279
+ const newTemp = readingToCelsius(hexParts)
280
+
281
+ if (newTemp === undefined) {
282
+ this.accessory.logDebug(`no temperature read from [${hexString}]`)
283
+ return
284
+ }
285
+
286
+ if (!this.serviceTemp) {
287
+ this.serviceTemp = this.accessory.addService(this.hapServ.TemperatureSensor)
288
+ }
289
+
290
+ if (newTemp !== this.cacheTemp) {
291
+ this.cacheTemp = newTemp
292
+ this.serviceTemp.updateCharacteristic(this.hapChar.CurrentTemperature, newTemp)
293
+ this.accessory.log(`${platformLang.curTemp} [${this.cacheTemp}°C]`)
294
+ }
295
+ }
296
+
238
297
  externalUpdate(params) {
239
298
  // Handle OpenAPI workMode
240
299
  if (params.workMode) {
@@ -286,9 +345,8 @@ export default class extends GoveeDevice {
286
345
  // No point in changing any switches for the sake of three seconds, no action taken here
287
346
  break
288
347
  }
289
- case '1001': { // current temperature in F
290
- // const currentTempInF = hexToDecimal(`${getTwoItemPosition(hexParts, 4)}${getTwoItemPosition(hexParts, 5)}`);
291
- // const currentTempInC = farToCen(currentTempInF / 100);
348
+ case '1001': { // current temperature of the water
349
+ this.updateCurrentTemperature(hexString, hexParts)
292
350
  break
293
351
  }
294
352
  case '1700': { // on/off base?
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@homebridge-plugins/homebridge-govee",
3
3
  "alias": "Govee",
4
4
  "type": "module",
5
- "version": "11.33.2-beta.2",
5
+ "version": "11.33.2-beta.3",
6
6
  "description": "Homebridge plugin to integrate Govee devices into HomeKit.",
7
7
  "author": {
8
8
  "name": "bwp91",