@homebridge-plugins/homebridge-govee 11.32.0-beta.21 → 11.32.0-beta.23

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
@@ -20,6 +20,8 @@ All notable changes to `@homebridge-plugins/homebridge-govee` will be documented
20
20
  - chore: log what each device can do according to the govee openapi, in debug mode, to make working out new device support quicker
21
21
  - chore: decode the status codes a device reports into readable hex in debug mode, so support for new device features can be worked out from a normal log
22
22
  - feat: add the H5089 night light as a homekit light tile with on, off and brightness (#1323)
23
+ - fix: send the H5089 night light commands as the newer ptIot type the plug listens for, instead of being silently ignored (#1323)
24
+ - fix: also send the H5089 night light the command shape the supported govee purifiers use, since mirroring the plug's own status code was not enough on its own (#1323)
23
25
 
24
26
  ## v11.31.0 (2026-07-24)
25
27
 
@@ -132,6 +132,34 @@ export default class {
132
132
  }
133
133
  }
134
134
 
135
+ // Govee does not use one night light command across its range: the purifiers
136
+ // that already work here send `33 18 [on] [level]`, while this plug reports
137
+ // its light as `aa 1b 01 [on] [level]`. Mirroring the status code was not
138
+ // enough on its own, so send both shapes - they express the same thing, so
139
+ // whichever the plug ignores costs nothing. Once it is known which one lands
140
+ // this drops to that one alone (#1323)
141
+ async sendLightCommand(state, level) {
142
+ const shapes = [
143
+ [0x33, 0x1B, 0x01, state, level],
144
+ [0x33, 0x18, state, level],
145
+ ]
146
+ let lastError
147
+ for (const hexValues of shapes) {
148
+ try {
149
+ await this.platform.sendDeviceUpdate(this.accessory, {
150
+ // This plug acks the app's commands as `ptIot` and ignores `ptReal`
151
+ cmd: 'ptIot',
152
+ value: generateCodeFromHexValues(hexValues),
153
+ })
154
+ } catch (err) {
155
+ lastError = err
156
+ }
157
+ }
158
+ if (lastError) {
159
+ throw lastError
160
+ }
161
+ }
162
+
135
163
  async internalLightStateUpdate(value) {
136
164
  try {
137
165
  const newValue = value ? 'on' : 'off'
@@ -141,10 +169,7 @@ export default class {
141
169
 
142
170
  // Keep the current level when toggling, so turning the light on does not
143
171
  // also change how bright it is
144
- await this.platform.sendDeviceUpdate(this.accessory, {
145
- cmd: 'ptReal',
146
- value: generateCodeFromHexValues([0x33, 0x1B, 0x01, value ? 0x01 : 0x00, this.cacheLightBright]),
147
- })
172
+ await this.sendLightCommand(value ? 0x01 : 0x00, this.cacheLightBright)
148
173
 
149
174
  this.cacheLightState = newValue
150
175
  this.accessory.log(`[Night Light] ${platformLang.curState} [${newValue}]`)
@@ -165,10 +190,7 @@ export default class {
165
190
 
166
191
  // Setting a level also turns the light on, matching how HomeKit sends
167
192
  // brightness changes alongside an on command
168
- await this.platform.sendDeviceUpdate(this.accessory, {
169
- cmd: 'ptReal',
170
- value: generateCodeFromHexValues([0x33, 0x1B, 0x01, 0x01, value]),
171
- })
193
+ await this.sendLightCommand(0x01, value)
172
194
 
173
195
  this.cacheLightBright = value
174
196
  this.accessory.log(`[Night Light] ${platformLang.curBright} [${value}%]`)
@@ -132,6 +132,34 @@ export default class {
132
132
  }
133
133
  }
134
134
 
135
+ // Govee does not use one night light command across its range: the purifiers
136
+ // that already work here send `33 18 [on] [level]`, while this plug reports
137
+ // its light as `aa 1b 01 [on] [level]`. Mirroring the status code was not
138
+ // enough on its own, so send both shapes - they express the same thing, so
139
+ // whichever the plug ignores costs nothing. Once it is known which one lands
140
+ // this drops to that one alone (#1323)
141
+ async sendLightCommand(state, level) {
142
+ const shapes = [
143
+ [0x33, 0x1B, 0x01, state, level],
144
+ [0x33, 0x18, state, level],
145
+ ]
146
+ let lastError
147
+ for (const hexValues of shapes) {
148
+ try {
149
+ await this.platform.sendDeviceUpdate(this.accessory, {
150
+ // This plug acks the app's commands as `ptIot` and ignores `ptReal`
151
+ cmd: 'ptIot',
152
+ value: generateCodeFromHexValues(hexValues),
153
+ })
154
+ } catch (err) {
155
+ lastError = err
156
+ }
157
+ }
158
+ if (lastError) {
159
+ throw lastError
160
+ }
161
+ }
162
+
135
163
  async internalLightStateUpdate(value) {
136
164
  try {
137
165
  const newValue = value ? 'on' : 'off'
@@ -141,10 +169,7 @@ export default class {
141
169
 
142
170
  // Keep the current level when toggling, so turning the light on does not
143
171
  // also change how bright it is
144
- await this.platform.sendDeviceUpdate(this.accessory, {
145
- cmd: 'ptReal',
146
- value: generateCodeFromHexValues([0x33, 0x1B, 0x01, value ? 0x01 : 0x00, this.cacheLightBright]),
147
- })
172
+ await this.sendLightCommand(value ? 0x01 : 0x00, this.cacheLightBright)
148
173
 
149
174
  this.cacheLightState = newValue
150
175
  this.accessory.log(`[Night Light] ${platformLang.curState} [${newValue}]`)
@@ -165,10 +190,7 @@ export default class {
165
190
 
166
191
  // Setting a level also turns the light on, matching how HomeKit sends
167
192
  // brightness changes alongside an on command
168
- await this.platform.sendDeviceUpdate(this.accessory, {
169
- cmd: 'ptReal',
170
- value: generateCodeFromHexValues([0x33, 0x1B, 0x01, 0x01, value]),
171
- })
193
+ await this.sendLightCommand(0x01, value)
172
194
 
173
195
  this.cacheLightBright = value
174
196
  this.accessory.log(`[Night Light] ${platformLang.curBright} [${value}%]`)
@@ -21,6 +21,7 @@ export function buildCommand(params, context) {
21
21
  case 'stateHeat':
22
22
  return buildStateHeatCommand(params)
23
23
  case 'multiSync':
24
+ case 'ptIot':
24
25
  case 'ptReal':
25
26
  return buildPtRealCommand(params)
26
27
  case 'openApi':
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.32.0-beta.21",
5
+ "version": "11.32.0-beta.23",
6
6
  "description": "Homebridge plugin to integrate Govee devices into HomeKit.",
7
7
  "author": {
8
8
  "name": "bwp91",