@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
|
@@ -4,22 +4,14 @@ import {
|
|
|
4
4
|
generateCodeFromHexValues,
|
|
5
5
|
getTwoItemPosition,
|
|
6
6
|
hexToTwoItems,
|
|
7
|
-
parseError,
|
|
8
7
|
} from '../utils/functions.js'
|
|
9
8
|
import platformLang from '../utils/lang-en.js'
|
|
10
9
|
import { logUnknownData } from '../utils/report-unknown.js'
|
|
10
|
+
import GoveeDevice from './base.js'
|
|
11
11
|
|
|
12
|
-
export default class {
|
|
12
|
+
export default class extends GoveeDevice {
|
|
13
13
|
constructor(platform, accessory) {
|
|
14
|
-
|
|
15
|
-
this.hapChar = platform.api.hap.Characteristic
|
|
16
|
-
this.hapErr = platform.api.hap.HapStatusError
|
|
17
|
-
this.hapServ = platform.api.hap.Service
|
|
18
|
-
this.platform = platform
|
|
19
|
-
|
|
20
|
-
// Set up variables from the accessory
|
|
21
|
-
this.accessory = accessory
|
|
22
|
-
|
|
14
|
+
super(platform, accessory)
|
|
23
15
|
// Speed codes
|
|
24
16
|
this.value2Code = {
|
|
25
17
|
1: 'MwUBAQAAAAAAAAAAAAAAAAAAADY=',
|
|
@@ -95,14 +87,9 @@ export default class {
|
|
|
95
87
|
this.cacheState = newValue
|
|
96
88
|
this.accessory.log(`${platformLang.curState} [${this.cacheState}]`)
|
|
97
89
|
} catch (err) {
|
|
98
|
-
|
|
99
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
100
|
-
|
|
101
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
102
|
-
setTimeout(() => {
|
|
90
|
+
this.failUpdate(err, () => {
|
|
103
91
|
this.service.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
|
|
104
|
-
}
|
|
105
|
-
throw new this.hapErr(-70402)
|
|
92
|
+
})
|
|
106
93
|
}
|
|
107
94
|
}
|
|
108
95
|
|
|
@@ -134,14 +121,9 @@ export default class {
|
|
|
134
121
|
this.cacheSpeed = value
|
|
135
122
|
this.accessory.log(`${platformLang.curSpeed} [${value}]`)
|
|
136
123
|
} catch (err) {
|
|
137
|
-
|
|
138
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
139
|
-
|
|
140
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
141
|
-
setTimeout(() => {
|
|
124
|
+
this.failUpdate(err, () => {
|
|
142
125
|
this.service.updateCharacteristic(this.hapChar.RotationSpeed, this.cacheSpeed)
|
|
143
|
-
}
|
|
144
|
-
throw new this.hapErr(-70402)
|
|
126
|
+
})
|
|
145
127
|
}
|
|
146
128
|
}
|
|
147
129
|
|
|
@@ -182,14 +164,9 @@ export default class {
|
|
|
182
164
|
this.accessory.log(`${platformLang.curLight} [${newValue}]`)
|
|
183
165
|
}
|
|
184
166
|
} catch (err) {
|
|
185
|
-
|
|
186
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
187
|
-
|
|
188
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
189
|
-
setTimeout(() => {
|
|
167
|
+
this.failUpdate(err, () => {
|
|
190
168
|
this.lightService.updateCharacteristic(this.hapChar.On, this.cacheLightState === 'on')
|
|
191
|
-
}
|
|
192
|
-
throw new this.hapErr(-70402)
|
|
169
|
+
})
|
|
193
170
|
}
|
|
194
171
|
}
|
|
195
172
|
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
base64ToHex,
|
|
3
3
|
getTwoItemPosition,
|
|
4
4
|
hexToTwoItems,
|
|
5
|
-
parseError,
|
|
6
5
|
} from '../utils/functions.js'
|
|
7
6
|
import platformLang from '../utils/lang-en.js'
|
|
8
7
|
import { logUnknownData } from '../utils/report-unknown.js'
|
|
8
|
+
import GoveeDevice from './base.js'
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
H7141
|
|
@@ -41,17 +41,9 @@ import { logUnknownData } from '../utils/report-unknown.js'
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
*/
|
|
44
|
-
export default class {
|
|
44
|
+
export default class extends GoveeDevice {
|
|
45
45
|
constructor(platform, accessory) {
|
|
46
|
-
|
|
47
|
-
this.hapChar = platform.api.hap.Characteristic
|
|
48
|
-
this.hapErr = platform.api.hap.HapStatusError
|
|
49
|
-
this.hapServ = platform.api.hap.Service
|
|
50
|
-
this.platform = platform
|
|
51
|
-
|
|
52
|
-
// Set up variables from the accessory
|
|
53
|
-
this.accessory = accessory
|
|
54
|
-
|
|
46
|
+
super(platform, accessory)
|
|
55
47
|
// Speed codes
|
|
56
48
|
this.value2Code = {
|
|
57
49
|
1: 'MwUBAQAAAAAAAAAAAAAAAAAAADY=',
|
|
@@ -118,14 +110,9 @@ export default class {
|
|
|
118
110
|
this.cacheState = newValue
|
|
119
111
|
this.accessory.log(`${platformLang.curState} [${this.cacheState}]`)
|
|
120
112
|
} catch (err) {
|
|
121
|
-
|
|
122
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
123
|
-
|
|
124
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
125
|
-
setTimeout(() => {
|
|
113
|
+
this.failUpdate(err, () => {
|
|
126
114
|
this.service.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
|
|
127
|
-
}
|
|
128
|
-
throw new this.hapErr(-70402)
|
|
115
|
+
})
|
|
129
116
|
}
|
|
130
117
|
}
|
|
131
118
|
|
|
@@ -157,14 +144,9 @@ export default class {
|
|
|
157
144
|
this.cacheSpeed = value
|
|
158
145
|
this.accessory.log(`${platformLang.curSpeed} [${value}]`)
|
|
159
146
|
} catch (err) {
|
|
160
|
-
|
|
161
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
162
|
-
|
|
163
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
164
|
-
setTimeout(() => {
|
|
147
|
+
this.failUpdate(err, () => {
|
|
165
148
|
this.service.updateCharacteristic(this.hapChar.RotationSpeed, this.cacheSpeed)
|
|
166
|
-
}
|
|
167
|
-
throw new this.hapErr(-70402)
|
|
149
|
+
})
|
|
168
150
|
}
|
|
169
151
|
}
|
|
170
152
|
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
getTwoItemPosition,
|
|
7
7
|
hexToDecimal,
|
|
8
8
|
hexToTwoItems,
|
|
9
|
-
parseError,
|
|
10
9
|
sleep,
|
|
11
10
|
} from '../utils/functions.js'
|
|
12
11
|
import platformLang from '../utils/lang-en.js'
|
|
13
12
|
import { logUnknownData } from '../utils/report-unknown.js'
|
|
13
|
+
import GoveeDevice from './base.js'
|
|
14
14
|
|
|
15
15
|
/*
|
|
16
16
|
H7142
|
|
@@ -47,17 +47,9 @@ import { logUnknownData } from '../utils/report-unknown.js'
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
*/
|
|
50
|
-
export default class {
|
|
50
|
+
export default class extends GoveeDevice {
|
|
51
51
|
constructor(platform, accessory) {
|
|
52
|
-
|
|
53
|
-
this.hapChar = platform.api.hap.Characteristic
|
|
54
|
-
this.hapErr = platform.api.hap.HapStatusError
|
|
55
|
-
this.hapServ = platform.api.hap.Service
|
|
56
|
-
this.platform = platform
|
|
57
|
-
|
|
58
|
-
// Set up variables from the accessory
|
|
59
|
-
this.accessory = accessory
|
|
60
|
-
|
|
52
|
+
super(platform, accessory)
|
|
61
53
|
// Speed codes
|
|
62
54
|
this.value2Code = {
|
|
63
55
|
1: 'MwUBAQAAAAAAAAAAAAAAAAAAADY=',
|
|
@@ -180,14 +172,9 @@ export default class {
|
|
|
180
172
|
this.accessory.log(`current light state [${this.cacheLightState}]`)
|
|
181
173
|
}
|
|
182
174
|
} catch (err) {
|
|
183
|
-
|
|
184
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
185
|
-
|
|
186
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
187
|
-
setTimeout(() => {
|
|
175
|
+
this.failUpdate(err, () => {
|
|
188
176
|
this.service.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
|
|
189
|
-
}
|
|
190
|
-
throw new this.hapErr(-70402)
|
|
177
|
+
})
|
|
191
178
|
}
|
|
192
179
|
}
|
|
193
180
|
|
|
@@ -219,14 +206,9 @@ export default class {
|
|
|
219
206
|
this.cacheSpeed = value
|
|
220
207
|
this.accessory.log(`${platformLang.curSpeed} [${value}]`)
|
|
221
208
|
} catch (err) {
|
|
222
|
-
|
|
223
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
224
|
-
|
|
225
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
226
|
-
setTimeout(() => {
|
|
209
|
+
this.failUpdate(err, () => {
|
|
227
210
|
this.service.updateCharacteristic(this.hapChar.RotationSpeed, this.cacheSpeed)
|
|
228
|
-
}
|
|
229
|
-
throw new this.hapErr(-70402)
|
|
211
|
+
})
|
|
230
212
|
}
|
|
231
213
|
}
|
|
232
214
|
|
|
@@ -267,14 +249,9 @@ export default class {
|
|
|
267
249
|
this.accessory.log(`${platformLang.curLight} [${newValue}]`)
|
|
268
250
|
}
|
|
269
251
|
} catch (err) {
|
|
270
|
-
|
|
271
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
272
|
-
|
|
273
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
274
|
-
setTimeout(() => {
|
|
252
|
+
this.failUpdate(err, () => {
|
|
275
253
|
this.lightService.updateCharacteristic(this.hapChar.On, this.cacheLightState === 'on')
|
|
276
|
-
}
|
|
277
|
-
throw new this.hapErr(-70402)
|
|
254
|
+
})
|
|
278
255
|
}
|
|
279
256
|
}
|
|
280
257
|
|
|
@@ -325,14 +302,9 @@ export default class {
|
|
|
325
302
|
this.accessory.log(`${platformLang.curBright} [${value}%]`)
|
|
326
303
|
}
|
|
327
304
|
} catch (err) {
|
|
328
|
-
|
|
329
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
330
|
-
|
|
331
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
332
|
-
setTimeout(() => {
|
|
305
|
+
this.failUpdate(err, () => {
|
|
333
306
|
this.lightService.updateCharacteristic(this.hapChar.Brightness, this.cacheBright)
|
|
334
|
-
}
|
|
335
|
-
throw new this.hapErr(-70402)
|
|
307
|
+
})
|
|
336
308
|
}
|
|
337
309
|
}
|
|
338
310
|
|
|
@@ -370,14 +342,9 @@ export default class {
|
|
|
370
342
|
this.accessory.log(`${platformLang.curColour} [rgb ${newRGB.join(' ')}]`)
|
|
371
343
|
}
|
|
372
344
|
} catch (err) {
|
|
373
|
-
|
|
374
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
375
|
-
|
|
376
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
377
|
-
setTimeout(() => {
|
|
345
|
+
this.failUpdate(err, () => {
|
|
378
346
|
this.lightService.updateCharacteristic(this.hapChar.Hue, this.cacheHue)
|
|
379
|
-
}
|
|
380
|
-
throw new this.hapErr(-70402)
|
|
347
|
+
})
|
|
381
348
|
}
|
|
382
349
|
}
|
|
383
350
|
|
|
@@ -2,22 +2,14 @@ import {
|
|
|
2
2
|
base64ToHex,
|
|
3
3
|
getTwoItemPosition,
|
|
4
4
|
hexToTwoItems,
|
|
5
|
-
parseError,
|
|
6
5
|
} from '../utils/functions.js'
|
|
7
6
|
import platformLang from '../utils/lang-en.js'
|
|
8
7
|
import { logUnknownData } from '../utils/report-unknown.js'
|
|
8
|
+
import GoveeDevice from './base.js'
|
|
9
9
|
|
|
10
|
-
export default class {
|
|
10
|
+
export default class extends GoveeDevice {
|
|
11
11
|
constructor(platform, accessory) {
|
|
12
|
-
|
|
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
|
-
|
|
18
|
-
// Set up variables from the accessory
|
|
19
|
-
this.accessory = accessory
|
|
20
|
-
|
|
12
|
+
super(platform, accessory)
|
|
21
13
|
// Speed codes
|
|
22
14
|
this.value2Code = {
|
|
23
15
|
1: 'MwUBAQAAAAAAAAAAAAAAAAAAADY=',
|
|
@@ -83,14 +75,9 @@ export default class {
|
|
|
83
75
|
this.cacheState = newValue
|
|
84
76
|
this.accessory.log(`${platformLang.curState} [${this.cacheState}]`)
|
|
85
77
|
} catch (err) {
|
|
86
|
-
|
|
87
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
88
|
-
|
|
89
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
90
|
-
setTimeout(() => {
|
|
78
|
+
this.failUpdate(err, () => {
|
|
91
79
|
this.service.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
|
|
92
|
-
}
|
|
93
|
-
throw new this.hapErr(-70402)
|
|
80
|
+
})
|
|
94
81
|
}
|
|
95
82
|
}
|
|
96
83
|
|
|
@@ -122,14 +109,9 @@ export default class {
|
|
|
122
109
|
this.cacheSpeed = value
|
|
123
110
|
this.accessory.log(`${platformLang.curSpeed} [${value}]`)
|
|
124
111
|
} catch (err) {
|
|
125
|
-
|
|
126
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
127
|
-
|
|
128
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
129
|
-
setTimeout(() => {
|
|
112
|
+
this.failUpdate(err, () => {
|
|
130
113
|
this.service.updateCharacteristic(this.hapChar.RotationSpeed, this.cacheSpeed)
|
|
131
|
-
}
|
|
132
|
-
throw new this.hapErr(-70402)
|
|
114
|
+
})
|
|
133
115
|
}
|
|
134
116
|
}
|
|
135
117
|
|
|
@@ -6,23 +6,15 @@ import {
|
|
|
6
6
|
getTwoItemPosition,
|
|
7
7
|
hexToDecimal,
|
|
8
8
|
hexToTwoItems,
|
|
9
|
-
parseError,
|
|
10
9
|
sleep,
|
|
11
10
|
} from '../utils/functions.js'
|
|
12
11
|
import platformLang from '../utils/lang-en.js'
|
|
13
12
|
import { logUnknownData } from '../utils/report-unknown.js'
|
|
13
|
+
import GoveeDevice from './base.js'
|
|
14
14
|
|
|
15
|
-
export default class {
|
|
15
|
+
export default class extends GoveeDevice {
|
|
16
16
|
constructor(platform, accessory) {
|
|
17
|
-
|
|
18
|
-
this.hapChar = platform.api.hap.Characteristic
|
|
19
|
-
this.hapErr = platform.api.hap.HapStatusError
|
|
20
|
-
this.hapServ = platform.api.hap.Service
|
|
21
|
-
this.platform = platform
|
|
22
|
-
|
|
23
|
-
// Set up variables from the accessory
|
|
24
|
-
this.accessory = accessory
|
|
25
|
-
|
|
17
|
+
super(platform, accessory)
|
|
26
18
|
// Speed codes
|
|
27
19
|
this.value2Code = {
|
|
28
20
|
1: 'MwUBAQAAAAAAAAAAAAAAAAAAADY=',
|
|
@@ -128,14 +120,9 @@ export default class {
|
|
|
128
120
|
this.accessory.log(`current light state [${this.cacheLightState}]`)
|
|
129
121
|
}
|
|
130
122
|
} catch (err) {
|
|
131
|
-
|
|
132
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
133
|
-
|
|
134
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
135
|
-
setTimeout(() => {
|
|
123
|
+
this.failUpdate(err, () => {
|
|
136
124
|
this.service.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
|
|
137
|
-
}
|
|
138
|
-
throw new this.hapErr(-70402)
|
|
125
|
+
})
|
|
139
126
|
}
|
|
140
127
|
}
|
|
141
128
|
|
|
@@ -167,14 +154,9 @@ export default class {
|
|
|
167
154
|
this.cacheSpeed = value
|
|
168
155
|
this.accessory.log(`${platformLang.curSpeed} [${value}]`)
|
|
169
156
|
} catch (err) {
|
|
170
|
-
|
|
171
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
172
|
-
|
|
173
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
174
|
-
setTimeout(() => {
|
|
157
|
+
this.failUpdate(err, () => {
|
|
175
158
|
this.service.updateCharacteristic(this.hapChar.RotationSpeed, this.cacheSpeed)
|
|
176
|
-
}
|
|
177
|
-
throw new this.hapErr(-70402)
|
|
159
|
+
})
|
|
178
160
|
}
|
|
179
161
|
}
|
|
180
162
|
|
|
@@ -215,14 +197,9 @@ export default class {
|
|
|
215
197
|
this.accessory.log(`${platformLang.curLight} [${newValue}]`)
|
|
216
198
|
}
|
|
217
199
|
} catch (err) {
|
|
218
|
-
|
|
219
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
220
|
-
|
|
221
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
222
|
-
setTimeout(() => {
|
|
200
|
+
this.failUpdate(err, () => {
|
|
223
201
|
this.lightService.updateCharacteristic(this.hapChar.On, this.cacheLightState === 'on')
|
|
224
|
-
}
|
|
225
|
-
throw new this.hapErr(-70402)
|
|
202
|
+
})
|
|
226
203
|
}
|
|
227
204
|
}
|
|
228
205
|
|
|
@@ -273,14 +250,9 @@ export default class {
|
|
|
273
250
|
this.accessory.log(`${platformLang.curBright} [${value}%]`)
|
|
274
251
|
}
|
|
275
252
|
} catch (err) {
|
|
276
|
-
|
|
277
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
278
|
-
|
|
279
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
280
|
-
setTimeout(() => {
|
|
253
|
+
this.failUpdate(err, () => {
|
|
281
254
|
this.lightService.updateCharacteristic(this.hapChar.Brightness, this.cacheBright)
|
|
282
|
-
}
|
|
283
|
-
throw new this.hapErr(-70402)
|
|
255
|
+
})
|
|
284
256
|
}
|
|
285
257
|
}
|
|
286
258
|
|
|
@@ -318,14 +290,9 @@ export default class {
|
|
|
318
290
|
this.accessory.log(`${platformLang.curColour} [rgb ${newRGB.join(' ')}]`)
|
|
319
291
|
}
|
|
320
292
|
} catch (err) {
|
|
321
|
-
|
|
322
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
323
|
-
|
|
324
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
325
|
-
setTimeout(() => {
|
|
293
|
+
this.failUpdate(err, () => {
|
|
326
294
|
this.lightService.updateCharacteristic(this.hapChar.Hue, this.cacheHue)
|
|
327
|
-
}
|
|
328
|
-
throw new this.hapErr(-70402)
|
|
295
|
+
})
|
|
329
296
|
}
|
|
330
297
|
}
|
|
331
298
|
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import { getDeviceCapabilities } from '../utils/device-capabilities.js'
|
|
2
|
-
import { base64ToHex, generateCodeFromHexValues, getTwoItemPosition, hexToTwoItems
|
|
2
|
+
import { base64ToHex, generateCodeFromHexValues, getTwoItemPosition, hexToTwoItems } from '../utils/functions.js'
|
|
3
3
|
import platformLang from '../utils/lang-en.js'
|
|
4
4
|
import { logUnknownData } from '../utils/report-unknown.js'
|
|
5
|
+
import GoveeDevice from './base.js'
|
|
5
6
|
|
|
6
|
-
export default class GoveeIceMaker {
|
|
7
|
+
export default class GoveeIceMaker extends GoveeDevice {
|
|
7
8
|
constructor(platform, accessory) {
|
|
8
|
-
|
|
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
|
-
|
|
9
|
+
super(platform, accessory)
|
|
17
10
|
// Ice size codes: small=1, medium=2, large=3 (matching OpenAPI workMode values)
|
|
18
11
|
// Small, medium and large are all `33 05 <size>`. Which byte means which
|
|
19
12
|
// size runs the opposite way on the older models, so the order comes from
|
|
@@ -106,14 +99,9 @@ export default class GoveeIceMaker {
|
|
|
106
99
|
this.accessory.log(`${platformLang.curState} [${this.cacheState}]`)
|
|
107
100
|
}
|
|
108
101
|
} catch (err) {
|
|
109
|
-
|
|
110
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
111
|
-
|
|
112
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
113
|
-
setTimeout(() => {
|
|
102
|
+
this.failUpdate(err, () => {
|
|
114
103
|
this.service.updateCharacteristic(this.hapChar.Active, this.cacheState === 'on' ? 1 : 0)
|
|
115
|
-
}
|
|
116
|
-
throw new this.hapErr(-70402)
|
|
104
|
+
})
|
|
117
105
|
}
|
|
118
106
|
}
|
|
119
107
|
|
|
@@ -150,14 +138,9 @@ export default class GoveeIceMaker {
|
|
|
150
138
|
this.service.updateCharacteristic(this.hapChar.Active, 1)
|
|
151
139
|
this.accessory.log(`${platformLang.curSpeed} [${this.sizeLabels[value]}]`)
|
|
152
140
|
} catch (err) {
|
|
153
|
-
|
|
154
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
155
|
-
|
|
156
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
157
|
-
setTimeout(() => {
|
|
141
|
+
this.failUpdate(err, () => {
|
|
158
142
|
this.service.updateCharacteristic(this.hapChar.RotationSpeed, this.cacheSize)
|
|
159
|
-
}
|
|
160
|
-
throw new this.hapErr(-70402)
|
|
143
|
+
})
|
|
161
144
|
}
|
|
162
145
|
}
|
|
163
146
|
|
package/lib/device/kettle.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
base64ToHex,
|
|
3
3
|
getTwoItemPosition,
|
|
4
4
|
hexToTwoItems,
|
|
5
|
-
parseError,
|
|
6
5
|
sleep,
|
|
7
6
|
} from '../utils/functions.js'
|
|
8
7
|
import platformLang from '../utils/lang-en.js'
|
|
9
8
|
import { logUnknownData } from '../utils/report-unknown.js'
|
|
9
|
+
import GoveeDevice from './base.js'
|
|
10
10
|
|
|
11
11
|
/*
|
|
12
12
|
Custom Mode: aa050001010000000000000000000000000000af
|
|
@@ -23,16 +23,10 @@ import { logUnknownData } from '../utils/report-unknown.js'
|
|
|
23
23
|
Black Tea/Boil: MwUABQAAAAAAAAAAAAAAAAAAADM= 3305000500000000000000000000000000000033 [switch]
|
|
24
24
|
MwEBBQAAAAAAAAAAAAAAAAAAADY= 3301010500000000000000000000000000000036 [enable]
|
|
25
25
|
*/
|
|
26
|
-
export default class {
|
|
26
|
+
export default class extends GoveeDevice {
|
|
27
27
|
constructor(platform, accessory) {
|
|
28
|
-
|
|
29
|
-
this.hapChar = platform.api.hap.Characteristic
|
|
30
|
-
this.hapErr = platform.api.hap.HapStatusError
|
|
31
|
-
this.hapServ = platform.api.hap.Service
|
|
32
|
-
this.platform = platform
|
|
33
|
-
|
|
28
|
+
super(platform, accessory)
|
|
34
29
|
// Set up variables from the accessory
|
|
35
|
-
this.accessory = accessory
|
|
36
30
|
const deviceConf = platform.deviceConf[accessory.context.gvDeviceId] || {}
|
|
37
31
|
|
|
38
32
|
this.codes = {
|
|
@@ -232,14 +226,9 @@ export default class {
|
|
|
232
226
|
service.updateCharacteristic(this.hapChar.On, false)
|
|
233
227
|
}, 3000)
|
|
234
228
|
} catch (err) {
|
|
235
|
-
|
|
236
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
237
|
-
|
|
238
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
239
|
-
setTimeout(() => {
|
|
229
|
+
this.failUpdate(err, () => {
|
|
240
230
|
service.updateCharacteristic(this.hapChar.On, false)
|
|
241
|
-
}
|
|
242
|
-
throw new this.hapErr(-70402)
|
|
231
|
+
})
|
|
243
232
|
}
|
|
244
233
|
}
|
|
245
234
|
|
|
@@ -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
|
-
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 lightbulb service
|
|
16
8
|
if (accessory.getService(this.hapServ.Lightbulb)) {
|
|
17
9
|
accessory.removeService(accessory.getService(this.hapServ.Lightbulb))
|
|
@@ -61,14 +53,9 @@ export default class {
|
|
|
61
53
|
this.accessory.log(`${platformLang.curState} [${this.cacheState}]`)
|
|
62
54
|
}
|
|
63
55
|
} catch (err) {
|
|
64
|
-
|
|
65
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
66
|
-
|
|
67
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
68
|
-
setTimeout(() => {
|
|
56
|
+
this.failUpdate(err, () => {
|
|
69
57
|
this.service.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
|
|
70
|
-
}
|
|
71
|
-
throw new this.hapErr(-70402)
|
|
58
|
+
})
|
|
72
59
|
}
|
|
73
60
|
}
|
|
74
61
|
|
package/lib/device/light.js
CHANGED
|
@@ -12,18 +12,16 @@ import {
|
|
|
12
12
|
sleep,
|
|
13
13
|
} from '../utils/functions.js'
|
|
14
14
|
import platformLang from '../utils/lang-en.js'
|
|
15
|
+
import GoveeDevice from './base.js'
|
|
15
16
|
|
|
16
|
-
export default class {
|
|
17
|
+
export default class extends GoveeDevice {
|
|
17
18
|
constructor(platform, accessory) {
|
|
19
|
+
super(platform, accessory)
|
|
20
|
+
|
|
18
21
|
// Set up variables from the platform
|
|
19
22
|
this.cusChar = platform.cusChar
|
|
20
|
-
this.hapChar = platform.api.hap.Characteristic
|
|
21
|
-
this.hapErr = platform.api.hap.HapStatusError
|
|
22
|
-
this.hapServ = platform.api.hap.Service
|
|
23
|
-
this.platform = platform
|
|
24
23
|
|
|
25
24
|
// Set up variables from the accessory
|
|
26
|
-
this.accessory = accessory
|
|
27
25
|
this.colourSafeMode = platform.config.colourSafeMode
|
|
28
26
|
this.minKelvin = accessory.context?.supportedCmdsOpts?.colorTem?.range?.min || 2000
|
|
29
27
|
this.maxKelvin = accessory.context?.supportedCmdsOpts?.colorTem?.range?.max || 9000
|
|
@@ -270,14 +268,9 @@ export default class {
|
|
|
270
268
|
this.accessory.log(`${platformLang.curState} [${this.cacheState}]`)
|
|
271
269
|
}
|
|
272
270
|
} catch (err) {
|
|
273
|
-
|
|
274
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
275
|
-
|
|
276
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
277
|
-
setTimeout(() => {
|
|
271
|
+
this.failUpdate(err, () => {
|
|
278
272
|
this.service.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
|
|
279
|
-
}
|
|
280
|
-
throw new this.hapErr(-70402)
|
|
273
|
+
})
|
|
281
274
|
}
|
|
282
275
|
}
|
|
283
276
|
|
|
@@ -360,14 +353,9 @@ export default class {
|
|
|
360
353
|
this.accessory.log(`${platformLang.curBright} [${value}%]`)
|
|
361
354
|
}
|
|
362
355
|
} catch (err) {
|
|
363
|
-
|
|
364
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
365
|
-
|
|
366
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
367
|
-
setTimeout(() => {
|
|
356
|
+
this.failUpdate(err, () => {
|
|
368
357
|
this.service.updateCharacteristic(this.hapChar.Brightness, this.cacheBright)
|
|
369
|
-
}
|
|
370
|
-
throw new this.hapErr(-70402)
|
|
358
|
+
})
|
|
371
359
|
}
|
|
372
360
|
}
|
|
373
361
|
|
|
@@ -435,14 +423,9 @@ export default class {
|
|
|
435
423
|
this.accessory.log(`${platformLang.curColour} [rgb ${this.cacheR} ${this.cacheG} ${this.cacheB}]`)
|
|
436
424
|
}
|
|
437
425
|
} catch (err) {
|
|
438
|
-
|
|
439
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
440
|
-
|
|
441
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
442
|
-
setTimeout(() => {
|
|
426
|
+
this.failUpdate(err, () => {
|
|
443
427
|
this.service.updateCharacteristic(this.hapChar.Hue, this.cacheHue)
|
|
444
|
-
}
|
|
445
|
-
throw new this.hapErr(-70402)
|
|
428
|
+
})
|
|
446
429
|
}
|
|
447
430
|
}
|
|
448
431
|
|
|
@@ -526,14 +509,9 @@ export default class {
|
|
|
526
509
|
}
|
|
527
510
|
}
|
|
528
511
|
} catch (err) {
|
|
529
|
-
|
|
530
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
531
|
-
|
|
532
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
533
|
-
setTimeout(() => {
|
|
512
|
+
this.failUpdate(err, () => {
|
|
534
513
|
this.service.updateCharacteristic(this.hapChar.ColorTemperature, this.cacheMired)
|
|
535
|
-
}
|
|
536
|
-
throw new this.hapErr(-70402)
|
|
514
|
+
})
|
|
537
515
|
}
|
|
538
516
|
}
|
|
539
517
|
|
|
@@ -578,18 +556,13 @@ export default class {
|
|
|
578
556
|
})
|
|
579
557
|
}, 1000)
|
|
580
558
|
} catch (err) {
|
|
581
|
-
|
|
582
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
583
|
-
|
|
584
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
585
|
-
setTimeout(() => {
|
|
559
|
+
this.failUpdate(err, () => {
|
|
586
560
|
if (isService) {
|
|
587
561
|
this.accessory.getService(charName).updateCharacteristic(this.hapChar.On, false)
|
|
588
562
|
} else {
|
|
589
563
|
this.service.updateCharacteristic(this.cusChar[charName], false)
|
|
590
564
|
}
|
|
591
|
-
}
|
|
592
|
-
throw new this.hapErr(-70402)
|
|
565
|
+
})
|
|
593
566
|
}
|
|
594
567
|
}
|
|
595
568
|
|