@homebridge-plugins/homebridge-govee 11.32.2-beta.21 → 11.32.2-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.
Files changed (49) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/lib/device/appliance-basic.js +8 -20
  3. package/lib/device/base.js +80 -0
  4. package/lib/device/cooler-single.js +7 -22
  5. package/lib/device/dehumidifier-H7150.js +7 -25
  6. package/lib/device/diffuser-H7161.js +5 -18
  7. package/lib/device/fan-H1370.js +13 -46
  8. package/lib/device/fan-H7100.js +9 -32
  9. package/lib/device/fan-H7105.js +15 -53
  10. package/lib/device/fan-H7107.js +15 -53
  11. package/lib/device/heater-single.js +7 -22
  12. package/lib/device/heater1a.js +11 -40
  13. package/lib/device/heater1b.js +17 -61
  14. package/lib/device/heater2.js +23 -81
  15. package/lib/device/humidifier-H7140.js +9 -32
  16. package/lib/device/humidifier-H7141.js +7 -25
  17. package/lib/device/humidifier-H7142.js +13 -46
  18. package/lib/device/humidifier-H7143.js +7 -25
  19. package/lib/device/humidifier-H7160.js +13 -46
  20. package/lib/device/ice-maker-H7172.js +8 -25
  21. package/lib/device/index.js +2 -2
  22. package/lib/device/kettle.js +5 -16
  23. package/lib/device/light-switch.js +5 -18
  24. package/lib/device/light.js +14 -41
  25. package/lib/device/outlet-single.js +8 -18
  26. package/lib/device/purifier-H7120.js +14 -45
  27. package/lib/device/purifier-H7122.js +14 -45
  28. package/lib/device/purifier-H7123.js +14 -45
  29. package/lib/device/purifier-H7126.js +12 -38
  30. package/lib/device/purifier-single.js +7 -19
  31. package/lib/device/sensor-basic.js +3 -10
  32. package/lib/device/sensor-co2.js +3 -10
  33. package/lib/device/sensor-leak.js +4 -9
  34. package/lib/device/sensor-monitor.js +3 -10
  35. package/lib/device/sensor-presence.js +3 -10
  36. package/lib/device/sensor-probe.js +52 -0
  37. package/lib/device/sensor-thermo-switch.js +4 -9
  38. package/lib/device/sensor-thermo.js +4 -9
  39. package/lib/device/switch-double.js +6 -18
  40. package/lib/device/switch-single.js +6 -19
  41. package/lib/device/switch-triple.js +5 -18
  42. package/lib/device/tap-single.js +7 -19
  43. package/lib/device/template.js +3 -10
  44. package/lib/device/tv-single.js +6 -18
  45. package/lib/device/valve-single.js +7 -19
  46. package/lib/utils/constants.js +17 -3
  47. package/lib/utils/dispatch.js +1 -1
  48. package/package.json +1 -1
  49. package/lib/device/sensor-thermo4.js +0 -66
@@ -1,5 +1,6 @@
1
1
  import platformLang from '../utils/lang-en.js'
2
2
  import { logUnknownData } from '../utils/report-unknown.js'
3
+ import GoveeDevice from './base.js'
3
4
 
4
5
  /**
5
6
  * A sensor whose broadcasts are not decoded yet.
@@ -8,17 +9,9 @@ import { logUnknownData } from '../utils/report-unknown.js'
8
9
  * it does is report every message it receives in one copy-paste line, so an
9
10
  * owner can send in exactly what is needed to finish the model off.
10
11
  */
11
- export default class GoveeSensorBasic {
12
+ export default class GoveeSensorBasic extends GoveeDevice {
12
13
  constructor(platform, accessory) {
13
- // Set up variables from the platform
14
- this.hapChar = platform.api.hap.Characteristic
15
- this.hapErr = platform.api.hap.HapStatusError
16
- this.hapServ = platform.api.hap.Service
17
- this.platform = platform
18
-
19
- // Set up variables from the accessory
20
- this.accessory = accessory
21
-
14
+ super(platform, accessory)
22
15
  // Output the customised options to the log
23
16
  const opts = JSON.stringify({})
24
17
  platform.log('[%s] %s %s.', accessory.displayName, platformLang.devInitOpts, opts)
@@ -6,22 +6,15 @@ import {
6
6
  parseError,
7
7
  } from '../utils/functions.js'
8
8
  import platformLang from '../utils/lang-en.js'
9
+ import GoveeDevice from './base.js'
9
10
 
10
11
  // HomeKit triggers "CO2 detected" abnormal flag at this threshold (ppm).
11
12
  // Govee app default warn level is 1000 ppm; override via deviceConf.co2AbnormalThreshold.
12
13
  const DEFAULT_CO2_ABNORMAL_PPM = 1000
13
14
 
14
- export default class {
15
+ export default class extends GoveeDevice {
15
16
  constructor(platform, accessory) {
16
- // Set up variables from the platform
17
- this.hapChar = platform.api.hap.Characteristic
18
- this.hapErr = platform.api.hap.HapStatusError
19
- this.hapServ = platform.api.hap.Service
20
- this.platform = platform
21
-
22
- // Set up variables from the accessory
23
- this.accessory = accessory
24
-
17
+ super(platform, accessory)
25
18
  // Set up custom variables for this device type
26
19
  const deviceConf = platform.deviceConf[accessory.context.gvDeviceId] || {}
27
20
  this.co2AbnormalThreshold = deviceConf.co2AbnormalThreshold || DEFAULT_CO2_ABNORMAL_PPM
@@ -1,19 +1,14 @@
1
1
  import platformConsts from '../utils/constants.js'
2
2
  import { hasProperty } from '../utils/functions.js'
3
3
  import platformLang from '../utils/lang-en.js'
4
+ import GoveeDevice from './base.js'
4
5
 
5
- export default class {
6
+ export default class extends GoveeDevice {
6
7
  constructor(platform, accessory) {
8
+ super(platform, accessory)
9
+
7
10
  // Set up variables from the platform
8
11
  this.eveChar = platform.eveChar
9
- this.hapChar = platform.api.hap.Characteristic
10
- this.hapErr = platform.api.hap.HapStatusError
11
- this.hapServ = platform.api.hap.Service
12
- this.platform = platform
13
-
14
- // Set up variables from the accessory
15
- this.accessory = accessory
16
-
17
12
  // Set up custom variables for this device type
18
13
  const deviceConf = platform.deviceConf[accessory.context.gvDeviceId]
19
14
  this.lowBattThreshold = deviceConf && deviceConf.lowBattThreshold
@@ -9,18 +9,11 @@ import {
9
9
  parseError,
10
10
  } from '../utils/functions.js'
11
11
  import platformLang from '../utils/lang-en.js'
12
+ import GoveeDevice from './base.js'
12
13
 
13
- export default class {
14
+ export default class extends GoveeDevice {
14
15
  constructor(platform, accessory) {
15
- // Set up variables from the platform
16
- this.hapChar = platform.api.hap.Characteristic
17
- this.hapErr = platform.api.hap.HapStatusError
18
- this.hapServ = platform.api.hap.Service
19
- this.platform = platform
20
-
21
- // Set up variables from the accessory
22
- this.accessory = accessory
23
-
16
+ super(platform, accessory)
24
17
  // Set up custom variables for this device type
25
18
  const deviceConf = platform.deviceConf[accessory.context.gvDeviceId]
26
19
  this.lowBattThreshold = deviceConf && deviceConf.lowBattThreshold
@@ -1,18 +1,11 @@
1
1
  import { base64ToHex, getTwoItemPosition, hexToTwoItems } from '../utils/functions.js'
2
2
  import platformLang from '../utils/lang-en.js'
3
3
  import { logUnknownData } from '../utils/report-unknown.js'
4
+ import GoveeDevice from './base.js'
4
5
 
5
- export default class {
6
+ export default class extends GoveeDevice {
6
7
  constructor(platform, accessory) {
7
- // Set up variables from the platform
8
- this.hapChar = platform.api.hap.Characteristic
9
- this.hapErr = platform.api.hap.HapStatusError
10
- this.hapServ = platform.api.hap.Service
11
- this.platform = platform
12
-
13
- // Set up variables from the accessory
14
- this.accessory = accessory
15
-
8
+ super(platform, accessory)
16
9
  // Add the occupancy sensor if it does not already exist
17
10
  this.service = this.accessory.getService(this.hapServ.OccupancySensor) || this.accessory.addService(this.hapServ.OccupancySensor)
18
11
  this.cacheState = this.service.getCharacteristic(this.hapChar.OccupancyDetected).value
@@ -0,0 +1,52 @@
1
+ import { base64ToHex } from '../utils/functions.js'
2
+ import { logUnknownData } from '../utils/report-unknown.js'
3
+ import GoveeDevice from './base.js'
4
+
5
+ /**
6
+ * A meat thermometer: one or more probes, each reading its own temperature.
7
+ *
8
+ * None of these models has had its readings worked out yet. The H5198 was once
9
+ * given the ordinary thermometer tiles and it went badly - owners saw one probe
10
+ * out of four, stuck at its starting value (#338). A tile showing a number that
11
+ * never changes is worse than no tile, because there is no way to tell it apart
12
+ * from a real reading.
13
+ *
14
+ * So this offers nothing, and instead reports what the device sends in the form
15
+ * that can be pasted into an issue. One owner's log is all that is needed to
16
+ * turn these into real temperature tiles.
17
+ */
18
+ export default class extends GoveeDevice {
19
+ constructor(platform, accessory) {
20
+ super(platform, accessory)
21
+
22
+ // Clear the tiles a previous version gave this device, which never updated
23
+ this.removeServiceIfPresent(this.hapServ.TemperatureSensor)
24
+ this.removeServiceIfPresent(this.hapServ.HumiditySensor)
25
+ this.removeServiceIfPresent(this.hapServ.Battery)
26
+
27
+ this.logInitOptions({})
28
+ this.accessory.log('this thermometer\'s readings are not understood yet, so it has no tiles - the lines below are what is needed to add them')
29
+ }
30
+
31
+ externalUpdate(params) {
32
+ // The probe readings could arrive as raw commands or as fields on the
33
+ // update itself, and which is not known yet - so both are reported
34
+ ;(params.commands || []).forEach((command) => {
35
+ logUnknownData(this.accessory, {
36
+ kind: 'probe reading',
37
+ source: params.source,
38
+ raw: command,
39
+ hex: base64ToHex(command),
40
+ })
41
+ })
42
+
43
+ const fields = Object.keys(params).filter(key => !['commands', 'source'].includes(key))
44
+ if (fields.length > 0) {
45
+ logUnknownData(this.accessory, {
46
+ kind: 'probe update',
47
+ source: params.source,
48
+ raw: JSON.stringify(Object.fromEntries(fields.map(key => [key, params[key]]))),
49
+ })
50
+ }
51
+ }
52
+ }
@@ -6,19 +6,14 @@ import {
6
6
  parseError,
7
7
  } from '../utils/functions.js'
8
8
  import platformLang from '../utils/lang-en.js'
9
+ import GoveeDevice from './base.js'
9
10
 
10
- export default class {
11
+ export default class extends GoveeDevice {
11
12
  constructor(platform, accessory) {
13
+ super(platform, accessory)
14
+
12
15
  // Set up variables from the platform
13
- this.hapChar = platform.api.hap.Characteristic
14
- this.hapErr = platform.api.hap.HapStatusError
15
- this.hapServ = platform.api.hap.Service
16
- this.platform = platform
17
16
  this.httpTimeout = platform.config.bleRefreshTime * 4.5 * 1000
18
-
19
- // Set up variables from the accessory
20
- this.accessory = accessory
21
-
22
17
  // Set up custom variables for this device type
23
18
  const deviceConf = platform.deviceConf[accessory.context.gvDeviceId]
24
19
  this.lowBattThreshold = deviceConf && deviceConf.lowBattThreshold
@@ -6,19 +6,14 @@ import {
6
6
  parseError,
7
7
  } from '../utils/functions.js'
8
8
  import platformLang from '../utils/lang-en.js'
9
+ import GoveeDevice from './base.js'
9
10
 
10
- export default class {
11
+ export default class extends GoveeDevice {
11
12
  constructor(platform, accessory) {
13
+ super(platform, accessory)
14
+
12
15
  // Set up variables from the platform
13
- this.hapChar = platform.api.hap.Characteristic
14
- this.hapErr = platform.api.hap.HapStatusError
15
- this.hapServ = platform.api.hap.Service
16
- this.platform = platform
17
16
  this.httpTimeout = platform.config.bleRefreshTime * 4.5 * 1000
18
-
19
- // Set up variables from the accessory
20
- this.accessory = accessory
21
-
22
17
  // Set up custom variables for this device type
23
18
  const deviceConf = platform.deviceConf[accessory.context.gvDeviceId]
24
19
  this.lowBattThreshold = deviceConf && deviceConf.lowBattThreshold
@@ -1,5 +1,6 @@
1
- import { base64ToHex, parseError } from '../utils/functions.js'
1
+ import { base64ToHex } from '../utils/functions.js'
2
2
  import platformLang from '../utils/lang-en.js'
3
+ import GoveeDevice from './base.js'
3
4
 
4
5
  // Models that expose a night light. The H5089 reports its light as
5
6
  // `aa 1b 01 [on] [level]` and that reading is correct, so the tile shows the
@@ -8,17 +9,9 @@ import platformLang from '../utils/lang-en.js'
8
9
  // outright rather than accepted and silently dropped (#1323).
9
10
  const nightLightModels = ['H5089']
10
11
 
11
- class MultiSwitchDouble {
12
+ class MultiSwitchDouble extends GoveeDevice {
12
13
  constructor(platform, accessory, config) {
13
- // Set up variables from the platform
14
- this.hapChar = platform.api.hap.Characteristic
15
- this.hapErr = platform.api.hap.HapStatusError
16
- this.hapServ = platform.api.hap.Service
17
- this.platform = platform
18
-
19
- // Set up variables from the accessory
20
- this.accessory = accessory
21
-
14
+ super(platform, accessory)
22
15
  // Drop the tiles of the other kind, left behind if this device has been
23
16
  // shown as the other one before
24
17
  if (this.accessory.getService(`${config.other} 1`)) {
@@ -121,14 +114,9 @@ class MultiSwitchDouble {
121
114
  this.accessory.log(`[${service.getCharacteristic(this.hapChar.ConfiguredName).value}] ${platformLang.curState} [${newValue}]`)
122
115
  }
123
116
  } catch (err) {
124
- // Catch any errors during the process
125
- this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
126
-
127
- // Throw a 'no response' error and set a timeout to revert this after 2 seconds
128
- setTimeout(() => {
117
+ this.failUpdate(err, () => {
129
118
  service.updateCharacteristic(this.hapChar.On, service.cacheState === 'on')
130
- }, 2000)
131
- throw new this.hapErr(-70402)
119
+ })
132
120
  }
133
121
  }
134
122
 
@@ -1,19 +1,11 @@
1
- import { parseError } from '../utils/functions.js'
2
1
  import platformLang from '../utils/lang-en.js'
2
+ import GoveeDevice from './base.js'
3
3
 
4
- export default class {
4
+ export default class extends GoveeDevice {
5
5
  constructor(platform, accessory) {
6
- // Set up variables from the platform
7
- this.hapChar = platform.api.hap.Characteristic
8
- this.hapErr = platform.api.hap.HapStatusError
9
- this.hapServ = platform.api.hap.Service
10
- this.platform = platform
11
-
12
- // Set up variables from the accessory
13
- this.accessory = accessory;
14
-
6
+ super(platform, accessory)
15
7
  // Remove any old services from simulations
16
- ['AirPurifier', 'HeaterCooler', 'Lightbulb', 'Outlet', 'Valve'].forEach((service) => {
8
+ ;['AirPurifier', 'HeaterCooler', 'Lightbulb', 'Outlet', 'Valve'].forEach((service) => {
17
9
  if (this.accessory.getService(this.hapServ[service])) {
18
10
  this.accessory.removeService(this.accessory.getService(this.hapServ[service]))
19
11
  }
@@ -65,14 +57,9 @@ export default class {
65
57
  // Add the entry to the Eve history service
66
58
  this.accessory.eveService.addEntry({ status: value ? 1 : 0 })
67
59
  } catch (err) {
68
- // Catch any errors during the process
69
- this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
70
-
71
- // Throw a 'no response' error and set a timeout to revert this after 2 seconds
72
- setTimeout(() => {
60
+ this.failUpdate(err, () => {
73
61
  this.service.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
74
- }, 2000)
75
- throw new this.hapErr(-70402)
62
+ })
76
63
  }
77
64
  }
78
65
 
@@ -1,17 +1,9 @@
1
- import { parseError } from '../utils/functions.js'
2
1
  import platformLang from '../utils/lang-en.js'
2
+ import GoveeDevice from './base.js'
3
3
 
4
- class MultiSwitchTriple {
4
+ class MultiSwitchTriple extends GoveeDevice {
5
5
  constructor(platform, accessory, config) {
6
- // Set up variables from the platform
7
- this.hapChar = platform.api.hap.Characteristic
8
- this.hapErr = platform.api.hap.HapStatusError
9
- this.hapServ = platform.api.hap.Service
10
- this.platform = platform
11
-
12
- // Set up variables from the accessory
13
- this.accessory = accessory
14
-
6
+ super(platform, accessory)
15
7
  // Drop the tiles of the other kind, left behind if this device has been
16
8
  // shown as the other one before
17
9
  if (this.accessory.getService(`${config.other} 1`)) {
@@ -84,14 +76,9 @@ class MultiSwitchTriple {
84
76
  service.cacheState = newValue
85
77
  this.accessory.log(`[${service.displayName}] ${platformLang.curState} [${newValue}]`)
86
78
  } catch (err) {
87
- // Catch any errors during the process
88
- this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
89
-
90
- // Throw a 'no response' error and set a timeout to revert this after 2 seconds
91
- setTimeout(() => {
79
+ this.failUpdate(err, () => {
92
80
  service.updateCharacteristic(this.hapChar.On, service.cacheState === 'on')
93
- }, 2000)
94
- throw new this.hapErr(-70402)
81
+ })
95
82
  }
96
83
  }
97
84
 
@@ -1,19 +1,12 @@
1
- import { generateRandomString, parseError } from '../utils/functions.js'
1
+ import { generateRandomString } from '../utils/functions.js'
2
2
  import platformLang from '../utils/lang-en.js'
3
+ import GoveeDevice from './base.js'
3
4
 
4
- export default class {
5
+ export default class extends GoveeDevice {
5
6
  constructor(platform, accessory) {
6
- // Set up variables from the platform
7
- this.hapChar = platform.api.hap.Characteristic
8
- this.hapErr = platform.api.hap.HapStatusError
9
- this.hapServ = platform.api.hap.Service
10
- this.platform = platform
11
-
12
- // Set up variables from the accessory
13
- this.accessory = accessory;
14
-
7
+ super(platform, accessory)
15
8
  // Remove any old services from simulations
16
- ['AirPurifier', 'HeaterCooler', 'Lightbulb', 'Outlet', 'Switch'].forEach((service) => {
9
+ ;['AirPurifier', 'HeaterCooler', 'Lightbulb', 'Outlet', 'Switch'].forEach((service) => {
17
10
  if (this.accessory.getService(this.hapServ[service])) {
18
11
  this.accessory.removeService(this.accessory.getService(this.hapServ[service]))
19
12
  }
@@ -82,14 +75,9 @@ export default class {
82
75
  // Update the InUse characteristic
83
76
  this.service.updateCharacteristic(this.hapChar.InUse, value)
84
77
  } catch (err) {
85
- // Catch any errors during the process
86
- this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
87
-
88
- // Throw a 'no response' error and set a timeout to revert this after 2 seconds
89
- setTimeout(() => {
78
+ this.failUpdate(err, () => {
90
79
  this.service.updateCharacteristic(this.hapChar.Active, this.cacheState === 'on' ? 1 : 0)
91
- }, 2000)
92
- throw new this.hapErr(-70402)
80
+ })
93
81
  }
94
82
  }
95
83
 
@@ -1,18 +1,11 @@
1
1
  import { base64ToHex, getTwoItemPosition, hexToTwoItems } from '../utils/functions.js'
2
2
  import platformLang from '../utils/lang-en.js'
3
3
  import { logUnknownData } from '../utils/report-unknown.js'
4
+ import GoveeDevice from './base.js'
4
5
 
5
- export default class {
6
+ export default class extends GoveeDevice {
6
7
  constructor(platform, accessory) {
7
- // Set up variables from the platform
8
- this.hapChar = platform.api.hap.Characteristic
9
- this.hapErr = platform.api.hap.HapStatusError
10
- this.hapServ = platform.api.hap.Service
11
- this.platform = platform
12
-
13
- // Set up variables from the accessory
14
- this.accessory = accessory
15
-
8
+ super(platform, accessory)
16
9
  // Output the customised options to the log
17
10
  const opts = JSON.stringify({})
18
11
  platform.log('[%s] %s %s.', accessory.displayName, platformLang.devInitOpts, opts)
@@ -1,17 +1,10 @@
1
- import { generateRandomString, parseError } from '../utils/functions.js'
1
+ import { generateRandomString } from '../utils/functions.js'
2
2
  import platformLang from '../utils/lang-en.js'
3
+ import GoveeDevice from './base.js'
3
4
 
4
- export default class {
5
+ export default class extends GoveeDevice {
5
6
  constructor(platform, accessory) {
6
- // Set up variables from the platform
7
- this.hapChar = platform.api.hap.Characteristic
8
- this.hapErr = platform.api.hap.HapStatusError
9
- this.hapServ = platform.api.hap.Service
10
- this.platform = platform
11
-
12
- // Set up variables from the accessory
13
- this.accessory = accessory
14
-
7
+ super(platform, accessory)
15
8
  // Add the tv service if it doesn't already exist
16
9
  this.service = this.accessory.getService(this.hapServ.Television)
17
10
  || this.accessory.addService(this.hapServ.Television)
@@ -59,14 +52,9 @@ export default class {
59
52
  this.accessory.log(`${platformLang.curState} [${this.cacheState}]`)
60
53
  }
61
54
  } catch (err) {
62
- // Catch any errors during the process
63
- this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
64
-
65
- // Throw a 'no response' error and set a timeout to revert this after 2 seconds
66
- setTimeout(() => {
55
+ this.failUpdate(err, () => {
67
56
  this.service.updateCharacteristic(this.hapChar.Active, this.cacheState === 'on' ? 1 : 0)
68
- }, 2000)
69
- throw new this.hapErr(-70402)
57
+ })
70
58
  }
71
59
  }
72
60
 
@@ -1,19 +1,12 @@
1
- import { generateRandomString, parseError } from '../utils/functions.js'
1
+ import { generateRandomString } from '../utils/functions.js'
2
2
  import platformLang from '../utils/lang-en.js'
3
+ import GoveeDevice from './base.js'
3
4
 
4
- export default class {
5
+ export default class extends GoveeDevice {
5
6
  constructor(platform, accessory) {
6
- // Set up variables from the platform
7
- this.hapChar = platform.api.hap.Characteristic
8
- this.hapErr = platform.api.hap.HapStatusError
9
- this.hapServ = platform.api.hap.Service
10
- this.platform = platform
11
-
12
- // Set up variables from the accessory
13
- this.accessory = accessory;
14
-
7
+ super(platform, accessory)
15
8
  // Remove any old services from simulations
16
- ['AirPurifier', 'HeaterCooler', 'Lightbulb', 'Outlet', 'Switch'].forEach((service) => {
9
+ ;['AirPurifier', 'HeaterCooler', 'Lightbulb', 'Outlet', 'Switch'].forEach((service) => {
17
10
  if (this.accessory.getService(this.hapServ[service])) {
18
11
  this.accessory.removeService(this.accessory.getService(this.hapServ[service]))
19
12
  }
@@ -117,14 +110,9 @@ export default class {
117
110
  default:
118
111
  }
119
112
  } catch (err) {
120
- // Catch any errors during the process
121
- this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
122
-
123
- // Throw a 'no response' error and set a timeout to revert this after 2 seconds
124
- setTimeout(() => {
113
+ this.failUpdate(err, () => {
125
114
  this.service.updateCharacteristic(this.hapChar.Active, this.cacheState === 'on' ? 1 : 0)
126
- }, 2000)
127
- throw new this.hapErr(-70402)
115
+ })
128
116
  }
129
117
  }
130
118
 
@@ -657,7 +657,23 @@ export default {
657
657
  'H5310', // https://github.com/homebridge-plugins/homebridge-govee/issues/1293
658
658
  'R5112', // the refreshed H5112
659
659
  ],
660
- sensorThermo4: ['H5198'],
660
+ // Meat thermometers. None has had its readings worked out yet, so they
661
+ // report what they send rather than showing a tile that never changes.
662
+ // ⚠️ The H5183 is one of these but stays on the list above, because it has
663
+ // been given working tiles for years and nobody has said they are wrong
664
+ sensorProbe: [
665
+ 'H5181',
666
+ 'H5182',
667
+ 'H5184',
668
+ 'H5185', // https://github.com/homebridge-plugins/homebridge-govee/issues/804
669
+ 'H5191', // https://github.com/homebridge-plugins/homebridge-govee/issues/1121
670
+ 'H5192',
671
+ 'H5194',
672
+ 'H5196',
673
+ 'H5198',
674
+ 'H5199',
675
+ 'H5610',
676
+ ],
661
677
  sensorMonitor: ['H5106'],
662
678
  sensorCO2: ['H5140'], // CO2 + temp + humidity monitor, AWS opcode 0x0A — closes #1179
663
679
  fan: ['H1310', 'H1370', 'H7100', 'H7101', 'H7102', 'H7103', 'H7105', 'H7106', 'H7107', 'H7111', 'H7112', 'R1310'],
@@ -686,8 +702,6 @@ export default {
686
702
  'H5126', // https://github.com/homebridge-plugins/homebridge-govee/issues/910
687
703
  'H5129', // https://github.com/homebridge-plugins/homebridge-govee/issues/1084
688
704
  'H5125', // https://github.com/homebridge-plugins/homebridge-govee/issues/981
689
- 'H5185', // https://github.com/homebridge-plugins/homebridge-govee/issues/804
690
- 'H5191', // https://github.com/homebridge-plugins/homebridge-govee/issues/1121
691
705
  'H7184', // https://github.com/homebridge-plugins/homebridge-govee/issues/1282
692
706
  ],
693
707
  },
@@ -45,7 +45,7 @@ const routes = [
45
45
  list: 'sensorThermo',
46
46
  choose: ({ deviceConf }) => (deviceConf.showExtraSwitch ? 'deviceSensorThermoSwitch' : 'deviceSensorThermo'),
47
47
  },
48
- { list: 'sensorThermo4', handler: 'deviceSensorThermo4' },
48
+ { list: 'sensorProbe', handler: 'deviceSensorProbe' },
49
49
  { list: 'sensorMonitor', handler: 'deviceSensorMonitor', awsPolling: true },
50
50
  { list: 'sensorCO2', handler: 'deviceSensorCO2', awsPolling: true },
51
51
  { list: 'fan', prefix: 'deviceFan', fallback: 'deviceFanBasic' },
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.2-beta.21",
5
+ "version": "11.32.2-beta.23",
6
6
  "description": "Homebridge plugin to integrate Govee devices into HomeKit.",
7
7
  "author": {
8
8
  "name": "bwp91",
@@ -1,66 +0,0 @@
1
- import { base64ToHex, getTwoItemPosition, hexToTwoItems } from '../utils/functions.js'
2
- import platformLang from '../utils/lang-en.js'
3
- import { logUnknownData } from '../utils/report-unknown.js'
4
-
5
- export default class {
6
- constructor(platform, accessory) {
7
- // Set up variables from the platform
8
- this.hapChar = platform.api.hap.Characteristic
9
- this.hapErr = platform.api.hap.HapStatusError
10
- this.hapServ = platform.api.hap.Service
11
- this.platform = platform
12
-
13
- // Set up variables from the accessory
14
- this.accessory = accessory
15
-
16
- // remove temperature sensor, humidity sensor, battery service
17
- if (this.accessory.getService(this.hapServ.TemperatureSensor)) {
18
- this.accessory.removeService(this.accessory.getService(this.hapServ.TemperatureSensor))
19
- }
20
- if (this.accessory.getService(this.hapServ.HumiditySensor)) {
21
- this.accessory.removeService(this.accessory.getService(this.hapServ.HumiditySensor))
22
- }
23
- if (this.accessory.getService(this.hapServ.Battery)) {
24
- this.accessory.removeService(this.accessory.getService(this.hapServ.Battery))
25
- }
26
-
27
- // Output the customised options to the log
28
- const opts = JSON.stringify({})
29
- platform.log('[%s] %s %s.', accessory.displayName, platformLang.devInitOpts, opts)
30
- }
31
-
32
- externalUpdate(params) {
33
- this.accessory.logWarn(JSON.stringify(params, null, 2));
34
-
35
- // Check for some other scene/mode change
36
- (params.commands || []).forEach((command) => {
37
- const hexString = base64ToHex(command)
38
- const hexParts = hexToTwoItems(hexString)
39
-
40
- logUnknownData(this.accessory, {
41
- kind: 'scene',
42
- source: params.source,
43
- raw: command,
44
- hex: hexString,
45
- })
46
-
47
- // Return now if not a device query update code
48
- if (getTwoItemPosition(hexParts, 1) !== 'aa') {
49
- return
50
- }
51
-
52
- const deviceFunction = `${getTwoItemPosition(hexParts, 1)}${getTwoItemPosition(hexParts, 2)}`
53
-
54
- switch (deviceFunction) {
55
- default:
56
- logUnknownData(this.accessory, {
57
- kind: 'scene',
58
- source: params.source,
59
- raw: command,
60
- hex: hexString,
61
- })
62
- break
63
- }
64
- })
65
- }
66
- }