@switchbot/homebridge-switchbot 2.8.2-beta.1 → 2.8.2-beta.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/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 +26 -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 +19 -15
- 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 +2 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +19 -14
- 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 +16 -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 +16 -14
- 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 +35 -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 +33 -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 +16 -14
- 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 +2 -2
- package/src/device/blindtilt.ts +28 -16
- package/src/device/bot.ts +21 -15
- 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 +22 -15
- package/src/device/hub.ts +20 -14
- package/src/device/humidifier.ts +23 -17
- package/src/device/iosensor.ts +20 -14
- package/src/device/lightstrip.ts +23 -14
- package/src/device/lock.ts +20 -14
- package/src/device/meter.ts +39 -27
- package/src/device/meterplus.ts +38 -26
- package/src/device/motion.ts +24 -23
- 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/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() {
|
|
@@ -14,6 +14,7 @@ export class WaterHeater {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
Active!: CharacteristicValue;
|
|
17
|
+
FirmwareRevision!: CharacteristicValue;
|
|
17
18
|
|
|
18
19
|
// Config
|
|
19
20
|
deviceLogging!: string;
|
|
@@ -26,11 +27,11 @@ export class WaterHeater {
|
|
|
26
27
|
public device: irdevice & irDevicesConfig,
|
|
27
28
|
) {
|
|
28
29
|
// default placeholders
|
|
29
|
-
this.logs(
|
|
30
|
+
this.logs(device);
|
|
30
31
|
this.context();
|
|
31
|
-
this.disablePushOnChanges(
|
|
32
|
-
this.disablePushOffChanges(
|
|
33
|
-
this.config(
|
|
32
|
+
this.disablePushOnChanges(device);
|
|
33
|
+
this.disablePushOffChanges(device);
|
|
34
|
+
this.config(device);
|
|
34
35
|
|
|
35
36
|
// set accessory information
|
|
36
37
|
accessory
|
|
@@ -38,9 +39,9 @@ export class WaterHeater {
|
|
|
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
|
|
@@ -153,6 +154,7 @@ export class WaterHeater {
|
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
157
|
+
// Active
|
|
156
158
|
if (this.Active === undefined) {
|
|
157
159
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
158
160
|
} else {
|
|
@@ -160,9 +162,19 @@ export class WaterHeater {
|
|
|
160
162
|
this.valveService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
161
163
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
162
164
|
}
|
|
165
|
+
// FirmwareRevision
|
|
166
|
+
if (this.FirmwareRevision === undefined) {
|
|
167
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
168
|
+
} else {
|
|
169
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
170
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
171
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
172
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
173
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
174
|
+
}
|
|
163
175
|
}
|
|
164
176
|
|
|
165
|
-
async disablePushOnChanges(
|
|
177
|
+
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
166
178
|
if (device.disablePushOn === undefined) {
|
|
167
179
|
this.disablePushOn = false;
|
|
168
180
|
} else {
|
|
@@ -170,7 +182,7 @@ export class WaterHeater {
|
|
|
170
182
|
}
|
|
171
183
|
}
|
|
172
184
|
|
|
173
|
-
async disablePushOffChanges(
|
|
185
|
+
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
174
186
|
if (device.disablePushOff === undefined) {
|
|
175
187
|
this.disablePushOff = false;
|
|
176
188
|
} else {
|
|
@@ -252,21 +264,21 @@ export class WaterHeater {
|
|
|
252
264
|
this.valveService.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
253
265
|
}
|
|
254
266
|
|
|
255
|
-
|
|
256
|
-
let FirmwareRevision: string;
|
|
267
|
+
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
257
268
|
this.debugLog(
|
|
258
269
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
259
270
|
);
|
|
260
271
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
261
272
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
262
273
|
if (accessory.context.FirmwareRevision) {
|
|
263
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
274
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
264
275
|
} else if (device.firmware) {
|
|
265
|
-
FirmwareRevision = device.firmware;
|
|
276
|
+
this.FirmwareRevision = device.firmware;
|
|
266
277
|
} else {
|
|
267
|
-
FirmwareRevision = this.platform.version!;
|
|
278
|
+
this.FirmwareRevision = this.platform.version!;
|
|
268
279
|
}
|
|
269
|
-
|
|
280
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
281
|
+
return JSON.stringify(this.FirmwareRevision);
|
|
270
282
|
}
|
|
271
283
|
|
|
272
284
|
async context(): Promise<void> {
|
|
@@ -277,7 +289,7 @@ export class WaterHeater {
|
|
|
277
289
|
}
|
|
278
290
|
}
|
|
279
291
|
|
|
280
|
-
async config(
|
|
292
|
+
async config(device: irdevice & irDevicesConfig): Promise<void> {
|
|
281
293
|
let config = {};
|
|
282
294
|
if (device.irwh) {
|
|
283
295
|
config = device.irwh;
|
|
@@ -311,7 +323,7 @@ export class WaterHeater {
|
|
|
311
323
|
}
|
|
312
324
|
}
|
|
313
325
|
|
|
314
|
-
async logs(
|
|
326
|
+
async logs(device: irdevice & irDevicesConfig): Promise<void> {
|
|
315
327
|
if (this.platform.debugMode) {
|
|
316
328
|
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
317
329
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|