@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.
- package/CHANGELOG.md +2 -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/index.js +2 -2
- 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-probe.js +52 -0
- package/lib/device/sensor-thermo-switch.js +4 -9
- package/lib/device/sensor-thermo.js +4 -9
- 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/lib/utils/constants.js +17 -3
- package/lib/utils/dispatch.js +1 -1
- package/package.json +1 -1
- package/lib/device/sensor-thermo4.js +0 -66
package/lib/device/fan-H7107.js
CHANGED
|
@@ -8,23 +8,15 @@ import {
|
|
|
8
8
|
hexToDecimal,
|
|
9
9
|
hexToTwoItems,
|
|
10
10
|
hkPercentToFanSpeed,
|
|
11
|
-
parseError,
|
|
12
11
|
sleep,
|
|
13
12
|
} from '../utils/functions.js'
|
|
14
13
|
import platformLang from '../utils/lang-en.js'
|
|
15
14
|
import { logUnknownData } from '../utils/report-unknown.js'
|
|
15
|
+
import GoveeDevice from './base.js'
|
|
16
16
|
|
|
17
|
-
export default class {
|
|
17
|
+
export default class extends GoveeDevice {
|
|
18
18
|
constructor(platform, accessory) {
|
|
19
|
-
|
|
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
|
-
|
|
25
|
-
// Set up variables from the accessory
|
|
26
|
-
this.accessory = accessory
|
|
27
|
-
|
|
19
|
+
super(platform, accessory)
|
|
28
20
|
// Set up custom variables for this device type
|
|
29
21
|
const deviceConf = platform.deviceConf[accessory.context.gvDeviceId]
|
|
30
22
|
this.hideLight = deviceConf && deviceConf.hideLight
|
|
@@ -151,14 +143,9 @@ export default class {
|
|
|
151
143
|
this.accessory.log(`${platformLang.curState} [${newValue}]`)
|
|
152
144
|
}
|
|
153
145
|
} catch (err) {
|
|
154
|
-
|
|
155
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
156
|
-
|
|
157
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
158
|
-
setTimeout(() => {
|
|
146
|
+
this.failUpdate(err, () => {
|
|
159
147
|
this.service.updateCharacteristic(this.hapChar.Active, this.cacheState === 'on' ? 1 : 0)
|
|
160
|
-
}
|
|
161
|
-
throw new this.hapErr(-70402)
|
|
148
|
+
})
|
|
162
149
|
}
|
|
163
150
|
}
|
|
164
151
|
|
|
@@ -192,14 +179,9 @@ export default class {
|
|
|
192
179
|
this.accessory.log(`${platformLang.curSpeed} [${value}]`)
|
|
193
180
|
}
|
|
194
181
|
} catch (err) {
|
|
195
|
-
|
|
196
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
197
|
-
|
|
198
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
199
|
-
setTimeout(() => {
|
|
182
|
+
this.failUpdate(err, () => {
|
|
200
183
|
this.service.updateCharacteristic(this.hapChar.RotationSpeed, fanSpeedToHkPercent(this.cacheSpeed, this.speedSteps, this.autoSpeed))
|
|
201
|
-
}
|
|
202
|
-
throw new this.hapErr(-70402)
|
|
184
|
+
})
|
|
203
185
|
}
|
|
204
186
|
}
|
|
205
187
|
|
|
@@ -246,14 +228,9 @@ export default class {
|
|
|
246
228
|
this.accessory.log(`${platformLang.curSwing} [${newValue}]`)
|
|
247
229
|
}
|
|
248
230
|
} catch (err) {
|
|
249
|
-
|
|
250
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
251
|
-
|
|
252
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
253
|
-
setTimeout(() => {
|
|
231
|
+
this.failUpdate(err, () => {
|
|
254
232
|
this.service.updateCharacteristic(this.hapChar.SwingMode, this.cacheSwing === 'on' ? 1 : 0)
|
|
255
|
-
}
|
|
256
|
-
throw new this.hapErr(-70402)
|
|
233
|
+
})
|
|
257
234
|
}
|
|
258
235
|
}
|
|
259
236
|
|
|
@@ -281,14 +258,9 @@ export default class {
|
|
|
281
258
|
this.accessory.log(`${platformLang.curLight} [${newValue}]`)
|
|
282
259
|
}
|
|
283
260
|
} catch (err) {
|
|
284
|
-
|
|
285
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
286
|
-
|
|
287
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
288
|
-
setTimeout(() => {
|
|
261
|
+
this.failUpdate(err, () => {
|
|
289
262
|
this.lightService.updateCharacteristic(this.hapChar.On, this.cacheLightState === 'on')
|
|
290
|
-
}
|
|
291
|
-
throw new this.hapErr(-70402)
|
|
263
|
+
})
|
|
292
264
|
}
|
|
293
265
|
}
|
|
294
266
|
|
|
@@ -335,14 +307,9 @@ export default class {
|
|
|
335
307
|
this.accessory.log(`${platformLang.curBright} [${value}%]`)
|
|
336
308
|
}
|
|
337
309
|
} catch (err) {
|
|
338
|
-
|
|
339
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
340
|
-
|
|
341
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
342
|
-
setTimeout(() => {
|
|
310
|
+
this.failUpdate(err, () => {
|
|
343
311
|
this.lightService.updateCharacteristic(this.hapChar.Brightness, this.cacheBright)
|
|
344
|
-
}
|
|
345
|
-
throw new this.hapErr(-70402)
|
|
312
|
+
})
|
|
346
313
|
}
|
|
347
314
|
}
|
|
348
315
|
|
|
@@ -379,14 +346,9 @@ export default class {
|
|
|
379
346
|
this.accessory.log(`${platformLang.curColour} [rgb ${newRGB.join(' ')}]`)
|
|
380
347
|
}
|
|
381
348
|
} catch (err) {
|
|
382
|
-
|
|
383
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
384
|
-
|
|
385
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
386
|
-
setTimeout(() => {
|
|
349
|
+
this.failUpdate(err, () => {
|
|
387
350
|
this.lightService.updateCharacteristic(this.hapChar.Hue, this.cacheHue)
|
|
388
|
-
}
|
|
389
|
-
throw new this.hapErr(-70402)
|
|
351
|
+
})
|
|
390
352
|
}
|
|
391
353
|
}
|
|
392
354
|
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { generateRandomString, hasProperty, parseError } 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
|
-
|
|
7
|
+
super(platform, accessory)
|
|
12
8
|
// Set up variables from the accessory
|
|
13
|
-
this.accessory = accessory
|
|
14
9
|
this.temperatureSource = accessory.context.temperatureSource;
|
|
15
10
|
|
|
16
11
|
// Remove any old services from simulations
|
|
@@ -149,14 +144,9 @@ export default class {
|
|
|
149
144
|
value === 1 ? newOnState : 0,
|
|
150
145
|
)
|
|
151
146
|
} catch (err) {
|
|
152
|
-
|
|
153
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
154
|
-
|
|
155
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
156
|
-
setTimeout(() => {
|
|
147
|
+
this.failUpdate(err, () => {
|
|
157
148
|
this.service.updateCharacteristic(this.hapChar.Active, this.cacheState === 'on' ? 1 : 0)
|
|
158
|
-
}
|
|
159
|
-
throw new this.hapErr(-70402)
|
|
149
|
+
})
|
|
160
150
|
}
|
|
161
151
|
}
|
|
162
152
|
|
|
@@ -211,17 +201,12 @@ export default class {
|
|
|
211
201
|
this.cacheHeat === 'on' ? 2 : 1,
|
|
212
202
|
)
|
|
213
203
|
} catch (err) {
|
|
214
|
-
|
|
215
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
216
|
-
|
|
217
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
218
|
-
setTimeout(() => {
|
|
204
|
+
this.failUpdate(err, () => {
|
|
219
205
|
this.service.updateCharacteristic(
|
|
220
206
|
this.hapChar.HeatingThresholdTemperature,
|
|
221
207
|
this.accessory.context.cacheTarget,
|
|
222
208
|
)
|
|
223
|
-
}
|
|
224
|
-
throw new this.hapErr(-70402)
|
|
209
|
+
})
|
|
225
210
|
}
|
|
226
211
|
}
|
|
227
212
|
|
package/lib/device/heater1a.js
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
hasProperty,
|
|
7
7
|
hexToTwoItems,
|
|
8
8
|
nearestHalf,
|
|
9
|
-
parseError,
|
|
10
9
|
} from '../utils/functions.js'
|
|
11
10
|
import platformLang from '../utils/lang-en.js'
|
|
12
11
|
import { logUnknownData } from '../utils/report-unknown.js'
|
|
12
|
+
import GoveeDevice from './base.js'
|
|
13
13
|
|
|
14
14
|
/*
|
|
15
15
|
H7130 (without temperature reporting)
|
|
@@ -32,19 +32,10 @@ import { logUnknownData } from '../utils/report-unknown.js'
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
*/
|
|
35
|
-
export default class {
|
|
35
|
+
export default class extends GoveeDevice {
|
|
36
36
|
constructor(platform, accessory) {
|
|
37
|
-
|
|
38
|
-
this.hapChar = platform.api.hap.Characteristic
|
|
39
|
-
this.hapErr = platform.api.hap.HapStatusError
|
|
40
|
-
this.hapServ = platform.api.hap.Service
|
|
41
|
-
this.platform = platform
|
|
42
|
-
|
|
37
|
+
super(platform, accessory)
|
|
43
38
|
this.log = platform.log
|
|
44
|
-
|
|
45
|
-
// Set up variables from the accessory
|
|
46
|
-
this.accessory = accessory
|
|
47
|
-
|
|
48
39
|
// Set up objects
|
|
49
40
|
this.speedCode = {
|
|
50
41
|
33: 'MwUBAAAAAAAAAAAAAAAAAAAAADc=',
|
|
@@ -152,14 +143,9 @@ export default class {
|
|
|
152
143
|
this.accessory.log(`${platformLang.curState} [${newValue}]`)
|
|
153
144
|
}
|
|
154
145
|
} catch (err) {
|
|
155
|
-
|
|
156
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
157
|
-
|
|
158
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
159
|
-
setTimeout(() => {
|
|
146
|
+
this.failUpdate(err, () => {
|
|
160
147
|
this.service.updateCharacteristic(this.hapChar.Active, this.cacheState === 'on' ? 1 : 0)
|
|
161
|
-
}
|
|
162
|
-
throw new this.hapErr(-70402)
|
|
148
|
+
})
|
|
163
149
|
}
|
|
164
150
|
}
|
|
165
151
|
|
|
@@ -189,17 +175,12 @@ export default class {
|
|
|
189
175
|
this.accessory.log(`${platformLang.curSwing} [${newValue}]`)
|
|
190
176
|
}
|
|
191
177
|
} catch (err) {
|
|
192
|
-
|
|
193
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
194
|
-
|
|
195
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
196
|
-
setTimeout(() => {
|
|
178
|
+
this.failUpdate(err, () => {
|
|
197
179
|
this.service.updateCharacteristic(
|
|
198
180
|
this.hapChar.SwingMode,
|
|
199
181
|
this.cacheSwing === 'on' ? 1 : 0,
|
|
200
182
|
)
|
|
201
|
-
}
|
|
202
|
-
throw new this.hapErr(-70402)
|
|
183
|
+
})
|
|
203
184
|
}
|
|
204
185
|
}
|
|
205
186
|
|
|
@@ -229,17 +210,12 @@ export default class {
|
|
|
229
210
|
this.accessory.log(`${platformLang.curLock} [${newValue}]`)
|
|
230
211
|
}
|
|
231
212
|
} catch (err) {
|
|
232
|
-
|
|
233
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
234
|
-
|
|
235
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
236
|
-
setTimeout(() => {
|
|
213
|
+
this.failUpdate(err, () => {
|
|
237
214
|
this.service.updateCharacteristic(
|
|
238
215
|
this.hapChar.LockPhysicalControls,
|
|
239
216
|
this.cacheLock === 'on' ? 1 : 0,
|
|
240
217
|
)
|
|
241
|
-
}
|
|
242
|
-
throw new this.hapErr(-70402)
|
|
218
|
+
})
|
|
243
219
|
}
|
|
244
220
|
}
|
|
245
221
|
|
|
@@ -274,14 +250,9 @@ export default class {
|
|
|
274
250
|
this.accessory.log(`${platformLang.curSpeed} [${this.speedCodeLabel[value]}]`)
|
|
275
251
|
}
|
|
276
252
|
} catch (err) {
|
|
277
|
-
|
|
278
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
279
|
-
|
|
280
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
281
|
-
setTimeout(() => {
|
|
253
|
+
this.failUpdate(err, () => {
|
|
282
254
|
this.service.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
|
|
283
|
-
}
|
|
284
|
-
throw new this.hapErr(-70402)
|
|
255
|
+
})
|
|
285
256
|
}
|
|
286
257
|
}
|
|
287
258
|
|
package/lib/device/heater1b.js
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
hasProperty,
|
|
6
6
|
hexToTwoItems,
|
|
7
7
|
nearestHalf,
|
|
8
|
-
parseError,
|
|
9
8
|
} from '../utils/functions.js'
|
|
10
9
|
import platformLang from '../utils/lang-en.js'
|
|
11
10
|
import { logUnknownData } from '../utils/report-unknown.js'
|
|
11
|
+
import GoveeDevice from './base.js'
|
|
12
12
|
|
|
13
13
|
/*
|
|
14
14
|
H7130 (with temperature reporting)
|
|
@@ -31,19 +31,10 @@ import { logUnknownData } from '../utils/report-unknown.js'
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
*/
|
|
34
|
-
export default class {
|
|
34
|
+
export default class extends GoveeDevice {
|
|
35
35
|
constructor(platform, accessory) {
|
|
36
|
-
|
|
37
|
-
this.hapChar = platform.api.hap.Characteristic
|
|
38
|
-
this.hapErr = platform.api.hap.HapStatusError
|
|
39
|
-
this.hapServ = platform.api.hap.Service
|
|
40
|
-
this.platform = platform
|
|
41
|
-
|
|
36
|
+
super(platform, accessory)
|
|
42
37
|
this.log = platform.log
|
|
43
|
-
|
|
44
|
-
// Set up variables from the accessory
|
|
45
|
-
this.accessory = accessory
|
|
46
|
-
|
|
47
38
|
// Set up objects
|
|
48
39
|
this.speedCode = {
|
|
49
40
|
33: 'MwUBAAAAAAAAAAAAAAAAAAAAADc=',
|
|
@@ -229,14 +220,9 @@ export default class {
|
|
|
229
220
|
this.fanService.updateCharacteristic(this.hapChar.On, newValue === 'on')
|
|
230
221
|
}
|
|
231
222
|
} catch (err) {
|
|
232
|
-
|
|
233
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
234
|
-
|
|
235
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
236
|
-
setTimeout(() => {
|
|
223
|
+
this.failUpdate(err, () => {
|
|
237
224
|
this.service.updateCharacteristic(this.hapChar.Active, this.cacheState === 'on' ? 1 : 0)
|
|
238
|
-
}
|
|
239
|
-
throw new this.hapErr(-70402)
|
|
225
|
+
})
|
|
240
226
|
}
|
|
241
227
|
}
|
|
242
228
|
|
|
@@ -264,17 +250,12 @@ export default class {
|
|
|
264
250
|
this.accessory.log(`${platformLang.curMode} [${newMode}]`)
|
|
265
251
|
}
|
|
266
252
|
} catch (err) {
|
|
267
|
-
|
|
268
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
269
|
-
|
|
270
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
271
|
-
setTimeout(() => {
|
|
253
|
+
this.failUpdate(err, () => {
|
|
272
254
|
this.service.updateCharacteristic(
|
|
273
255
|
this.hapChar.TargetHeaterCoolerState,
|
|
274
256
|
this.cacheMode === 'auto' ? 0 : 1,
|
|
275
257
|
)
|
|
276
|
-
}
|
|
277
|
-
throw new this.hapErr(-70402)
|
|
258
|
+
})
|
|
278
259
|
}
|
|
279
260
|
}
|
|
280
261
|
|
|
@@ -303,14 +284,9 @@ export default class {
|
|
|
303
284
|
this.accessory.log(`${platformLang.curTarg} [${this.cacheTarg}°C]`)
|
|
304
285
|
}
|
|
305
286
|
} catch (err) {
|
|
306
|
-
|
|
307
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
308
|
-
|
|
309
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
310
|
-
setTimeout(() => {
|
|
287
|
+
this.failUpdate(err, () => {
|
|
311
288
|
this.service.updateCharacteristic(this.hapChar.HeatingThresholdTemperature, this.cacheTarg)
|
|
312
|
-
}
|
|
313
|
-
throw new this.hapErr(-70402)
|
|
289
|
+
})
|
|
314
290
|
}
|
|
315
291
|
}
|
|
316
292
|
|
|
@@ -340,17 +316,12 @@ export default class {
|
|
|
340
316
|
this.accessory.log(`${platformLang.curSwing} [${newValue}]`)
|
|
341
317
|
}
|
|
342
318
|
} catch (err) {
|
|
343
|
-
|
|
344
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
345
|
-
|
|
346
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
347
|
-
setTimeout(() => {
|
|
319
|
+
this.failUpdate(err, () => {
|
|
348
320
|
this.service.updateCharacteristic(
|
|
349
321
|
this.hapChar.SwingMode,
|
|
350
322
|
this.cacheSwing === 'on' ? 1 : 0,
|
|
351
323
|
)
|
|
352
|
-
}
|
|
353
|
-
throw new this.hapErr(-70402)
|
|
324
|
+
})
|
|
354
325
|
}
|
|
355
326
|
}
|
|
356
327
|
|
|
@@ -380,17 +351,12 @@ export default class {
|
|
|
380
351
|
this.accessory.log(`${platformLang.curLock} [${newValue}]`)
|
|
381
352
|
}
|
|
382
353
|
} catch (err) {
|
|
383
|
-
|
|
384
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
385
|
-
|
|
386
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
387
|
-
setTimeout(() => {
|
|
354
|
+
this.failUpdate(err, () => {
|
|
388
355
|
this.service.updateCharacteristic(
|
|
389
356
|
this.hapChar.LockPhysicalControls,
|
|
390
357
|
this.cacheLock === 'on' ? 1 : 0,
|
|
391
358
|
)
|
|
392
|
-
}
|
|
393
|
-
throw new this.hapErr(-70402)
|
|
359
|
+
})
|
|
394
360
|
}
|
|
395
361
|
}
|
|
396
362
|
|
|
@@ -427,14 +393,9 @@ export default class {
|
|
|
427
393
|
this.fanService.updateCharacteristic(this.hapChar.RotationSpeed, this.cacheSpeed)
|
|
428
394
|
}, 2000)
|
|
429
395
|
} catch (err) {
|
|
430
|
-
|
|
431
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
432
|
-
|
|
433
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
434
|
-
setTimeout(() => {
|
|
396
|
+
this.failUpdate(err, () => {
|
|
435
397
|
this.fanService.updateCharacteristic(this.hapChar.On, this.cacheFanState === 'on')
|
|
436
|
-
}
|
|
437
|
-
throw new this.hapErr(-70402)
|
|
398
|
+
})
|
|
438
399
|
}
|
|
439
400
|
}
|
|
440
401
|
|
|
@@ -469,14 +430,9 @@ export default class {
|
|
|
469
430
|
this.accessory.log(`${platformLang.curSpeed} [${this.speedCodeLabel[value]}]`)
|
|
470
431
|
}
|
|
471
432
|
} catch (err) {
|
|
472
|
-
|
|
473
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
474
|
-
|
|
475
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
476
|
-
setTimeout(() => {
|
|
433
|
+
this.failUpdate(err, () => {
|
|
477
434
|
this.fanService.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
|
|
478
|
-
}
|
|
479
|
-
throw new this.hapErr(-70402)
|
|
435
|
+
})
|
|
480
436
|
}
|
|
481
437
|
}
|
|
482
438
|
|
package/lib/device/heater2.js
CHANGED
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
hexToDecimal,
|
|
10
10
|
hexToTwoItems,
|
|
11
11
|
nearestHalf,
|
|
12
|
-
parseError,
|
|
13
12
|
sleep,
|
|
14
13
|
} from '../utils/functions.js'
|
|
15
14
|
import platformLang from '../utils/lang-en.js'
|
|
16
15
|
import { logUnknownData } from '../utils/report-unknown.js'
|
|
16
|
+
import GoveeDevice from './base.js'
|
|
17
17
|
|
|
18
18
|
/*
|
|
19
19
|
H7131 and H7132
|
|
@@ -44,17 +44,9 @@ import { logUnknownData } from '../utils/report-unknown.js'
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
*/
|
|
47
|
-
export default class {
|
|
47
|
+
export default class extends GoveeDevice {
|
|
48
48
|
constructor(platform, accessory) {
|
|
49
|
-
|
|
50
|
-
this.hapChar = platform.api.hap.Characteristic
|
|
51
|
-
this.hapErr = platform.api.hap.HapStatusError
|
|
52
|
-
this.hapServ = platform.api.hap.Service
|
|
53
|
-
this.platform = platform
|
|
54
|
-
|
|
55
|
-
// Set up variables from the accessory
|
|
56
|
-
this.accessory = accessory
|
|
57
|
-
|
|
49
|
+
super(platform, accessory)
|
|
58
50
|
// Set up objects
|
|
59
51
|
this.speedCode = {
|
|
60
52
|
25: 'OgUJAAAAAAAAAAAAAAAAAAAAADY=',
|
|
@@ -263,14 +255,9 @@ export default class {
|
|
|
263
255
|
this.accessory.log(`${platformLang.curState} [${newValue}]`)
|
|
264
256
|
}
|
|
265
257
|
} catch (err) {
|
|
266
|
-
|
|
267
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
268
|
-
|
|
269
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
270
|
-
setTimeout(() => {
|
|
258
|
+
this.failUpdate(err, () => {
|
|
271
259
|
this.service.updateCharacteristic(this.hapChar.Active, this.cacheState === 'on' ? 1 : 0)
|
|
272
|
-
}
|
|
273
|
-
throw new this.hapErr(-70402)
|
|
260
|
+
})
|
|
274
261
|
}
|
|
275
262
|
}
|
|
276
263
|
|
|
@@ -310,17 +297,12 @@ export default class {
|
|
|
310
297
|
this.accessory.log(`${platformLang.curMode} [${this.cacheMode}]`)
|
|
311
298
|
}
|
|
312
299
|
} catch (err) {
|
|
313
|
-
|
|
314
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
315
|
-
|
|
316
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
317
|
-
setTimeout(() => {
|
|
300
|
+
this.failUpdate(err, () => {
|
|
318
301
|
this.service.updateCharacteristic(
|
|
319
302
|
this.hapChar.TargetHeaterCoolerState,
|
|
320
303
|
this.cacheMode === 'auto' ? 0 : 1,
|
|
321
304
|
)
|
|
322
|
-
}
|
|
323
|
-
throw new this.hapErr(-70402)
|
|
305
|
+
})
|
|
324
306
|
}
|
|
325
307
|
}
|
|
326
308
|
|
|
@@ -350,14 +332,9 @@ export default class {
|
|
|
350
332
|
this.accessory.log(`${platformLang.curTarg} [${this.cacheTarg}°C]`)
|
|
351
333
|
}
|
|
352
334
|
} catch (err) {
|
|
353
|
-
|
|
354
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
355
|
-
|
|
356
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
357
|
-
setTimeout(() => {
|
|
335
|
+
this.failUpdate(err, () => {
|
|
358
336
|
this.service.updateCharacteristic(this.hapChar.HeatingThresholdTemperature, this.cacheTarg)
|
|
359
|
-
}
|
|
360
|
-
throw new this.hapErr(-70402)
|
|
337
|
+
})
|
|
361
338
|
}
|
|
362
339
|
}
|
|
363
340
|
|
|
@@ -387,17 +364,12 @@ export default class {
|
|
|
387
364
|
this.accessory.log(`${platformLang.curSwing} [${newValue}]`)
|
|
388
365
|
}
|
|
389
366
|
} catch (err) {
|
|
390
|
-
|
|
391
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
392
|
-
|
|
393
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
394
|
-
setTimeout(() => {
|
|
367
|
+
this.failUpdate(err, () => {
|
|
395
368
|
this.service.updateCharacteristic(
|
|
396
369
|
this.hapChar.SwingMode,
|
|
397
370
|
this.cacheSwing === 'on' ? 1 : 0,
|
|
398
371
|
)
|
|
399
|
-
}
|
|
400
|
-
throw new this.hapErr(-70402)
|
|
372
|
+
})
|
|
401
373
|
}
|
|
402
374
|
}
|
|
403
375
|
|
|
@@ -427,17 +399,12 @@ export default class {
|
|
|
427
399
|
this.accessory.log(`${platformLang.curLock} [${newValue}]`)
|
|
428
400
|
}
|
|
429
401
|
} catch (err) {
|
|
430
|
-
|
|
431
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
432
|
-
|
|
433
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
434
|
-
setTimeout(() => {
|
|
402
|
+
this.failUpdate(err, () => {
|
|
435
403
|
this.service.updateCharacteristic(
|
|
436
404
|
this.hapChar.LockPhysicalControls,
|
|
437
405
|
this.cacheLock === 'on' ? 1 : 0,
|
|
438
406
|
)
|
|
439
|
-
}
|
|
440
|
-
throw new this.hapErr(-70402)
|
|
407
|
+
})
|
|
441
408
|
}
|
|
442
409
|
}
|
|
443
410
|
|
|
@@ -480,14 +447,9 @@ export default class {
|
|
|
480
447
|
this.service.updateCharacteristic(this.hapChar.TargetHeaterCoolerState, 0)
|
|
481
448
|
this.accessory.log(`${platformLang.curMode} [${this.cacheMode}]`)
|
|
482
449
|
} catch (err) {
|
|
483
|
-
|
|
484
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
485
|
-
|
|
486
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
487
|
-
setTimeout(() => {
|
|
450
|
+
this.failUpdate(err, () => {
|
|
488
451
|
this.fanService.updateCharacteristic(this.hapChar.On, this.cacheFanState === 'on')
|
|
489
|
-
}
|
|
490
|
-
throw new this.hapErr(-70402)
|
|
452
|
+
})
|
|
491
453
|
}
|
|
492
454
|
}
|
|
493
455
|
|
|
@@ -517,14 +479,9 @@ export default class {
|
|
|
517
479
|
this.accessory.log(`${platformLang.curMode} [${this.cacheMode}]`)
|
|
518
480
|
}
|
|
519
481
|
} catch (err) {
|
|
520
|
-
|
|
521
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
522
|
-
|
|
523
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
524
|
-
setTimeout(() => {
|
|
482
|
+
this.failUpdate(err, () => {
|
|
525
483
|
this.fanService.updateCharacteristic(this.hapChar.RotationSpeed, this.cacheSpeed)
|
|
526
|
-
}
|
|
527
|
-
throw new this.hapErr(-70402)
|
|
484
|
+
})
|
|
528
485
|
}
|
|
529
486
|
}
|
|
530
487
|
|
|
@@ -552,14 +509,9 @@ export default class {
|
|
|
552
509
|
this.accessory.log(`${platformLang.curLight} [${newValue}]`)
|
|
553
510
|
}
|
|
554
511
|
} catch (err) {
|
|
555
|
-
|
|
556
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
557
|
-
|
|
558
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
559
|
-
setTimeout(() => {
|
|
512
|
+
this.failUpdate(err, () => {
|
|
560
513
|
this.lightService.updateCharacteristic(this.hapChar.On, this.cacheLightState === 'on')
|
|
561
|
-
}
|
|
562
|
-
throw new this.hapErr(-70402)
|
|
514
|
+
})
|
|
563
515
|
}
|
|
564
516
|
}
|
|
565
517
|
|
|
@@ -606,14 +558,9 @@ export default class {
|
|
|
606
558
|
this.accessory.log(`${platformLang.curBright} [${value}%]`)
|
|
607
559
|
}
|
|
608
560
|
} catch (err) {
|
|
609
|
-
|
|
610
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
611
|
-
|
|
612
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
613
|
-
setTimeout(() => {
|
|
561
|
+
this.failUpdate(err, () => {
|
|
614
562
|
this.lightService.updateCharacteristic(this.hapChar.Brightness, this.cacheBright)
|
|
615
|
-
}
|
|
616
|
-
throw new this.hapErr(-70402)
|
|
563
|
+
})
|
|
617
564
|
}
|
|
618
565
|
}
|
|
619
566
|
|
|
@@ -650,14 +597,9 @@ export default class {
|
|
|
650
597
|
this.accessory.log(`${platformLang.curColour} [rgb ${newRGB.join(' ')}]`)
|
|
651
598
|
}
|
|
652
599
|
} catch (err) {
|
|
653
|
-
|
|
654
|
-
this.accessory.logWarn(`${platformLang.devNotUpdated} ${parseError(err)}`)
|
|
655
|
-
|
|
656
|
-
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
657
|
-
setTimeout(() => {
|
|
600
|
+
this.failUpdate(err, () => {
|
|
658
601
|
this.lightService.updateCharacteristic(this.hapChar.Hue, this.cacheHue)
|
|
659
|
-
}
|
|
660
|
-
throw new this.hapErr(-70402)
|
|
602
|
+
})
|
|
661
603
|
}
|
|
662
604
|
}
|
|
663
605
|
|