@homebridge-plugins/homebridge-govee 11.34.2-beta.6 → 11.34.2-beta.7

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
@@ -19,7 +19,8 @@ All notable changes to `@homebridge-plugins/homebridge-govee` will be documented
19
19
  - fix: apply the openapi disable and refresh settings instead of asking for them to be removed
20
20
  - fix: say once when a bluetooth reading arrives for an unknown device, not on every broadcast
21
21
  - fix: reject a refresh time so large it would make the plugin poll every millisecond
22
- - fix(H5054): don't let a slow leak warning block other sensors
22
+ - fix(H5054): don't let a slow leak warning block other sensors (#1348)
23
+ - fix: mark sensor batteries low at the configured threshold
23
24
 
24
25
  ## v11.34.1 (2026-08-06)
25
26
 
@@ -53,6 +53,27 @@ export default class GoveeDevice {
53
53
  return !!existing
54
54
  }
55
55
 
56
+ updateBattery(battery) {
57
+ if (!this.battService || !Number.isFinite(battery) || battery < 0 || battery > 100) {
58
+ return
59
+ }
60
+
61
+ if (battery !== this.cacheBatt) {
62
+ this.cacheBatt = battery
63
+ this.battService.updateCharacteristic(this.hapChar.BatteryLevel, this.cacheBatt)
64
+ this.accessory.log(`${platformLang.curBatt} [${this.cacheBatt}%]`)
65
+ }
66
+
67
+ const lowBattery = battery <= this.lowBattThreshold ? 1 : 0
68
+ const currentLowBattery = Number(this.battService
69
+ .getCharacteristic(this.hapChar.StatusLowBattery)
70
+ .value)
71
+
72
+ if (lowBattery !== currentLowBattery) {
73
+ this.battService.updateCharacteristic(this.hapChar.StatusLowBattery, lowBattery)
74
+ }
75
+ }
76
+
56
77
  /**
57
78
  * Give up on a control, put it back the way it was, and tell HomeKit.
58
79
  *
@@ -47,19 +47,7 @@ export default class extends GoveeDevice {
47
47
  this.platform.updateAccessoryStatus(this.accessory, this.cacheOnline)
48
48
  }
49
49
 
50
- // Check to see if the provided battery is different from the cached state
51
- if (Number.isFinite(params.battery) && params.battery !== this.cacheBatt) {
52
- // Battery is different so update Homebridge with new values
53
- this.cacheBatt = params.battery
54
- this.battService.updateCharacteristic(this.hapChar.BatteryLevel, this.cacheBatt)
55
- this.battService.updateCharacteristic(
56
- this.hapChar.StatusLowBattery,
57
- this.cacheBatt < this.lowBattThreshold ? 1 : 0,
58
- )
59
-
60
- // Log the change
61
- this.accessory.log(`${platformLang.curBatt} [${this.cacheBatt}%]`)
62
- }
50
+ this.updateBattery(params.battery)
63
51
 
64
52
  // Check to see if the provided leak status is different from the cached state
65
53
  if (hasProperty(params, 'leakDetected') && params.leakDetected !== this.cacheLeak) {
@@ -104,19 +104,7 @@ export default class extends GoveeDevice {
104
104
  return
105
105
  }
106
106
 
107
- // Check to see if the provided battery is different from the cached state
108
- if (Number.isFinite(params.battery) && params.battery !== this.cacheBatt && this.battService) {
109
- // Battery is different so update Homebridge with new values
110
- this.cacheBatt = params.battery
111
- this.battService.updateCharacteristic(this.hapChar.BatteryLevel, this.cacheBatt)
112
- this.battService.updateCharacteristic(
113
- this.hapChar.StatusLowBattery,
114
- this.cacheBatt < this.lowBattThreshold ? 1 : 0,
115
- )
116
-
117
- // Log the change
118
- this.accessory.log(`${platformLang.curBatt} [${this.cacheBatt}%]`)
119
- }
107
+ this.updateBattery(params.battery)
120
108
 
121
109
  // Check to see if the provided temperature is different from the cached state
122
110
  if (hasProperty(params, 'temperature')) {
@@ -80,19 +80,7 @@ export default class extends GoveeDevice {
80
80
  return
81
81
  }
82
82
 
83
- // Check to see if the provided battery is different from the cached state
84
- if (Number.isFinite(params.battery) && params.battery !== this.cacheBatt && this.battService) {
85
- // Battery is different so update Homebridge with new values
86
- this.cacheBatt = params.battery
87
- this.battService.updateCharacteristic(this.hapChar.BatteryLevel, this.cacheBatt)
88
- this.battService.updateCharacteristic(
89
- this.hapChar.StatusLowBattery,
90
- this.cacheBatt < this.lowBattThreshold ? 1 : 0,
91
- )
92
-
93
- // Log the change
94
- this.accessory.log(`${platformLang.curBatt} [${this.cacheBatt}%]`)
95
- }
83
+ this.updateBattery(params.battery)
96
84
 
97
85
  // Check to see if the provided temperature is different from the cached state
98
86
  if (hasProperty(params, 'temperature')) {
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.34.2-beta.6",
5
+ "version": "11.34.2-beta.7",
6
6
  "description": "Homebridge plugin to integrate Govee devices into HomeKit.",
7
7
  "author": {
8
8
  "name": "bwp91",