@switchbot/homebridge-switchbot 3.5.0-beta.26 → 3.5.0-beta.28
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/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +19 -16
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.js +15 -15
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.js +8 -8
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js +4 -4
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.js +6 -6
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +13 -13
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +2 -1
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +10 -3
- package/dist/device/device.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +7 -7
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.js +5 -5
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.js +6 -6
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.js +4 -4
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.js +7 -7
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.js +6 -6
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.js +6 -6
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.js +6 -7
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.js +4 -4
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.js +6 -6
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +10 -17
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +4 -14
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +227 -235
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +3 -6
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +66 -57
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +2 -3
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +25 -28
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +2 -7
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +58 -62
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +2 -1
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js +10 -3
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.d.ts +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +14 -16
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.js +52 -51
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.js +3 -3
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +2 -2
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.js +2 -2
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +22 -1
- package/dist/platform.js.map +1 -1
- package/package.json +2 -2
- package/src/custom.d.ts +1 -0
- package/src/device/blindtilt.ts +22 -20
- package/src/device/bot.ts +16 -16
- package/src/device/ceilinglight.ts +9 -9
- package/src/device/colorbulb.ts +5 -5
- package/src/device/contact.ts +7 -7
- package/src/device/curtain.ts +15 -14
- package/src/device/device.ts +11 -3
- package/src/device/hub.ts +8 -7
- package/src/device/humidifier.ts +6 -6
- package/src/device/iosensor.ts +7 -7
- package/src/device/lightstrip.ts +5 -5
- package/src/device/lock.ts +8 -8
- package/src/device/meter.ts +7 -7
- package/src/device/meterplus.ts +7 -7
- package/src/device/motion.ts +7 -7
- package/src/device/plug.ts +5 -5
- package/src/device/robotvacuumcleaner.ts +7 -7
- package/src/device/waterdetector.ts +10 -18
- package/src/irdevice/airconditioner.ts +240 -239
- package/src/irdevice/airpurifier.ts +76 -57
- package/src/irdevice/camera.ts +28 -28
- package/src/irdevice/fan.ts +64 -64
- package/src/irdevice/irdevice.ts +11 -3
- package/src/irdevice/light.ts +18 -16
- package/src/irdevice/other.ts +52 -52
- package/src/irdevice/tv.ts +3 -3
- package/src/irdevice/vacuumcleaner.ts +2 -2
- package/src/irdevice/waterheater.ts +2 -2
- package/src/platform.ts +21 -4
package/src/device/lock.ts
CHANGED
|
@@ -44,19 +44,16 @@ export class Lock extends deviceBase {
|
|
|
44
44
|
this.doLockUpdate = new Subject();
|
|
45
45
|
this.lockUpdateInProgress = false;
|
|
46
46
|
|
|
47
|
-
// Retrieve initial values and updateHomekit
|
|
48
|
-
this.refreshStatus();
|
|
49
|
-
|
|
50
47
|
// Initialize LockMechanism property
|
|
51
48
|
this.LockMechanism = {
|
|
52
|
-
Service: accessory.
|
|
49
|
+
Service: accessory.getService(this.hap.Service.LockMechanism)!,
|
|
53
50
|
LockTargetState: accessory.context.LockTargetState || this.hap.Characteristic.LockTargetState.SECURED,
|
|
54
51
|
LockCurrentState: accessory.context.LockCurrentState || this.hap.Characteristic.LockCurrentState.SECURED,
|
|
55
52
|
};
|
|
56
53
|
|
|
57
54
|
// Initialize Battery property
|
|
58
55
|
this.Battery = {
|
|
59
|
-
Service: accessory.
|
|
56
|
+
Service: accessory.getService(this.hap.Service.Battery)!,
|
|
60
57
|
BatteryLevel: accessory.context.BatteryLevel || 100,
|
|
61
58
|
StatusLowBattery: accessory.context.StatusLowBattery || this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
|
|
62
59
|
};
|
|
@@ -64,7 +61,7 @@ export class Lock extends deviceBase {
|
|
|
64
61
|
// Initialize ContactSensor property
|
|
65
62
|
if (!this.device.lock?.hide_contactsensor) {
|
|
66
63
|
this.ContactSensor = {
|
|
67
|
-
Service: accessory.
|
|
64
|
+
Service: accessory.getService(this.hap.Service.ContactSensor)!,
|
|
68
65
|
ContactSensorState: accessory.context.ContactSensorState || this.hap.Characteristic.ContactSensorState.CONTACT_DETECTED,
|
|
69
66
|
};
|
|
70
67
|
}
|
|
@@ -72,11 +69,14 @@ export class Lock extends deviceBase {
|
|
|
72
69
|
// Initialize Latch Button Service
|
|
73
70
|
if (device.lock?.activate_latchbutton) {
|
|
74
71
|
this.Switch = {
|
|
75
|
-
Service: accessory.
|
|
72
|
+
Service: accessory.getService(this.hap.Service.Switch)!,
|
|
76
73
|
On: accessory.context.On || false,
|
|
77
74
|
};
|
|
78
75
|
}
|
|
79
76
|
|
|
77
|
+
// Retrieve initial values and updateHomekit
|
|
78
|
+
this.refreshStatus();
|
|
79
|
+
|
|
80
80
|
// get the LockMechanism service if it exists, otherwise create a new LockMechanism service
|
|
81
81
|
// you can create multiple services for each accessory
|
|
82
82
|
const LockMechanismService = `${accessory.displayName} ${device.deviceType}`;
|
|
@@ -325,7 +325,7 @@ export class Lock extends deviceBase {
|
|
|
325
325
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
326
326
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
327
327
|
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
328
|
-
this.
|
|
328
|
+
this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
329
329
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
330
330
|
this.openAPIparseStatus(deviceStatus);
|
|
331
331
|
this.updateHomeKitCharacteristics();
|
package/src/device/meter.ts
CHANGED
|
@@ -40,13 +40,10 @@ export class Meter extends deviceBase {
|
|
|
40
40
|
this.doMeterUpdate = new Subject();
|
|
41
41
|
this.meterUpdateInProgress = false;
|
|
42
42
|
|
|
43
|
-
// Retrieve initial values and updateHomekit
|
|
44
|
-
this.refreshStatus();
|
|
45
|
-
|
|
46
43
|
// Initialize Temperature Sensor property
|
|
47
44
|
if (!device.meter?.hide_temperature) {
|
|
48
45
|
this.TemperatureSensor = {
|
|
49
|
-
Service:
|
|
46
|
+
Service: accessory.getService(this.hap.Service.TemperatureSensor)!,
|
|
50
47
|
CurrentTemperature: accessory.context.CurrentTemperature || 30,
|
|
51
48
|
};
|
|
52
49
|
}
|
|
@@ -54,18 +51,21 @@ export class Meter extends deviceBase {
|
|
|
54
51
|
// Initialize Humidity Sensor property
|
|
55
52
|
if (!device.meter?.hide_humidity) {
|
|
56
53
|
this.HumiditySensor = {
|
|
57
|
-
Service:
|
|
54
|
+
Service: accessory.getService(this.hap.Service.HumiditySensor)!,
|
|
58
55
|
CurrentRelativeHumidity: accessory.context.CurrentRelativeHumidity || 50,
|
|
59
56
|
};
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
// Initialize Battery property
|
|
63
60
|
this.Battery = {
|
|
64
|
-
Service:
|
|
61
|
+
Service: accessory.getService(this.hap.Service.Battery)!,
|
|
65
62
|
BatteryLevel: accessory.context.BatteryLevel || 100,
|
|
66
63
|
StatusLowBattery: accessory.context.StatusLowBattery || this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
|
|
67
64
|
};
|
|
68
65
|
|
|
66
|
+
// Retrieve initial values and updateHomekit
|
|
67
|
+
this.refreshStatus();
|
|
68
|
+
|
|
69
69
|
// Temperature Sensor Service
|
|
70
70
|
if (device.meter?.hide_temperature) {
|
|
71
71
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Temperature Sensor Service`);
|
|
@@ -290,7 +290,7 @@ export class Meter extends deviceBase {
|
|
|
290
290
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
291
291
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
292
292
|
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
293
|
-
this.
|
|
293
|
+
this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
294
294
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
295
295
|
this.openAPIparseStatus(deviceStatus);
|
|
296
296
|
this.updateHomeKitCharacteristics();
|
package/src/device/meterplus.ts
CHANGED
|
@@ -45,13 +45,10 @@ export class MeterPlus extends deviceBase {
|
|
|
45
45
|
this.doMeterUpdate = new Subject();
|
|
46
46
|
this.meterUpdateInProgress = false;
|
|
47
47
|
|
|
48
|
-
// Retrieve initial values and updateHomekit
|
|
49
|
-
this.refreshStatus();
|
|
50
|
-
|
|
51
48
|
// Initialize Temperature Sensor property
|
|
52
49
|
if (!device.meter?.hide_temperature) {
|
|
53
50
|
this.TemperatureSensor = {
|
|
54
|
-
Service:
|
|
51
|
+
Service: accessory.getService(this.hap.Service.TemperatureSensor)!,
|
|
55
52
|
CurrentTemperature: accessory.context.CurrentTemperature || 30,
|
|
56
53
|
};
|
|
57
54
|
}
|
|
@@ -59,18 +56,21 @@ export class MeterPlus extends deviceBase {
|
|
|
59
56
|
// Initialize Humidity Sensor property
|
|
60
57
|
if (!device.meter?.hide_humidity) {
|
|
61
58
|
this.HumiditySensor = {
|
|
62
|
-
Service:
|
|
59
|
+
Service: accessory.getService(this.hap.Service.HumiditySensor)!,
|
|
63
60
|
CurrentRelativeHumidity: accessory.context.CurrentRelativeHumidity || 50,
|
|
64
61
|
};
|
|
65
62
|
}
|
|
66
63
|
|
|
67
64
|
// Initialize Battery property
|
|
68
65
|
this.Battery = {
|
|
69
|
-
Service:
|
|
66
|
+
Service: accessory.getService(this.hap.Service.Battery)!,
|
|
70
67
|
BatteryLevel: accessory.context.BatteryLevel || 100,
|
|
71
68
|
StatusLowBattery: accessory.context.StatusLowBattery || this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
|
|
72
69
|
};
|
|
73
70
|
|
|
71
|
+
// Retrieve initial values and updateHomekit
|
|
72
|
+
this.refreshStatus();
|
|
73
|
+
|
|
74
74
|
// Temperature Sensor Service
|
|
75
75
|
if (device.meter?.hide_temperature) {
|
|
76
76
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Temperature Sensor Service`);
|
|
@@ -294,7 +294,7 @@ export class MeterPlus extends deviceBase {
|
|
|
294
294
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
295
295
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
296
296
|
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
297
|
-
this.
|
|
297
|
+
this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
298
298
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
299
299
|
this.openAPIparseStatus(deviceStatus);
|
|
300
300
|
this.updateHomeKitCharacteristics();
|
package/src/device/motion.ts
CHANGED
|
@@ -46,15 +46,15 @@ export class Motion extends deviceBase {
|
|
|
46
46
|
this.doMotionUpdate = new Subject();
|
|
47
47
|
this.motionUbpdateInProgress = false;
|
|
48
48
|
|
|
49
|
+
// Initialize Motion Sensor property
|
|
50
|
+
this.MotionSensor = {
|
|
51
|
+
Service: accessory.getService(this.hap.Service.MotionSensor)!,
|
|
52
|
+
MotionDetected:accessory.context.MotionDetected || false,
|
|
53
|
+
};
|
|
54
|
+
|
|
49
55
|
// Retrieve initial values and updateHomekit
|
|
50
56
|
this.refreshStatus();
|
|
51
57
|
|
|
52
|
-
if (this.MotionSensor.MotionDetected === undefined) {
|
|
53
|
-
this.MotionSensor.MotionDetected = false;
|
|
54
|
-
} else {
|
|
55
|
-
this.MotionSensor.MotionDetected = this.accessory.context.MotionDetected;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
58
|
// get the Battery service if it exists, otherwise create a new Motion service
|
|
59
59
|
// you can create multiple services for each accessory
|
|
60
60
|
const MotionSensorService = `${accessory.displayName} Motion Sensor`;
|
|
@@ -269,7 +269,7 @@ export class Motion extends deviceBase {
|
|
|
269
269
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
270
270
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
271
271
|
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
272
|
-
this.
|
|
272
|
+
this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
273
273
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
274
274
|
this.openAPIparseStatus(deviceStatus);
|
|
275
275
|
this.updateHomeKitCharacteristics();
|
package/src/device/plug.ts
CHANGED
|
@@ -29,15 +29,15 @@ export class Plug extends deviceBase {
|
|
|
29
29
|
this.doPlugUpdate = new Subject();
|
|
30
30
|
this.plugUpdateInProgress = false;
|
|
31
31
|
|
|
32
|
-
// Retrieve initial values and updateHomekit
|
|
33
|
-
this.refreshStatus();
|
|
34
|
-
|
|
35
32
|
// Initialize Outlet property
|
|
36
33
|
this.Outlet = {
|
|
37
|
-
Service:
|
|
34
|
+
Service: accessory.getService(this.hap.Service.Outlet)!,
|
|
38
35
|
On: accessory.context.On || false,
|
|
39
36
|
};
|
|
40
37
|
|
|
38
|
+
// Retrieve initial values and updateHomekit
|
|
39
|
+
this.refreshStatus();
|
|
40
|
+
|
|
41
41
|
// get the Outlet service if it exists, otherwise create a new Outlet service
|
|
42
42
|
// you can create multiple services for each accessory
|
|
43
43
|
const OutletService = `${accessory.displayName} ${device.deviceType}`;
|
|
@@ -199,7 +199,7 @@ export class Plug extends deviceBase {
|
|
|
199
199
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
200
200
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
201
201
|
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
202
|
-
this.
|
|
202
|
+
this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
203
203
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
204
204
|
this.openAPIparseStatus(deviceStatus);
|
|
205
205
|
this.updateHomeKitCharacteristics();
|
|
@@ -38,23 +38,23 @@ export class RobotVacuumCleaner extends deviceBase {
|
|
|
38
38
|
this.doRobotVacuumCleanerUpdate = new Subject();
|
|
39
39
|
this.robotVacuumCleanerUpdateInProgress = false;
|
|
40
40
|
|
|
41
|
-
// Retrieve initial values and updateHomekit
|
|
42
|
-
this.refreshStatus();
|
|
43
|
-
|
|
44
41
|
// Initialize Lightbulb property
|
|
45
42
|
this.LightBulb = {
|
|
46
|
-
Service:
|
|
43
|
+
Service: accessory.getService(this.hap.Service.Lightbulb)!,
|
|
47
44
|
On: accessory.context.On || false,
|
|
48
45
|
Brightness: accessory.context.Brightness || 0,
|
|
49
46
|
};
|
|
50
47
|
|
|
51
48
|
// Initialize Battery property
|
|
52
49
|
this.Battery = {
|
|
53
|
-
Service:
|
|
50
|
+
Service: accessory.getService(this.hap.Service.Battery)!,
|
|
54
51
|
BatteryLevel: accessory.context.BatteryLevel || 100,
|
|
55
52
|
StatusLowBattery: accessory.context.StatusLowBattery || this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
|
|
56
53
|
};
|
|
57
54
|
|
|
55
|
+
// Retrieve initial values and updateHomekit
|
|
56
|
+
this.refreshStatus();
|
|
57
|
+
|
|
58
58
|
// get the Lightbulb service if it exists, otherwise create a new Lightbulb service
|
|
59
59
|
// you can create multiple services for each accessory
|
|
60
60
|
const LightBulbService = `${accessory.displayName} ${device.deviceType}`;
|
|
@@ -317,7 +317,7 @@ export class RobotVacuumCleaner extends deviceBase {
|
|
|
317
317
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
318
318
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
319
319
|
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
320
|
-
this.
|
|
320
|
+
this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
321
321
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
322
322
|
this.openAPIparseStatus(deviceStatus);
|
|
323
323
|
this.updateHomeKitCharacteristics();
|
|
@@ -471,7 +471,7 @@ export class RobotVacuumCleaner extends deviceBase {
|
|
|
471
471
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
472
472
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
473
473
|
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
474
|
-
this.
|
|
474
|
+
this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
475
475
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
476
476
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
477
477
|
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
@@ -46,33 +46,25 @@ export class WaterDetector extends deviceBase {
|
|
|
46
46
|
this.doWaterDetectorUpdate = new Subject();
|
|
47
47
|
this.WaterDetectorUpdateInProgress = false;
|
|
48
48
|
|
|
49
|
-
// Retrieve initial values and updateHomekit
|
|
50
|
-
this.refreshStatus();
|
|
51
|
-
|
|
52
49
|
// Initialize Battery property
|
|
53
50
|
this.Battery = {
|
|
54
|
-
Service:
|
|
55
|
-
BatteryLevel:
|
|
56
|
-
StatusLowBattery:
|
|
57
|
-
ChargingState:
|
|
51
|
+
Service: accessory.getService(this.hap.Service.Battery)!,
|
|
52
|
+
BatteryLevel: accessory.context.BatteryLevel || 100,
|
|
53
|
+
StatusLowBattery: accessory.context.StatusLowBattery || this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
|
|
54
|
+
ChargingState: accessory.context.ChargingState || this.hap.Characteristic.ChargingState.NOT_CHARGEABLE,
|
|
58
55
|
};
|
|
59
56
|
|
|
60
57
|
// Initialize Leak Sensor property
|
|
61
58
|
if (!this.device.waterdetector?.hide_leak) {
|
|
62
59
|
this.LeakSensor = {
|
|
63
|
-
Service:
|
|
64
|
-
StatusActive:
|
|
65
|
-
LeakDetected:
|
|
60
|
+
Service: accessory.getService(this.hap.Service.LeakSensor)!,
|
|
61
|
+
StatusActive: accessory.context.StatusActive || false,
|
|
62
|
+
LeakDetected: accessory.context.LeakDetected || this.hap.Characteristic.LeakDetected.LEAK_NOT_DETECTED,
|
|
66
63
|
};
|
|
67
64
|
}
|
|
68
65
|
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
.getService(this.hap.Service.AccessoryInformation)!
|
|
72
|
-
.setCharacteristic(this.hap.Characteristic.Manufacturer, 'SwitchBot')
|
|
73
|
-
.setCharacteristic(this.hap.Characteristic.Model, 'WoWaterDetector')
|
|
74
|
-
.setCharacteristic(this.hap.Characteristic.SerialNumber, device.deviceId)
|
|
75
|
-
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
66
|
+
// Retrieve initial values and updateHomekit
|
|
67
|
+
this.refreshStatus();
|
|
76
68
|
|
|
77
69
|
// Leak Sensor Service
|
|
78
70
|
if (device.waterdetector?.hide_leak) {
|
|
@@ -238,7 +230,7 @@ export class WaterDetector extends deviceBase {
|
|
|
238
230
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
239
231
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
240
232
|
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
241
|
-
this.
|
|
233
|
+
this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
242
234
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
243
235
|
this.openAPIparseStatus(deviceStatus);
|
|
244
236
|
this.updateHomeKitCharacteristics();
|