@homebridge-plugins/homebridge-ewelink 12.19.1-beta.3 → 12.19.1-beta.4
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/eslint.config.js +9 -2
- package/lib/connection/api.js +9 -3
- package/lib/connection/http.js +3 -1
- package/lib/connection/lan.js +10 -3
- package/lib/connection/ws.js +9 -3
- package/lib/device/air-conditioner.js +17 -5
- package/lib/device/curtain.js +12 -4
- package/lib/device/diffuser.js +9 -3
- package/lib/device/fan-gear.js +3 -1
- package/lib/device/fan.js +44 -13
- package/lib/device/group.js +19 -5
- package/lib/device/humidifier.js +3 -1
- package/lib/device/light-cct.js +3 -1
- package/lib/device/light-dimmer.js +12 -4
- package/lib/device/light-rgb-cct.js +6 -2
- package/lib/device/light-rgb.js +6 -2
- package/lib/device/motor.js +25 -7
- package/lib/device/outlet-multi.js +68 -21
- package/lib/device/outlet-single-inched.js +33 -9
- package/lib/device/outlet-single.js +28 -8
- package/lib/device/panel.js +14 -4
- package/lib/device/sensor-air-quality.js +9 -2
- package/lib/device/sensor-ambient.js +3 -1
- package/lib/device/sensor-contact.js +9 -3
- package/lib/device/simulation/blind.js +12 -4
- package/lib/device/simulation/cooler.js +18 -6
- package/lib/device/simulation/door.js +12 -4
- package/lib/device/simulation/doorbell.js +12 -4
- package/lib/device/simulation/garage-eachen.js +14 -4
- package/lib/device/simulation/garage-four.js +6 -2
- package/lib/device/simulation/garage-one.js +39 -13
- package/lib/device/simulation/garage-two.js +57 -19
- package/lib/device/simulation/gate-one.js +15 -5
- package/lib/device/simulation/heater.js +18 -6
- package/lib/device/simulation/light-fan.js +3 -1
- package/lib/device/simulation/lock-eachen.js +14 -4
- package/lib/device/simulation/lock-one.js +18 -6
- package/lib/device/simulation/p-button.js +12 -4
- package/lib/device/simulation/purifier.js +33 -11
- package/lib/device/simulation/sensor-hidden.js +3 -1
- package/lib/device/simulation/sensor-leak.js +9 -3
- package/lib/device/simulation/sensor-visible.js +12 -4
- package/lib/device/simulation/sensor.js +15 -5
- package/lib/device/simulation/switch-valve.js +38 -12
- package/lib/device/simulation/tap-one.js +27 -9
- package/lib/device/simulation/tap-two.js +47 -15
- package/lib/device/simulation/th-cooler.js +18 -6
- package/lib/device/simulation/th-dehumidifier.js +18 -6
- package/lib/device/simulation/th-heater.js +18 -6
- package/lib/device/simulation/th-humidifier.js +18 -6
- package/lib/device/simulation/th-thermostat.js +30 -10
- package/lib/device/simulation/tv.js +27 -9
- package/lib/device/simulation/valve-four.js +19 -5
- package/lib/device/simulation/valve-one.js +18 -6
- package/lib/device/simulation/valve-two.js +35 -11
- package/lib/device/simulation/window.js +12 -4
- package/lib/device/switch-man.js +6 -2
- package/lib/device/switch-mate.js +6 -2
- package/lib/device/switch-multi.js +71 -22
- package/lib/device/switch-single-inched.js +33 -9
- package/lib/device/switch-single.js +34 -10
- package/lib/device/thermostat.js +15 -5
- package/lib/device/virtual.js +5 -1
- package/lib/device/zigbee/light-rgb-cct.js +6 -2
- package/lib/device/zigbee/motor.js +17 -5
- package/lib/device/zigbee/sensor-ambient.js +9 -3
- package/lib/device/zigbee/sensor-contact.js +9 -3
- package/lib/device/zigbee/sensor-leak.js +6 -2
- package/lib/device/zigbee/sensor-motion.js +9 -3
- package/lib/device/zigbee/sensor-occupancy.js +9 -3
- package/lib/device/zigbee/sensor-smoke.js +9 -3
- package/lib/device/zigbee/siren.js +7 -2
- package/lib/device/zigbee/switch-stateless.js +9 -3
- package/lib/device/zigbee/thermostat.js +11 -3
- package/lib/device/zigbee/zigbee-water-valve.js +3 -1
- package/lib/fakegato/fakegato-history.js +9 -3
- package/lib/fakegato/fakegato-storage.js +6 -2
- package/lib/node-dns-sd/lib/dns-sd-parser.js +6 -1
- package/lib/node-dns-sd/lib/dns-sd.js +39 -13
- package/lib/platform.js +21 -7
- package/lib/utils/colour.js +18 -4
- package/lib/utils/constants.js +74 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,7 @@ All notable changes to `@homebridge-plugins/homebridge-ewelink` will be document
|
|
|
14
14
|
- fix(zigbee): read the curtain motor's position, so home stops showing it opening (#810)
|
|
15
15
|
- fix(zigbee): keep a curtain motor shown as a garage door in step with its door
|
|
16
16
|
- fix(zigbee): flip the zbu-curt-7006 position, which counts 0 as open (#810)
|
|
17
|
+
- chore(deps): dependency updates
|
|
17
18
|
|
|
18
19
|
## v12.19.0 (2026-10-18)
|
|
19
20
|
|
package/eslint.config.js
CHANGED
|
@@ -32,10 +32,17 @@ export default antfu(
|
|
|
32
32
|
'perfectionist/sort-named-imports': 'error',
|
|
33
33
|
'quotes': ['error', 'single'],
|
|
34
34
|
'sort-imports': 0,
|
|
35
|
-
'style/brace-style': [
|
|
35
|
+
'style/brace-style': [
|
|
36
|
+
'error',
|
|
37
|
+
'1tbs',
|
|
38
|
+
{ allowSingleLine: true },
|
|
39
|
+
],
|
|
36
40
|
'style/quote-props': ['error', 'consistent-as-needed'],
|
|
37
41
|
'test/no-only-tests': 'error',
|
|
38
|
-
'unused-imports/no-unused-vars': [
|
|
42
|
+
'unused-imports/no-unused-vars': [
|
|
43
|
+
'error',
|
|
44
|
+
{ caughtErrors: 'none' },
|
|
45
|
+
],
|
|
39
46
|
},
|
|
40
47
|
typescript: false,
|
|
41
48
|
},
|
package/lib/connection/api.js
CHANGED
|
@@ -364,7 +364,9 @@ export default class {
|
|
|
364
364
|
: false
|
|
365
365
|
break
|
|
366
366
|
case 'hue':
|
|
367
|
-
charName = accServ.testCharacteristic(this.hapChar.Hue)
|
|
367
|
+
charName = accServ.testCharacteristic(this.hapChar.Hue)
|
|
368
|
+
? this.hapChar.Hue
|
|
369
|
+
: false
|
|
368
370
|
break
|
|
369
371
|
case 'speed':
|
|
370
372
|
charName = accServ.testCharacteristic(this.hapChar.RotationSpeed)
|
|
@@ -372,7 +374,9 @@ export default class {
|
|
|
372
374
|
: false
|
|
373
375
|
break
|
|
374
376
|
case 'state':
|
|
375
|
-
charName = accServ.testCharacteristic(this.hapChar.On)
|
|
377
|
+
charName = accServ.testCharacteristic(this.hapChar.On)
|
|
378
|
+
? this.hapChar.On
|
|
379
|
+
: false
|
|
376
380
|
break
|
|
377
381
|
default:
|
|
378
382
|
throw new Error(`Invalid characteristic specified for service:${servToUpdate}`)
|
|
@@ -455,7 +459,9 @@ export default class {
|
|
|
455
459
|
throw new Error('Value must be \'low\', \'medium\' or \'high\' for characteristic:speed')
|
|
456
460
|
}
|
|
457
461
|
const inLevels = accServ.getCharacteristic(this.hapChar.RotationSpeed).props.maxValue <= 3
|
|
458
|
-
newHKStatus = inLevels
|
|
462
|
+
newHKStatus = inLevels
|
|
463
|
+
? levels[newValue]
|
|
464
|
+
: levels[newValue] * 33
|
|
459
465
|
|
|
460
466
|
// Check the accessory has a correct set handler for speed
|
|
461
467
|
if (!accessory.control.internalSpeedUpdate) {
|
package/lib/connection/http.js
CHANGED
|
@@ -141,7 +141,9 @@ export default class {
|
|
|
141
141
|
return await this.login()
|
|
142
142
|
}
|
|
143
143
|
if (body.msg) {
|
|
144
|
-
throw new Error(body.msg + (body.error
|
|
144
|
+
throw new Error(body.msg + (body.error
|
|
145
|
+
? ` [${body.error}]`
|
|
146
|
+
: ''))
|
|
145
147
|
} else {
|
|
146
148
|
throw new Error(`${this.lang.noAuthRec}.\n${JSON.stringify(body, null, 2)}`)
|
|
147
149
|
}
|
package/lib/connection/lan.js
CHANGED
|
@@ -161,7 +161,9 @@ export default class {
|
|
|
161
161
|
// Log LAN discovery summary after 10 seconds
|
|
162
162
|
setTimeout(() => {
|
|
163
163
|
const total = this.deviceMap.size
|
|
164
|
-
const withIp = [
|
|
164
|
+
const withIp = [
|
|
165
|
+
...this.deviceMap.values(),
|
|
166
|
+
].filter(d => d.ip).length
|
|
165
167
|
this.log('LAN discovery: %s/%s devices found locally.', withIp, total)
|
|
166
168
|
}, 10000)
|
|
167
169
|
}
|
|
@@ -284,7 +286,10 @@ export default class {
|
|
|
284
286
|
const iv = randomBytes(16)
|
|
285
287
|
const enc = createCipheriv('aes-128-cbc', key, iv)
|
|
286
288
|
const data = {
|
|
287
|
-
data: Buffer.concat([
|
|
289
|
+
data: Buffer.concat([
|
|
290
|
+
enc.update(JSON.stringify(params)),
|
|
291
|
+
enc.final(),
|
|
292
|
+
]).toString('base64'),
|
|
288
293
|
deviceid: json.deviceid,
|
|
289
294
|
encrypt: true,
|
|
290
295
|
iv: iv.toString('base64'),
|
|
@@ -301,7 +306,9 @@ export default class {
|
|
|
301
306
|
'Content-Type': 'application/json',
|
|
302
307
|
},
|
|
303
308
|
data,
|
|
304
|
-
timeout: this.mode === 'lan'
|
|
309
|
+
timeout: this.mode === 'lan'
|
|
310
|
+
? 9000
|
|
311
|
+
: 3000,
|
|
305
312
|
})
|
|
306
313
|
|
|
307
314
|
// Check for any errors in the response
|
package/lib/connection/ws.js
CHANGED
|
@@ -70,7 +70,9 @@ export default class {
|
|
|
70
70
|
|
|
71
71
|
// Fall back to static pconnect hosts
|
|
72
72
|
const region = this.httpHost.split('-')[0]
|
|
73
|
-
const suffix = region === 'cn'
|
|
73
|
+
const suffix = region === 'cn'
|
|
74
|
+
? 'coolkit.cn'
|
|
75
|
+
: 'coolkit.cc'
|
|
74
76
|
const fallback = `${region}-pconnect3.${suffix}`
|
|
75
77
|
this.log.warn('%s [%s].', this.lang.errGetHost, fallback)
|
|
76
78
|
return fallback
|
|
@@ -104,7 +106,9 @@ export default class {
|
|
|
104
106
|
packMessage: data => JSON.stringify(data),
|
|
105
107
|
unpackMessage: (data) => {
|
|
106
108
|
data = data.toString()
|
|
107
|
-
return data === 'pong'
|
|
109
|
+
return data === 'pong'
|
|
110
|
+
? data
|
|
111
|
+
: JSON.parse(data)
|
|
108
112
|
},
|
|
109
113
|
timeout: 20000,
|
|
110
114
|
})
|
|
@@ -341,7 +345,9 @@ export default class {
|
|
|
341
345
|
})
|
|
342
346
|
|
|
343
347
|
// Parse the response and see if any error has been reported back
|
|
344
|
-
res.error = hasProperty(res, 'error')
|
|
348
|
+
res.error = hasProperty(res, 'error')
|
|
349
|
+
? res.error
|
|
350
|
+
: -1
|
|
345
351
|
|
|
346
352
|
// Check if and which error has been reported back
|
|
347
353
|
switch (res.error) {
|
|
@@ -166,10 +166,14 @@ export default class {
|
|
|
166
166
|
|
|
167
167
|
async internalActiveUpdate(value) {
|
|
168
168
|
try {
|
|
169
|
-
const newValue = value === 1
|
|
169
|
+
const newValue = value === 1
|
|
170
|
+
? 'on'
|
|
171
|
+
: 'off'
|
|
170
172
|
|
|
171
173
|
// Don't continue if the value is the same as before
|
|
172
|
-
const prevState = this.service.getCharacteristic(this.hapChar.Active).value === 1
|
|
174
|
+
const prevState = this.service.getCharacteristic(this.hapChar.Active).value === 1
|
|
175
|
+
? 'on'
|
|
176
|
+
: 'off'
|
|
173
177
|
if (prevState === newValue) {
|
|
174
178
|
return
|
|
175
179
|
}
|
|
@@ -258,7 +262,11 @@ export default class {
|
|
|
258
262
|
|
|
259
263
|
// Throw a 'no response' error and set a timeout to revert this after 2 seconds
|
|
260
264
|
setTimeout(() => {
|
|
261
|
-
const prevValue = this.cacheMode === 'heat'
|
|
265
|
+
const prevValue = this.cacheMode === 'heat'
|
|
266
|
+
? 1
|
|
267
|
+
: this.cacheMode === 'cool'
|
|
268
|
+
? 2
|
|
269
|
+
: 0
|
|
262
270
|
this.service.updateCharacteristic(this.hapChar.TargetHeaterCoolerState, prevValue)
|
|
263
271
|
}, 2000)
|
|
264
272
|
throw new this.hapErr(-70402)
|
|
@@ -372,7 +380,9 @@ export default class {
|
|
|
372
380
|
|
|
373
381
|
// Update the active characteristic
|
|
374
382
|
if (hasProperty(params, 'power')) {
|
|
375
|
-
const newState = params.power === 'on'
|
|
383
|
+
const newState = params.power === 'on'
|
|
384
|
+
? 1
|
|
385
|
+
: 0
|
|
376
386
|
this.service.updateCharacteristic(this.hapChar.Active, newState)
|
|
377
387
|
|
|
378
388
|
// Update the current state
|
|
@@ -498,7 +508,9 @@ export default class {
|
|
|
498
508
|
const toReturn = {}
|
|
499
509
|
toReturn.services = ['heater-cooler']
|
|
500
510
|
toReturn.heater_cooler = {
|
|
501
|
-
state: this.service.getCharacteristic(this.hapChar.Active).value === 1
|
|
511
|
+
state: this.service.getCharacteristic(this.hapChar.Active).value === 1
|
|
512
|
+
? 'on'
|
|
513
|
+
: 'off',
|
|
502
514
|
mode: this.cacheMode,
|
|
503
515
|
target_temp: this.cacheTarg,
|
|
504
516
|
current_temp: this.cacheTemp,
|
package/lib/device/curtain.js
CHANGED
|
@@ -191,7 +191,9 @@ export default class {
|
|
|
191
191
|
// If we are to fully open/close the curtain we can use the switch param
|
|
192
192
|
if ([0, 100].includes(value)) {
|
|
193
193
|
// 'on' for fully open and 'off' for fully close
|
|
194
|
-
params.switch = value === 100
|
|
194
|
+
params.switch = value === 100
|
|
195
|
+
? 'on'
|
|
196
|
+
: 'off'
|
|
195
197
|
} else {
|
|
196
198
|
// Otherwise, for a %-point we can use the 'setclose' param
|
|
197
199
|
params.setclose = Math.abs(100 - value)
|
|
@@ -231,10 +233,14 @@ export default class {
|
|
|
231
233
|
const params = {}
|
|
232
234
|
switch (this.accessory.context.eweUIID) {
|
|
233
235
|
case 11:
|
|
234
|
-
params.switch = value === 0
|
|
236
|
+
params.switch = value === 0
|
|
237
|
+
? 'on'
|
|
238
|
+
: 'off'
|
|
235
239
|
break
|
|
236
240
|
case 67:
|
|
237
|
-
params.op = value === 0
|
|
241
|
+
params.op = value === 0
|
|
242
|
+
? 1
|
|
243
|
+
: 3
|
|
238
244
|
break
|
|
239
245
|
default:
|
|
240
246
|
return
|
|
@@ -298,7 +304,9 @@ export default class {
|
|
|
298
304
|
if (hasProperty(params, 'setclose')) {
|
|
299
305
|
newPos = Math.abs(100 - params.setclose)
|
|
300
306
|
} else if (params.switch) {
|
|
301
|
-
newPos = params.switch === 'on'
|
|
307
|
+
newPos = params.switch === 'on'
|
|
308
|
+
? 100
|
|
309
|
+
: 0
|
|
302
310
|
} else {
|
|
303
311
|
return
|
|
304
312
|
}
|
package/lib/device/diffuser.js
CHANGED
|
@@ -165,7 +165,9 @@ export default class {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
// The new speed can be {50, 100} so use rounding on the new value
|
|
168
|
-
const newValue = value <= 50
|
|
168
|
+
const newValue = value <= 50
|
|
169
|
+
? 50
|
|
170
|
+
: 100
|
|
169
171
|
|
|
170
172
|
// Check the rounded speed against the current cache value
|
|
171
173
|
if (newValue === this.cacheSpeed) {
|
|
@@ -239,7 +241,9 @@ export default class {
|
|
|
239
241
|
|
|
240
242
|
// Log the update if appropriate
|
|
241
243
|
if (this.enableLogging) {
|
|
242
|
-
this.log('[%s] %s [%s%].', this.name, this.lang.curLight, value === 1
|
|
244
|
+
this.log('[%s] %s [%s%].', this.name, this.lang.curLight, value === 1
|
|
245
|
+
? 'on'
|
|
246
|
+
: 'off')
|
|
243
247
|
}
|
|
244
248
|
} catch (err) {
|
|
245
249
|
// Catch any errors and let the platform display them
|
|
@@ -409,7 +413,9 @@ export default class {
|
|
|
409
413
|
'[%s] %s [%s%].',
|
|
410
414
|
this.name,
|
|
411
415
|
this.lang.curLight,
|
|
412
|
-
params.lightswitch === 1
|
|
416
|
+
params.lightswitch === 1
|
|
417
|
+
? 'on'
|
|
418
|
+
: 'off',
|
|
413
419
|
)
|
|
414
420
|
}
|
|
415
421
|
}
|
package/lib/device/fan-gear.js
CHANGED
|
@@ -175,7 +175,9 @@ export default class {
|
|
|
175
175
|
|
|
176
176
|
async internalShakeUpdate(value) {
|
|
177
177
|
try {
|
|
178
|
-
const newShake = value === this.hapChar.SwingMode.SWING_ENABLED
|
|
178
|
+
const newShake = value === this.hapChar.SwingMode.SWING_ENABLED
|
|
179
|
+
? 'on'
|
|
180
|
+
: 'off'
|
|
179
181
|
if (newShake === this.cacheShake) {
|
|
180
182
|
return
|
|
181
183
|
}
|
package/lib/device/fan.js
CHANGED
|
@@ -66,7 +66,12 @@ export default class {
|
|
|
66
66
|
this.service
|
|
67
67
|
.getCharacteristic(this.hapChar.RotationSpeed)
|
|
68
68
|
.setProps(this.speedAsPercent
|
|
69
|
-
? {
|
|
69
|
+
? {
|
|
70
|
+
maxValue: 100,
|
|
71
|
+
minStep: 33,
|
|
72
|
+
minValue: 0,
|
|
73
|
+
unit: 'percentage',
|
|
74
|
+
}
|
|
70
75
|
: {
|
|
71
76
|
maxValue: 3,
|
|
72
77
|
minStep: 1,
|
|
@@ -151,11 +156,15 @@ export default class {
|
|
|
151
156
|
})
|
|
152
157
|
if (newState === 'on') {
|
|
153
158
|
params.switches.push({
|
|
154
|
-
switch: this.cacheSpeed === 2
|
|
159
|
+
switch: this.cacheSpeed === 2
|
|
160
|
+
? 'on'
|
|
161
|
+
: 'off',
|
|
155
162
|
outlet: 2,
|
|
156
163
|
})
|
|
157
164
|
params.switches.push({
|
|
158
|
-
switch: this.cacheSpeed === 3
|
|
165
|
+
switch: this.cacheSpeed === 3
|
|
166
|
+
? 'on'
|
|
167
|
+
: 'off',
|
|
159
168
|
outlet: 3,
|
|
160
169
|
})
|
|
161
170
|
}
|
|
@@ -185,21 +194,29 @@ export default class {
|
|
|
185
194
|
const params = {
|
|
186
195
|
switches: [],
|
|
187
196
|
}
|
|
188
|
-
const newState = value >= 1
|
|
197
|
+
const newState = value >= 1
|
|
198
|
+
? 'on'
|
|
199
|
+
: 'off'
|
|
189
200
|
const newSpeed = this.levelFromHK(value)
|
|
190
201
|
if (newSpeed === this.cacheSpeed) {
|
|
191
202
|
return
|
|
192
203
|
}
|
|
193
204
|
params.switches.push({
|
|
194
|
-
switch: newState === 'on' && newSpeed >= 1
|
|
205
|
+
switch: newState === 'on' && newSpeed >= 1
|
|
206
|
+
? 'on'
|
|
207
|
+
: 'off',
|
|
195
208
|
outlet: 1,
|
|
196
209
|
})
|
|
197
210
|
params.switches.push({
|
|
198
|
-
switch: newState === 'on' && newSpeed === 2
|
|
211
|
+
switch: newState === 'on' && newSpeed === 2
|
|
212
|
+
? 'on'
|
|
213
|
+
: 'off',
|
|
199
214
|
outlet: 2,
|
|
200
215
|
})
|
|
201
216
|
params.switches.push({
|
|
202
|
-
switch: newState === 'on' && newSpeed === 3
|
|
217
|
+
switch: newState === 'on' && newSpeed === 3
|
|
218
|
+
? 'on'
|
|
219
|
+
: 'off',
|
|
203
220
|
outlet: 3,
|
|
204
221
|
})
|
|
205
222
|
await this.platform.sendDeviceUpdate(this.accessory, params)
|
|
@@ -329,16 +346,22 @@ export default class {
|
|
|
329
346
|
currentState() {
|
|
330
347
|
const toReturn = {}
|
|
331
348
|
const level = this.levelFromHK(this.service.getCharacteristic(this.hapChar.RotationSpeed).value)
|
|
332
|
-
const speedLabel = level === 0
|
|
349
|
+
const speedLabel = level === 0
|
|
350
|
+
? 'off'
|
|
351
|
+
: this.speed2label[level]
|
|
333
352
|
toReturn.services = ['fan']
|
|
334
353
|
toReturn.fan = {
|
|
335
|
-
state: this.service.getCharacteristic(this.hapChar.On).value
|
|
354
|
+
state: this.service.getCharacteristic(this.hapChar.On).value
|
|
355
|
+
? 'on'
|
|
356
|
+
: 'off',
|
|
336
357
|
speed: speedLabel,
|
|
337
358
|
}
|
|
338
359
|
if (!this.hideLight) {
|
|
339
360
|
toReturn.services.push('light')
|
|
340
361
|
toReturn.light = {
|
|
341
|
-
state: this.lightService.getCharacteristic(this.hapChar.On).value
|
|
362
|
+
state: this.lightService.getCharacteristic(this.hapChar.On).value
|
|
363
|
+
? 'on'
|
|
364
|
+
: 'off',
|
|
342
365
|
}
|
|
343
366
|
}
|
|
344
367
|
return toReturn
|
|
@@ -348,17 +371,25 @@ export default class {
|
|
|
348
371
|
// scale 1-33 is low, 34-66 medium and 67-100 high
|
|
349
372
|
levelFromHK(value) {
|
|
350
373
|
if (!this.speedAsPercent) {
|
|
351
|
-
return value < 0 || value > 3
|
|
374
|
+
return value < 0 || value > 3
|
|
375
|
+
? 0
|
|
376
|
+
: value
|
|
352
377
|
}
|
|
353
378
|
if (value <= 0) {
|
|
354
379
|
return 0
|
|
355
380
|
}
|
|
356
|
-
return value <= 33
|
|
381
|
+
return value <= 33
|
|
382
|
+
? 1
|
|
383
|
+
: value <= 66
|
|
384
|
+
? 2
|
|
385
|
+
: 3
|
|
357
386
|
}
|
|
358
387
|
|
|
359
388
|
// A fan level as a HomeKit rotation speed, on whichever scale is in use
|
|
360
389
|
levelToHK(level) {
|
|
361
|
-
return this.speedAsPercent && level
|
|
390
|
+
return this.speedAsPercent && level
|
|
391
|
+
? level * 33
|
|
392
|
+
: level
|
|
362
393
|
}
|
|
363
394
|
|
|
364
395
|
markStatus(isOnline) {
|
package/lib/device/group.js
CHANGED
|
@@ -72,13 +72,17 @@ export default class {
|
|
|
72
72
|
}
|
|
73
73
|
const params = {}
|
|
74
74
|
if (this.isSCM) {
|
|
75
|
-
params.switches = [
|
|
75
|
+
params.switches = [
|
|
76
|
+
{ switch: newValue, outlet: 0 },
|
|
77
|
+
]
|
|
76
78
|
} else {
|
|
77
79
|
params.switch = newValue
|
|
78
80
|
}
|
|
79
81
|
await this.platform.sendGroupUpdate(this.accessory, params)
|
|
80
82
|
this.cacheState = newValue
|
|
81
|
-
this.accessory.eveService.addEntry({
|
|
83
|
+
this.accessory.eveService.addEntry({
|
|
84
|
+
status: value ? 1 : 0,
|
|
85
|
+
})
|
|
82
86
|
if (this.enableLogging) {
|
|
83
87
|
this.log('[%s] %s [%s].', this.name, this.lang.curState, this.cacheState)
|
|
84
88
|
}
|
|
@@ -96,7 +100,11 @@ export default class {
|
|
|
96
100
|
if (!this.isSCM && params.switch && params.switch !== this.cacheState) {
|
|
97
101
|
this.cacheState = params.switch
|
|
98
102
|
this.service.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
|
|
99
|
-
this.accessory.eveService.addEntry({
|
|
103
|
+
this.accessory.eveService.addEntry({
|
|
104
|
+
status: this.cacheState === 'on'
|
|
105
|
+
? 1
|
|
106
|
+
: 0,
|
|
107
|
+
})
|
|
100
108
|
if (params.updateSource && this.enableLogging) {
|
|
101
109
|
this.log('[%s] %s [%s].', this.name, this.lang.curState, this.cacheState)
|
|
102
110
|
}
|
|
@@ -104,7 +112,11 @@ export default class {
|
|
|
104
112
|
if (this.isSCM && params.switches?.[0] && params.switches[0].switch !== this.cacheState) {
|
|
105
113
|
this.cacheState = params.switches[0].switch
|
|
106
114
|
this.service.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
|
|
107
|
-
this.accessory.eveService.addEntry({
|
|
115
|
+
this.accessory.eveService.addEntry({
|
|
116
|
+
status: this.cacheState === 'on'
|
|
117
|
+
? 1
|
|
118
|
+
: 0,
|
|
119
|
+
})
|
|
108
120
|
if (params.updateSource && this.enableLogging) {
|
|
109
121
|
this.log('[%s] %s [%s].', this.name, this.lang.curState, this.cacheState)
|
|
110
122
|
}
|
|
@@ -118,7 +130,9 @@ export default class {
|
|
|
118
130
|
const toReturn = {}
|
|
119
131
|
toReturn.services = ['switch']
|
|
120
132
|
toReturn.switch = {
|
|
121
|
-
state: this.service.getCharacteristic(this.hapChar.On).value
|
|
133
|
+
state: this.service.getCharacteristic(this.hapChar.On).value
|
|
134
|
+
? 'on'
|
|
135
|
+
: 'off',
|
|
122
136
|
}
|
|
123
137
|
return toReturn
|
|
124
138
|
}
|
package/lib/device/humidifier.js
CHANGED
package/lib/device/light-cct.js
CHANGED
|
@@ -336,7 +336,9 @@ export default class {
|
|
|
336
336
|
const toReturn = {}
|
|
337
337
|
toReturn.services = ['light']
|
|
338
338
|
toReturn.light = {
|
|
339
|
-
state: this.service.getCharacteristic(this.hapChar.On).value
|
|
339
|
+
state: this.service.getCharacteristic(this.hapChar.On).value
|
|
340
|
+
? 'on'
|
|
341
|
+
: 'off',
|
|
340
342
|
brightness: this.service.getCharacteristic(this.hapChar.Brightness).value,
|
|
341
343
|
colourtemperature: this.service.getCharacteristic(this.hapChar.ColorTemperature).value,
|
|
342
344
|
adaptivelighting:
|
|
@@ -272,9 +272,15 @@ export default class {
|
|
|
272
272
|
this.log(
|
|
273
273
|
'[%s] %s%s%s.',
|
|
274
274
|
this.name,
|
|
275
|
-
power !== undefined
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
power !== undefined
|
|
276
|
+
? `${this.lang.curPower} [${power}W]`
|
|
277
|
+
: '',
|
|
278
|
+
voltage !== undefined
|
|
279
|
+
? ` ${this.lang.curVolt} [${voltage}V]`
|
|
280
|
+
: '',
|
|
281
|
+
current !== undefined
|
|
282
|
+
? ` ${this.lang.curCurr} [${current}A]`
|
|
283
|
+
: '',
|
|
278
284
|
)
|
|
279
285
|
}
|
|
280
286
|
}
|
|
@@ -300,7 +306,9 @@ export default class {
|
|
|
300
306
|
const toReturn = {}
|
|
301
307
|
toReturn.services = ['light']
|
|
302
308
|
toReturn.light = {
|
|
303
|
-
state: this.service.getCharacteristic(this.hapChar.On).value
|
|
309
|
+
state: this.service.getCharacteristic(this.hapChar.On).value
|
|
310
|
+
? 'on'
|
|
311
|
+
: 'off',
|
|
304
312
|
brightness: this.service.getCharacteristic(this.hapChar.Brightness).value,
|
|
305
313
|
}
|
|
306
314
|
return toReturn
|
|
@@ -840,9 +840,13 @@ export default class {
|
|
|
840
840
|
const toReturn = {}
|
|
841
841
|
toReturn.services = ['light']
|
|
842
842
|
toReturn.light = {
|
|
843
|
-
state: this.service.getCharacteristic(this.hapChar.On).value
|
|
843
|
+
state: this.service.getCharacteristic(this.hapChar.On).value
|
|
844
|
+
? 'on'
|
|
845
|
+
: 'off',
|
|
844
846
|
brightness: this.service.getCharacteristic(this.hapChar.Brightness).value,
|
|
845
|
-
colourmode: this.cacheMode === 'white'
|
|
847
|
+
colourmode: this.cacheMode === 'white'
|
|
848
|
+
? 'colourtemperature'
|
|
849
|
+
: 'hue',
|
|
846
850
|
hue: this.service.getCharacteristic(this.hapChar.Hue).value,
|
|
847
851
|
saturation: this.service.getCharacteristic(this.hapChar.Saturation).value,
|
|
848
852
|
colourtemperature: this.service.getCharacteristic(this.hapChar.ColorTemperature).value,
|
package/lib/device/light-rgb.js
CHANGED
|
@@ -210,7 +210,9 @@ export default class {
|
|
|
210
210
|
this.service.updateCharacteristic(this.hapChar.On, this.cacheState === 'on')
|
|
211
211
|
this.service.updateCharacteristic(
|
|
212
212
|
this.hapChar.Brightness,
|
|
213
|
-
this.cacheState === 'on'
|
|
213
|
+
this.cacheState === 'on'
|
|
214
|
+
? 100
|
|
215
|
+
: 0,
|
|
214
216
|
)
|
|
215
217
|
if (params.updateSource && this.enableLogging) {
|
|
216
218
|
this.log('[%s] %s [%s].', this.name, this.lang.curState, this.cacheState)
|
|
@@ -278,7 +280,9 @@ export default class {
|
|
|
278
280
|
const toReturn = {}
|
|
279
281
|
toReturn.services = ['light']
|
|
280
282
|
toReturn.light = {
|
|
281
|
-
state: this.service.getCharacteristic(this.hapChar.On).value
|
|
283
|
+
state: this.service.getCharacteristic(this.hapChar.On).value
|
|
284
|
+
? 'on'
|
|
285
|
+
: 'off',
|
|
282
286
|
brightness: this.service.getCharacteristic(this.hapChar.Brightness).value,
|
|
283
287
|
hue: this.service.getCharacteristic(this.hapChar.Hue).value,
|
|
284
288
|
saturation: this.service.getCharacteristic(this.hapChar.Saturation).value,
|
package/lib/device/motor.js
CHANGED
|
@@ -211,10 +211,20 @@ export default class {
|
|
|
211
211
|
// this.cachePos is 0 for closed and >0 for open
|
|
212
212
|
|
|
213
213
|
const params = this.accessory.context.eweUIID === 211
|
|
214
|
-
? {
|
|
215
|
-
|
|
214
|
+
? {
|
|
215
|
+
electromotor: value === 1
|
|
216
|
+
? 2
|
|
217
|
+
: 0,
|
|
218
|
+
}
|
|
219
|
+
: {
|
|
220
|
+
location: value === 1
|
|
221
|
+
? 0
|
|
222
|
+
: 100,
|
|
223
|
+
}
|
|
216
224
|
await this.platform.sendDeviceUpdate(this.accessory, params)
|
|
217
|
-
this.cacheTarg = value === 1
|
|
225
|
+
this.cacheTarg = value === 1
|
|
226
|
+
? 0
|
|
227
|
+
: 100
|
|
218
228
|
if (this.enableLogging) {
|
|
219
229
|
this.log('[%s] %s [%s%].', this.name, this.lang.curTarg, this.cacheTarg)
|
|
220
230
|
}
|
|
@@ -236,7 +246,9 @@ export default class {
|
|
|
236
246
|
}
|
|
237
247
|
|
|
238
248
|
// Send the params to request the updates
|
|
239
|
-
await this.platform.sendDeviceUpdate(this.accessory, {
|
|
249
|
+
await this.platform.sendDeviceUpdate(this.accessory, {
|
|
250
|
+
uiActive: { outlet: 0, time: 120 },
|
|
251
|
+
})
|
|
240
252
|
} catch (err) {
|
|
241
253
|
this.log.error(err)
|
|
242
254
|
}
|
|
@@ -363,9 +375,15 @@ export default class {
|
|
|
363
375
|
this.log(
|
|
364
376
|
'[%s] %s%s%s.',
|
|
365
377
|
this.name,
|
|
366
|
-
power !== undefined
|
|
367
|
-
|
|
368
|
-
|
|
378
|
+
power !== undefined
|
|
379
|
+
? `${this.lang.curPower} [${power}W]`
|
|
380
|
+
: '',
|
|
381
|
+
voltage !== undefined
|
|
382
|
+
? ` ${this.lang.curVolt} [${voltage}V]`
|
|
383
|
+
: '',
|
|
384
|
+
current !== undefined
|
|
385
|
+
? ` ${this.lang.curCurr} [${current}A]`
|
|
386
|
+
: '',
|
|
369
387
|
)
|
|
370
388
|
}
|
|
371
389
|
} catch (err) {
|