@switchbot/homebridge-switchbot 3.5.0-beta.43 → 3.5.0-beta.45
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.js +1 -1
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.js +1 -1
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.js +1 -1
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js +1 -1
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.js +1 -1
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.js +1 -1
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +12 -7
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.js +1 -1
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.js +1 -1
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +13 -14
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.js +1 -1
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.js +1 -1
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.js +1 -1
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.js +1 -1
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.js +1 -1
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.js +1 -1
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.js +1 -1
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.js +1 -1
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.js +1 -1
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/platform.js +54 -54
- package/dist/platform.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +1 -1
- package/src/device/bot.ts +1 -1
- package/src/device/ceilinglight.ts +1 -1
- package/src/device/colorbulb.ts +1 -1
- package/src/device/contact.ts +1 -1
- package/src/device/curtain.ts +1 -1
- package/src/device/device.ts +12 -7
- package/src/device/fan.ts +1 -1
- package/src/device/hub.ts +1 -1
- package/src/device/humidifier.ts +11 -12
- package/src/device/iosensor.ts +1 -1
- package/src/device/lightstrip.ts +1 -1
- package/src/device/lock.ts +1 -1
- package/src/device/meter.ts +1 -1
- package/src/device/meterplus.ts +1 -1
- package/src/device/motion.ts +1 -1
- package/src/device/plug.ts +1 -1
- package/src/device/robotvacuumcleaner.ts +1 -1
- package/src/device/waterdetector.ts +1 -1
- package/src/platform.ts +54 -54
package/src/device/device.ts
CHANGED
|
@@ -73,8 +73,8 @@ export abstract class deviceBase {
|
|
|
73
73
|
.setCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.context.name)
|
|
74
74
|
.setCharacteristic(this.hap.Characteristic.Model, accessory.context.model)
|
|
75
75
|
.setCharacteristic(this.hap.Characteristic.SerialNumber, accessory.context.deviceId)
|
|
76
|
-
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, device.version || accessory.context.version)
|
|
77
|
-
.setCharacteristic(this.hap.Characteristic.HardwareRevision, device.version || accessory.context.version);
|
|
76
|
+
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, device.version?.toString() || accessory.context.version)
|
|
77
|
+
.setCharacteristic(this.hap.Characteristic.HardwareRevision, device.version?.toString() || accessory.context.version);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
async getDeviceLogSettings(device: device & devicesConfig): Promise<void> {
|
|
@@ -553,15 +553,20 @@ export abstract class deviceBase {
|
|
|
553
553
|
device.version = this.platform.version;
|
|
554
554
|
accessory.context.version = this.platform.version;
|
|
555
555
|
} else {
|
|
556
|
-
accessory.context.version = device.version;
|
|
556
|
+
accessory.context.version = device.version?.toString;
|
|
557
557
|
}
|
|
558
|
+
this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} Context: ${JSON.stringify(accessory.context)}`);
|
|
558
559
|
}
|
|
559
560
|
|
|
560
561
|
async statusCode(statusCode: number): Promise<void> {
|
|
561
|
-
switch (
|
|
562
|
-
case
|
|
563
|
-
|
|
564
|
-
|
|
562
|
+
switch (statusCode) {
|
|
563
|
+
case 171:
|
|
564
|
+
switch (this.device.deviceId) {
|
|
565
|
+
case this.device.hubDeviceId:
|
|
566
|
+
case '000000000000':
|
|
567
|
+
statusCode = 161;
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
565
570
|
break;
|
|
566
571
|
}
|
|
567
572
|
switch (statusCode) {
|
package/src/device/fan.ts
CHANGED
|
@@ -206,7 +206,7 @@ export class Fan extends deviceBase {
|
|
|
206
206
|
// Firmware Version
|
|
207
207
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
|
|
208
208
|
if (deviceStatus.body.version) {
|
|
209
|
-
this.accessory.context.version = deviceStatus.body.version;
|
|
209
|
+
this.accessory.context.version = deviceStatus.body.version.toString();
|
|
210
210
|
this.accessory
|
|
211
211
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
212
212
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
|
package/src/device/hub.ts
CHANGED
|
@@ -219,7 +219,7 @@ export class Hub extends deviceBase {
|
|
|
219
219
|
// Firmware Version
|
|
220
220
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
|
|
221
221
|
if (deviceStatus.body.version) {
|
|
222
|
-
this.accessory.context.version = deviceStatus.body.version;
|
|
222
|
+
this.accessory.context.version = deviceStatus.body.version.toString();
|
|
223
223
|
this.accessory
|
|
224
224
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
225
225
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
|
package/src/device/humidifier.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { SwitchBotPlatform } from '../platform.js';
|
|
|
5
5
|
import { debounceTime, skipWhile, take, tap } from 'rxjs/operators';
|
|
6
6
|
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
7
7
|
import { device, devicesConfig, serviceData, deviceStatus, Devices } from '../settings.js';
|
|
8
|
+
import { convertUnits } from '../utils.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Platform Accessory
|
|
@@ -148,20 +149,18 @@ export class Humidifier extends deviceBase {
|
|
|
148
149
|
this.platform.webhookEventHandler[this.device.deviceId] = async (context) => {
|
|
149
150
|
try {
|
|
150
151
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} received Webhook: ${JSON.stringify(context)}`);
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ` +
|
|
152
|
+
const { temperature, humidity } = context;
|
|
153
|
+
const { CurrentRelativeHumidity } = this.HumidifierDehumidifier;
|
|
154
|
+
const { CurrentTemperature } = this.TemperatureSensor || { CurrentTemperature: undefined };
|
|
155
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ` +
|
|
156
156
|
'(temperature, humidity) = ' +
|
|
157
|
-
`Webhook:(${temperature}, ${humidity}), ` +
|
|
157
|
+
`Webhook:(${convertUnits(temperature, context.scale, device.iosensor?.convertUnitTo)}, ${humidity}), ` +
|
|
158
158
|
`current:(${CurrentTemperature}, ${CurrentRelativeHumidity})`);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
this.TemperatureSensor!.CurrentTemperature = temperature;
|
|
162
|
-
}
|
|
163
|
-
this.updateHomeKitCharacteristics();
|
|
159
|
+
this.HumidifierDehumidifier.CurrentRelativeHumidity = humidity;
|
|
160
|
+
if (!this.device.humidifier?.hide_temperature) {
|
|
161
|
+
this.TemperatureSensor!.CurrentTemperature = convertUnits(temperature, context.scale, device.iosensor?.convertUnitTo);
|
|
164
162
|
}
|
|
163
|
+
this.updateHomeKitCharacteristics();
|
|
165
164
|
} catch (e: any) {
|
|
166
165
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
167
166
|
+ `failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e}`);
|
|
@@ -271,7 +270,7 @@ export class Humidifier extends deviceBase {
|
|
|
271
270
|
// Firmware Version
|
|
272
271
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
|
|
273
272
|
if (deviceStatus.body.version) {
|
|
274
|
-
this.accessory.context.version = deviceStatus.body.version;
|
|
273
|
+
this.accessory.context.version = deviceStatus.body.version.toString();
|
|
275
274
|
this.accessory
|
|
276
275
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
277
276
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
|
package/src/device/iosensor.ts
CHANGED
|
@@ -230,7 +230,7 @@ export class IOSensor extends deviceBase {
|
|
|
230
230
|
// Firmware Version
|
|
231
231
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
|
|
232
232
|
if (deviceStatus.body.version) {
|
|
233
|
-
this.accessory.context.version = deviceStatus.body.version;
|
|
233
|
+
this.accessory.context.version = deviceStatus.body.version.toString();
|
|
234
234
|
this.accessory
|
|
235
235
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
236
236
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
|
package/src/device/lightstrip.ts
CHANGED
|
@@ -328,7 +328,7 @@ export class StripLight extends deviceBase {
|
|
|
328
328
|
// Firmware Version
|
|
329
329
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
|
|
330
330
|
if (deviceStatus.body.version) {
|
|
331
|
-
this.accessory.context.version = deviceStatus.body.version;
|
|
331
|
+
this.accessory.context.version = deviceStatus.body.version.toString();
|
|
332
332
|
this.accessory
|
|
333
333
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
334
334
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
|
package/src/device/lock.ts
CHANGED
|
@@ -258,7 +258,7 @@ export class Lock extends deviceBase {
|
|
|
258
258
|
// Firmware Version
|
|
259
259
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
|
|
260
260
|
if (deviceStatus.body.version) {
|
|
261
|
-
this.accessory.context.version = deviceStatus.body.version;
|
|
261
|
+
this.accessory.context.version = deviceStatus.body.version.toString();
|
|
262
262
|
this.accessory
|
|
263
263
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
264
264
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
|
package/src/device/meter.ts
CHANGED
|
@@ -226,7 +226,7 @@ export class Meter extends deviceBase {
|
|
|
226
226
|
// Firmware Version
|
|
227
227
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
|
|
228
228
|
if (deviceStatus.body.version) {
|
|
229
|
-
this.accessory.context.version = deviceStatus.body.version;
|
|
229
|
+
this.accessory.context.version = deviceStatus.body.version.toString();
|
|
230
230
|
this.accessory
|
|
231
231
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
232
232
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
|
package/src/device/meterplus.ts
CHANGED
|
@@ -227,7 +227,7 @@ export class MeterPlus extends deviceBase {
|
|
|
227
227
|
// Firmware Version
|
|
228
228
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
|
|
229
229
|
if (deviceStatus.body.version) {
|
|
230
|
-
this.accessory.context.version = deviceStatus.body.version;
|
|
230
|
+
this.accessory.context.version = deviceStatus.body.version.toString();
|
|
231
231
|
this.accessory
|
|
232
232
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
233
233
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
|
package/src/device/motion.ts
CHANGED
|
@@ -202,7 +202,7 @@ export class Motion extends deviceBase {
|
|
|
202
202
|
// Firmware Version
|
|
203
203
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
|
|
204
204
|
if (deviceStatus.body.version) {
|
|
205
|
-
this.accessory.context.version = deviceStatus.body.version;
|
|
205
|
+
this.accessory.context.version = deviceStatus.body.version.toString();
|
|
206
206
|
this.accessory
|
|
207
207
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
208
208
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
|
package/src/device/plug.ts
CHANGED
|
@@ -132,7 +132,7 @@ export class Plug extends deviceBase {
|
|
|
132
132
|
// Firmware Version
|
|
133
133
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
|
|
134
134
|
if (deviceStatus.body.version) {
|
|
135
|
-
this.accessory.context.version = deviceStatus.body.version;
|
|
135
|
+
this.accessory.context.version = deviceStatus.body.version.toString();
|
|
136
136
|
this.accessory
|
|
137
137
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
138
138
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
|
|
@@ -201,7 +201,7 @@ export class RobotVacuumCleaner extends deviceBase {
|
|
|
201
201
|
// Firmware Version
|
|
202
202
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
|
|
203
203
|
if (deviceStatus.body.version) {
|
|
204
|
-
this.accessory.context.version = deviceStatus.body.version;
|
|
204
|
+
this.accessory.context.version = deviceStatus.body.version.toString();
|
|
205
205
|
this.accessory
|
|
206
206
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
207
207
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
|
|
@@ -168,7 +168,7 @@ export class WaterDetector extends deviceBase {
|
|
|
168
168
|
// Firmware Version
|
|
169
169
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
|
|
170
170
|
if (deviceStatus.body.version) {
|
|
171
|
-
this.accessory.context.version = deviceStatus.body.version;
|
|
171
|
+
this.accessory.context.version = deviceStatus.body.version.toString();
|
|
172
172
|
this.accessory
|
|
173
173
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
174
174
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
|