@switchbot/homebridge-switchbot 2.8.2-beta.1 → 2.8.2
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 +10 -0
- package/config.schema.json +1 -1
- package/dist/device/blindtilt.d.ts +2 -1
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +39 -14
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +2 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +23 -17
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +2 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +16 -14
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +2 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +21 -14
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +2 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +16 -14
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +4 -3
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +36 -18
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +2 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +16 -14
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +5 -4
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +16 -14
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +2 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +29 -14
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +2 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +21 -14
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +2 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +18 -15
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +3 -2
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +48 -26
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +3 -2
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +46 -23
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +5 -4
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +22 -19
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +2 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +17 -14
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +2 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +19 -13
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +7 -19
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +36 -18
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +4 -7
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +26 -12
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +4 -7
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +24 -12
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +4 -7
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +23 -12
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +4 -7
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +24 -12
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +4 -7
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +24 -12
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +5 -10
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +27 -14
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +4 -7
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +24 -12
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +6 -16
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +28 -16
- package/dist/irdevice/waterheater.js.map +1 -1
- package/package.json +3 -3
- package/src/device/blindtilt.ts +41 -16
- package/src/device/bot.ts +25 -17
- package/src/device/ceilinglight.ts +20 -14
- package/src/device/colorbulb.ts +23 -14
- package/src/device/contact.ts +20 -14
- package/src/device/curtain.ts +41 -21
- package/src/device/hub.ts +20 -14
- package/src/device/humidifier.ts +23 -17
- package/src/device/iosensor.ts +33 -14
- package/src/device/lightstrip.ts +23 -14
- package/src/device/lock.ts +22 -15
- package/src/device/meter.ts +52 -27
- package/src/device/meterplus.ts +51 -26
- package/src/device/motion.ts +31 -30
- package/src/device/plug.ts +20 -14
- package/src/device/robotvacuumcleaner.ts +21 -13
- package/src/irdevice/airconditioner.ts +36 -18
- package/src/irdevice/airpurifier.ts +26 -12
- package/src/irdevice/camera.ts +24 -12
- package/src/irdevice/fan.ts +23 -12
- package/src/irdevice/light.ts +24 -12
- package/src/irdevice/other.ts +24 -12
- package/src/irdevice/tv.ts +27 -14
- package/src/irdevice/vacuumcleaner.ts +24 -12
- package/src/irdevice/waterheater.ts +28 -16
- package/.github/npm-version-script.js +0 -81
package/src/irdevice/camera.ts
CHANGED
|
@@ -14,6 +14,7 @@ export class Camera {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
On!: CharacteristicValue;
|
|
17
|
+
FirmwareRevision!: CharacteristicValue;
|
|
17
18
|
|
|
18
19
|
// Config
|
|
19
20
|
deviceLogging!: string;
|
|
@@ -28,8 +29,8 @@ export class Camera {
|
|
|
28
29
|
// default placeholders
|
|
29
30
|
this.logs(device);
|
|
30
31
|
this.context();
|
|
31
|
-
this.disablePushOnChanges(
|
|
32
|
-
this.disablePushOffChanges(
|
|
32
|
+
this.disablePushOnChanges(device);
|
|
33
|
+
this.disablePushOffChanges(device);
|
|
33
34
|
this.config(device);
|
|
34
35
|
|
|
35
36
|
// set accessory information
|
|
@@ -38,9 +39,9 @@ export class Camera {
|
|
|
38
39
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
39
40
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
40
41
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
41
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
42
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
42
43
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
43
|
-
.updateValue(this.
|
|
44
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
44
45
|
|
|
45
46
|
// get the Television service if it exists, otherwise create a new Television service
|
|
46
47
|
// you can create multiple services for each accessory
|
|
@@ -148,6 +149,7 @@ export class Camera {
|
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
152
|
+
// On
|
|
151
153
|
if (this.On === undefined) {
|
|
152
154
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
153
155
|
} else {
|
|
@@ -155,9 +157,19 @@ export class Camera {
|
|
|
155
157
|
this.switchService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
156
158
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
157
159
|
}
|
|
160
|
+
// FirmwareRevision
|
|
161
|
+
if (this.FirmwareRevision === undefined) {
|
|
162
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
163
|
+
} else {
|
|
164
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
165
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
166
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
167
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
168
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
169
|
+
}
|
|
158
170
|
}
|
|
159
171
|
|
|
160
|
-
async disablePushOnChanges(
|
|
172
|
+
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
161
173
|
if (device.disablePushOn === undefined) {
|
|
162
174
|
this.disablePushOn = false;
|
|
163
175
|
} else {
|
|
@@ -165,7 +177,7 @@ export class Camera {
|
|
|
165
177
|
}
|
|
166
178
|
}
|
|
167
179
|
|
|
168
|
-
async disablePushOffChanges(
|
|
180
|
+
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
169
181
|
if (device.disablePushOff === undefined) {
|
|
170
182
|
this.disablePushOff = false;
|
|
171
183
|
} else {
|
|
@@ -247,21 +259,21 @@ export class Camera {
|
|
|
247
259
|
this.switchService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
248
260
|
}
|
|
249
261
|
|
|
250
|
-
|
|
251
|
-
let FirmwareRevision: string;
|
|
262
|
+
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
252
263
|
this.debugLog(
|
|
253
264
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
254
265
|
);
|
|
255
266
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
256
267
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
257
268
|
if (accessory.context.FirmwareRevision) {
|
|
258
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
269
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
259
270
|
} else if (device.firmware) {
|
|
260
|
-
FirmwareRevision = device.firmware;
|
|
271
|
+
this.FirmwareRevision = device.firmware;
|
|
261
272
|
} else {
|
|
262
|
-
FirmwareRevision = this.platform.version
|
|
273
|
+
this.FirmwareRevision = this.platform.version!;
|
|
263
274
|
}
|
|
264
|
-
|
|
275
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
276
|
+
return JSON.stringify(this.FirmwareRevision);
|
|
265
277
|
}
|
|
266
278
|
|
|
267
279
|
async context() {
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -16,6 +16,7 @@ export class Fan {
|
|
|
16
16
|
Active!: CharacteristicValue;
|
|
17
17
|
SwingMode!: CharacteristicValue;
|
|
18
18
|
RotationSpeed!: CharacteristicValue;
|
|
19
|
+
FirmwareRevision!: CharacteristicValue;
|
|
19
20
|
ActiveIdentifier!: CharacteristicValue;
|
|
20
21
|
RotationDirection!: CharacteristicValue;
|
|
21
22
|
|
|
@@ -35,8 +36,8 @@ export class Fan {
|
|
|
35
36
|
// default placeholders
|
|
36
37
|
this.logs(device);
|
|
37
38
|
this.context();
|
|
38
|
-
this.disablePushOnChanges(
|
|
39
|
-
this.disablePushOffChanges(
|
|
39
|
+
this.disablePushOnChanges(device);
|
|
40
|
+
this.disablePushOffChanges(device);
|
|
40
41
|
this.config(device);
|
|
41
42
|
|
|
42
43
|
// set accessory information
|
|
@@ -45,9 +46,9 @@ export class Fan {
|
|
|
45
46
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
46
47
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
47
48
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
48
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
49
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
49
50
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
50
|
-
.updateValue(this.
|
|
51
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
51
52
|
|
|
52
53
|
// get the Television service if it exists, otherwise create a new Television service
|
|
53
54
|
// you can create multiple services for each accessory
|
|
@@ -286,9 +287,19 @@ export class Fan {
|
|
|
286
287
|
this.fanService?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
|
|
287
288
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
|
|
288
289
|
}
|
|
290
|
+
// FirmwareRevision
|
|
291
|
+
if (this.FirmwareRevision === undefined) {
|
|
292
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
293
|
+
} else {
|
|
294
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
295
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
296
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
297
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
298
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
299
|
+
}
|
|
289
300
|
}
|
|
290
301
|
|
|
291
|
-
async disablePushOnChanges(
|
|
302
|
+
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
292
303
|
if (device.disablePushOn === undefined) {
|
|
293
304
|
this.disablePushOn = false;
|
|
294
305
|
} else {
|
|
@@ -296,7 +307,7 @@ export class Fan {
|
|
|
296
307
|
}
|
|
297
308
|
}
|
|
298
309
|
|
|
299
|
-
async disablePushOffChanges(
|
|
310
|
+
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
300
311
|
if (device.disablePushOff === undefined) {
|
|
301
312
|
this.disablePushOff = false;
|
|
302
313
|
} else {
|
|
@@ -380,21 +391,21 @@ export class Fan {
|
|
|
380
391
|
this.fanService.updateCharacteristic(this.platform.Characteristic.SwingMode, e);
|
|
381
392
|
}
|
|
382
393
|
|
|
383
|
-
|
|
384
|
-
let FirmwareRevision: string;
|
|
394
|
+
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
385
395
|
this.debugLog(
|
|
386
396
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
387
397
|
);
|
|
388
398
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
389
399
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
390
400
|
if (accessory.context.FirmwareRevision) {
|
|
391
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
401
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
392
402
|
} else if (device.firmware) {
|
|
393
|
-
FirmwareRevision = device.firmware;
|
|
403
|
+
this.FirmwareRevision = device.firmware;
|
|
394
404
|
} else {
|
|
395
|
-
FirmwareRevision = this.platform.version
|
|
405
|
+
this.FirmwareRevision = this.platform.version!;
|
|
396
406
|
}
|
|
397
|
-
|
|
407
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
408
|
+
return JSON.stringify(this.FirmwareRevision);
|
|
398
409
|
}
|
|
399
410
|
|
|
400
411
|
async context() {
|
package/src/irdevice/light.ts
CHANGED
|
@@ -14,6 +14,7 @@ export class Light {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
On!: CharacteristicValue;
|
|
17
|
+
FirmwareRevision!: CharacteristicValue;
|
|
17
18
|
|
|
18
19
|
// Config
|
|
19
20
|
deviceLogging!: string;
|
|
@@ -28,8 +29,8 @@ export class Light {
|
|
|
28
29
|
// default placeholders
|
|
29
30
|
this.logs(device);
|
|
30
31
|
this.context();
|
|
31
|
-
this.disablePushOnChanges(
|
|
32
|
-
this.disablePushOffChanges(
|
|
32
|
+
this.disablePushOnChanges(device);
|
|
33
|
+
this.disablePushOffChanges(device);
|
|
33
34
|
this.config(device);
|
|
34
35
|
|
|
35
36
|
// set accessory information
|
|
@@ -38,9 +39,9 @@ export class Light {
|
|
|
38
39
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
39
40
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
40
41
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
41
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
42
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
42
43
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
43
|
-
.updateValue(this.
|
|
44
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
44
45
|
|
|
45
46
|
// get the Light service if it exists, otherwise create a new Light service
|
|
46
47
|
// you can create multiple services for each accessory
|
|
@@ -173,6 +174,7 @@ export class Light {
|
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
177
|
+
// On
|
|
176
178
|
if (this.On === undefined) {
|
|
177
179
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
178
180
|
} else {
|
|
@@ -180,9 +182,19 @@ export class Light {
|
|
|
180
182
|
this.lightBulbService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
181
183
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
182
184
|
}
|
|
185
|
+
// FirmwareRevision
|
|
186
|
+
if (this.FirmwareRevision === undefined) {
|
|
187
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
188
|
+
} else {
|
|
189
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
190
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
191
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
192
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
193
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
194
|
+
}
|
|
183
195
|
}
|
|
184
196
|
|
|
185
|
-
async disablePushOnChanges(
|
|
197
|
+
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
186
198
|
if (device.disablePushOn === undefined) {
|
|
187
199
|
this.disablePushOn = false;
|
|
188
200
|
} else {
|
|
@@ -190,7 +202,7 @@ export class Light {
|
|
|
190
202
|
}
|
|
191
203
|
}
|
|
192
204
|
|
|
193
|
-
async disablePushOffChanges(
|
|
205
|
+
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
194
206
|
if (device.disablePushOff === undefined) {
|
|
195
207
|
this.disablePushOff = false;
|
|
196
208
|
} else {
|
|
@@ -272,21 +284,21 @@ export class Light {
|
|
|
272
284
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
273
285
|
}
|
|
274
286
|
|
|
275
|
-
|
|
276
|
-
let FirmwareRevision: string;
|
|
287
|
+
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
277
288
|
this.debugLog(
|
|
278
289
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
279
290
|
);
|
|
280
291
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
281
292
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
282
293
|
if (accessory.context.FirmwareRevision) {
|
|
283
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
294
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
284
295
|
} else if (device.firmware) {
|
|
285
|
-
FirmwareRevision = device.firmware;
|
|
296
|
+
this.FirmwareRevision = device.firmware;
|
|
286
297
|
} else {
|
|
287
|
-
FirmwareRevision = this.platform.version
|
|
298
|
+
this.FirmwareRevision = this.platform.version!;
|
|
288
299
|
}
|
|
289
|
-
|
|
300
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
301
|
+
return JSON.stringify(this.FirmwareRevision);
|
|
290
302
|
}
|
|
291
303
|
|
|
292
304
|
async context() {
|
package/src/irdevice/other.ts
CHANGED
|
@@ -14,6 +14,7 @@ export class Others {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
Active!: CharacteristicValue;
|
|
17
|
+
FirmwareRevision!: CharacteristicValue;
|
|
17
18
|
|
|
18
19
|
// Config
|
|
19
20
|
deviceLogging!: string;
|
|
@@ -30,8 +31,8 @@ export class Others {
|
|
|
30
31
|
this.logs(device);
|
|
31
32
|
this.deviceType(device);
|
|
32
33
|
this.context();
|
|
33
|
-
this.disablePushOnChanges(
|
|
34
|
-
this.disablePushOffChanges(
|
|
34
|
+
this.disablePushOnChanges(device);
|
|
35
|
+
this.disablePushOffChanges(device);
|
|
35
36
|
this.config(device);
|
|
36
37
|
|
|
37
38
|
// set accessory information
|
|
@@ -40,9 +41,9 @@ export class Others {
|
|
|
40
41
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
41
42
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
42
43
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
43
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
44
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
44
45
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
45
|
-
.updateValue(this.
|
|
46
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
46
47
|
|
|
47
48
|
// get the Television service if it exists, otherwise create a new Television service
|
|
48
49
|
// you can create multiple services for each accessory
|
|
@@ -173,6 +174,7 @@ export class Others {
|
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
177
|
+
// Active
|
|
176
178
|
if (this.Active === undefined) {
|
|
177
179
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
178
180
|
} else {
|
|
@@ -180,9 +182,19 @@ export class Others {
|
|
|
180
182
|
this.fanService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
181
183
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
182
184
|
}
|
|
185
|
+
// FirmwareRevision
|
|
186
|
+
if (this.FirmwareRevision === undefined) {
|
|
187
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
188
|
+
} else {
|
|
189
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
190
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
191
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
192
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
193
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
194
|
+
}
|
|
183
195
|
}
|
|
184
196
|
|
|
185
|
-
async disablePushOnChanges(
|
|
197
|
+
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
186
198
|
if (device.disablePushOn === undefined) {
|
|
187
199
|
this.disablePushOn = false;
|
|
188
200
|
} else {
|
|
@@ -190,7 +202,7 @@ export class Others {
|
|
|
190
202
|
}
|
|
191
203
|
}
|
|
192
204
|
|
|
193
|
-
async disablePushOffChanges(
|
|
205
|
+
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
194
206
|
if (device.disablePushOff === undefined) {
|
|
195
207
|
this.disablePushOff = false;
|
|
196
208
|
} else {
|
|
@@ -284,21 +296,21 @@ export class Others {
|
|
|
284
296
|
}
|
|
285
297
|
}
|
|
286
298
|
|
|
287
|
-
|
|
288
|
-
let FirmwareRevision: string;
|
|
299
|
+
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
289
300
|
this.debugLog(
|
|
290
301
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
291
302
|
);
|
|
292
303
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
293
304
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
294
305
|
if (accessory.context.FirmwareRevision) {
|
|
295
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
306
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
296
307
|
} else if (device.firmware) {
|
|
297
|
-
FirmwareRevision = device.firmware;
|
|
308
|
+
this.FirmwareRevision = device.firmware;
|
|
298
309
|
} else {
|
|
299
|
-
FirmwareRevision = this.platform.version
|
|
310
|
+
this.FirmwareRevision = this.platform.version!;
|
|
300
311
|
}
|
|
301
|
-
|
|
312
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
313
|
+
return JSON.stringify(this.FirmwareRevision);
|
|
302
314
|
}
|
|
303
315
|
|
|
304
316
|
async context() {
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -16,6 +16,7 @@ export class TV {
|
|
|
16
16
|
// Characteristic Values
|
|
17
17
|
Active!: CharacteristicValue;
|
|
18
18
|
ActiveIdentifier!: CharacteristicValue;
|
|
19
|
+
FirmwareRevision!: CharacteristicValue;
|
|
19
20
|
|
|
20
21
|
// Config
|
|
21
22
|
deviceLogging!: string;
|
|
@@ -31,9 +32,9 @@ export class TV {
|
|
|
31
32
|
// default placeholders
|
|
32
33
|
this.logs(device);
|
|
33
34
|
this.context();
|
|
34
|
-
this.disablePushOnChanges(
|
|
35
|
-
this.disablePushOffChanges(
|
|
36
|
-
this.disablePushDetailChanges(
|
|
35
|
+
this.disablePushOnChanges(device);
|
|
36
|
+
this.disablePushOffChanges(device);
|
|
37
|
+
this.disablePushDetailChanges(device);
|
|
37
38
|
this.config(device);
|
|
38
39
|
|
|
39
40
|
// set accessory information
|
|
@@ -43,9 +44,9 @@ export class TV {
|
|
|
43
44
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
44
45
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
45
46
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
46
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
47
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
47
48
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
48
|
-
.updateValue(this.
|
|
49
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
49
50
|
|
|
50
51
|
// set the accessory category
|
|
51
52
|
switch (device.remoteType) {
|
|
@@ -397,6 +398,7 @@ export class TV {
|
|
|
397
398
|
}
|
|
398
399
|
|
|
399
400
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
401
|
+
// Active
|
|
400
402
|
if (this.Active === undefined) {
|
|
401
403
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
402
404
|
} else {
|
|
@@ -404,6 +406,7 @@ export class TV {
|
|
|
404
406
|
this.tvService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
405
407
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
406
408
|
}
|
|
409
|
+
// ActiveIdentifier
|
|
407
410
|
if (this.ActiveIdentifier === undefined) {
|
|
408
411
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ActiveIdentifier: ${this.ActiveIdentifier}`);
|
|
409
412
|
} else {
|
|
@@ -411,9 +414,19 @@ export class TV {
|
|
|
411
414
|
this.tvService?.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, this.ActiveIdentifier);
|
|
412
415
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic ActiveIdentifier: ${this.ActiveIdentifier}`);
|
|
413
416
|
}
|
|
417
|
+
// FirmwareRevision
|
|
418
|
+
if (this.FirmwareRevision === undefined) {
|
|
419
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
420
|
+
} else {
|
|
421
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
422
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
423
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
424
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
425
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
426
|
+
}
|
|
414
427
|
}
|
|
415
428
|
|
|
416
|
-
async disablePushOnChanges(
|
|
429
|
+
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
417
430
|
if (device.disablePushOn === undefined) {
|
|
418
431
|
this.disablePushOn = false;
|
|
419
432
|
} else {
|
|
@@ -421,7 +434,7 @@ export class TV {
|
|
|
421
434
|
}
|
|
422
435
|
}
|
|
423
436
|
|
|
424
|
-
async disablePushOffChanges(
|
|
437
|
+
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
425
438
|
if (device.disablePushOff === undefined) {
|
|
426
439
|
this.disablePushOff = false;
|
|
427
440
|
} else {
|
|
@@ -429,7 +442,7 @@ export class TV {
|
|
|
429
442
|
}
|
|
430
443
|
}
|
|
431
444
|
|
|
432
|
-
async disablePushDetailChanges(
|
|
445
|
+
async disablePushDetailChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
433
446
|
if (device.disablePushDetail === undefined) {
|
|
434
447
|
this.disablePushDetail = false;
|
|
435
448
|
} else {
|
|
@@ -512,21 +525,21 @@ export class TV {
|
|
|
512
525
|
this.tvService.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, e);
|
|
513
526
|
}
|
|
514
527
|
|
|
515
|
-
|
|
516
|
-
let FirmwareRevision: string;
|
|
528
|
+
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
517
529
|
this.debugLog(
|
|
518
530
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
519
531
|
);
|
|
520
532
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
521
533
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
522
534
|
if (accessory.context.FirmwareRevision) {
|
|
523
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
535
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
524
536
|
} else if (device.firmware) {
|
|
525
|
-
FirmwareRevision = device.firmware;
|
|
537
|
+
this.FirmwareRevision = device.firmware;
|
|
526
538
|
} else {
|
|
527
|
-
FirmwareRevision = this.platform.version
|
|
539
|
+
this.FirmwareRevision = this.platform.version!;
|
|
528
540
|
}
|
|
529
|
-
|
|
541
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
542
|
+
return JSON.stringify(this.FirmwareRevision);
|
|
530
543
|
}
|
|
531
544
|
|
|
532
545
|
async context() {
|
|
@@ -14,6 +14,7 @@ export class VacuumCleaner {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
On!: CharacteristicValue;
|
|
17
|
+
FirmwareRevision!: CharacteristicValue;
|
|
17
18
|
|
|
18
19
|
// Config
|
|
19
20
|
deviceLogging!: string;
|
|
@@ -28,8 +29,8 @@ export class VacuumCleaner {
|
|
|
28
29
|
// default placeholders
|
|
29
30
|
this.logs(device);
|
|
30
31
|
this.context();
|
|
31
|
-
this.disablePushOnChanges(
|
|
32
|
-
this.disablePushOffChanges(
|
|
32
|
+
this.disablePushOnChanges(device);
|
|
33
|
+
this.disablePushOffChanges(device);
|
|
33
34
|
this.config(device);
|
|
34
35
|
|
|
35
36
|
// set accessory information
|
|
@@ -38,9 +39,9 @@ export class VacuumCleaner {
|
|
|
38
39
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
39
40
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
40
41
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
41
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
42
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
42
43
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
43
|
-
.updateValue(this.
|
|
44
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
44
45
|
|
|
45
46
|
// get the Television service if it exists, otherwise create a new Television service
|
|
46
47
|
// you can create multiple services for each accessory
|
|
@@ -144,6 +145,7 @@ export class VacuumCleaner {
|
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
148
|
+
// On
|
|
147
149
|
if (this.On === undefined) {
|
|
148
150
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
149
151
|
} else {
|
|
@@ -151,9 +153,19 @@ export class VacuumCleaner {
|
|
|
151
153
|
this.switchService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
152
154
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
153
155
|
}
|
|
156
|
+
// FirmwareRevision
|
|
157
|
+
if (this.FirmwareRevision === undefined) {
|
|
158
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
159
|
+
} else {
|
|
160
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
161
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
162
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
163
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
164
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
165
|
+
}
|
|
154
166
|
}
|
|
155
167
|
|
|
156
|
-
async disablePushOnChanges(
|
|
168
|
+
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
157
169
|
if (device.disablePushOn === undefined) {
|
|
158
170
|
this.disablePushOn = false;
|
|
159
171
|
} else {
|
|
@@ -161,7 +173,7 @@ export class VacuumCleaner {
|
|
|
161
173
|
}
|
|
162
174
|
}
|
|
163
175
|
|
|
164
|
-
async disablePushOffChanges(
|
|
176
|
+
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
165
177
|
if (device.disablePushOff === undefined) {
|
|
166
178
|
this.disablePushOff = false;
|
|
167
179
|
} else {
|
|
@@ -243,21 +255,21 @@ export class VacuumCleaner {
|
|
|
243
255
|
this.switchService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
244
256
|
}
|
|
245
257
|
|
|
246
|
-
|
|
247
|
-
let FirmwareRevision: string;
|
|
258
|
+
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
248
259
|
this.debugLog(
|
|
249
260
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
250
261
|
);
|
|
251
262
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
252
263
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
253
264
|
if (accessory.context.FirmwareRevision) {
|
|
254
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
265
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
255
266
|
} else if (device.firmware) {
|
|
256
|
-
FirmwareRevision = device.firmware;
|
|
267
|
+
this.FirmwareRevision = device.firmware;
|
|
257
268
|
} else {
|
|
258
|
-
FirmwareRevision = this.platform.version
|
|
269
|
+
this.FirmwareRevision = this.platform.version!;
|
|
259
270
|
}
|
|
260
|
-
|
|
271
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
272
|
+
return JSON.stringify(this.FirmwareRevision);
|
|
261
273
|
}
|
|
262
274
|
|
|
263
275
|
async context() {
|