@homebridge-plugins/homebridge-govee 11.32.2-beta.21 → 11.32.2-beta.22
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 +1 -0
- package/lib/device/appliance-basic.js +8 -20
- package/lib/device/base.js +80 -0
- package/lib/device/cooler-single.js +7 -22
- package/lib/device/dehumidifier-H7150.js +7 -25
- package/lib/device/diffuser-H7161.js +5 -18
- package/lib/device/fan-H1370.js +13 -46
- package/lib/device/fan-H7100.js +9 -32
- package/lib/device/fan-H7105.js +15 -53
- package/lib/device/fan-H7107.js +15 -53
- package/lib/device/heater-single.js +7 -22
- package/lib/device/heater1a.js +11 -40
- package/lib/device/heater1b.js +17 -61
- package/lib/device/heater2.js +23 -81
- package/lib/device/humidifier-H7140.js +9 -32
- package/lib/device/humidifier-H7141.js +7 -25
- package/lib/device/humidifier-H7142.js +13 -46
- package/lib/device/humidifier-H7143.js +7 -25
- package/lib/device/humidifier-H7160.js +13 -46
- package/lib/device/ice-maker-H7172.js +8 -25
- package/lib/device/kettle.js +5 -16
- package/lib/device/light-switch.js +5 -18
- package/lib/device/light.js +14 -41
- package/lib/device/outlet-single.js +8 -18
- package/lib/device/purifier-H7120.js +14 -45
- package/lib/device/purifier-H7122.js +14 -45
- package/lib/device/purifier-H7123.js +14 -45
- package/lib/device/purifier-H7126.js +12 -38
- package/lib/device/purifier-single.js +7 -19
- package/lib/device/sensor-basic.js +3 -10
- package/lib/device/sensor-co2.js +3 -10
- package/lib/device/sensor-leak.js +4 -9
- package/lib/device/sensor-monitor.js +3 -10
- package/lib/device/sensor-presence.js +3 -10
- package/lib/device/sensor-thermo-switch.js +4 -9
- package/lib/device/sensor-thermo.js +4 -9
- package/lib/device/sensor-thermo4.js +3 -10
- package/lib/device/switch-double.js +6 -18
- package/lib/device/switch-single.js +6 -19
- package/lib/device/switch-triple.js +5 -18
- package/lib/device/tap-single.js +7 -19
- package/lib/device/template.js +3 -10
- package/lib/device/tv-single.js +6 -18
- package/lib/device/valve-single.js +7 -19
- package/package.json +1 -1
|
@@ -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,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
|
-
|
|
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
|
// remove temperature sensor, humidity sensor, battery service
|
|
17
10
|
if (this.accessory.getService(this.hapServ.TemperatureSensor)) {
|
|
18
11
|
this.accessory.removeService(this.accessory.getService(this.hapServ.TemperatureSensor))
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { base64ToHex
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
94
|
-
throw new this.hapErr(-70402)
|
|
81
|
+
})
|
|
95
82
|
}
|
|
96
83
|
}
|
|
97
84
|
|
package/lib/device/tap-single.js
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import { generateRandomString
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
92
|
-
throw new this.hapErr(-70402)
|
|
80
|
+
})
|
|
93
81
|
}
|
|
94
82
|
}
|
|
95
83
|
|
package/lib/device/template.js
CHANGED
|
@@ -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
|
-
|
|
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)
|
package/lib/device/tv-single.js
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import { generateRandomString
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
69
|
-
throw new this.hapErr(-70402)
|
|
57
|
+
})
|
|
70
58
|
}
|
|
71
59
|
}
|
|
72
60
|
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import { generateRandomString
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
127
|
-
throw new this.hapErr(-70402)
|
|
115
|
+
})
|
|
128
116
|
}
|
|
129
117
|
}
|
|
130
118
|
|
package/package.json
CHANGED