@switchbot/homebridge-switchbot 4.3.3 → 4.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +426 -0
- package/README.md +10 -0
- package/config.schema.json +480 -2
- package/dist/device/blindtilt.d.ts +1 -1
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +1 -1
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +12 -0
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts +1 -1
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +4 -4
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +4 -4
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/meterpro.d.ts +1 -1
- package/dist/device/meterpro.d.ts.map +1 -1
- package/dist/device/meterpro.js.map +1 -1
- package/dist/device/motion.d.ts +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js.map +1 -1
- package/dist/device/presence.d.ts +1 -1
- package/dist/device/presence.d.ts.map +1 -1
- package/dist/device/presence.js.map +1 -1
- package/dist/device/relayswitch.d.ts +1 -1
- package/dist/device/relayswitch.d.ts.map +1 -1
- package/dist/device/relayswitch.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +4 -2
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +1 -1
- package/dist/settings.d.ts.map +1 -1
- package/docs/assets/highlight.css +14 -0
- package/docs/assets/icons.js +1 -1
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +2 -2
- package/docs/assets/style.css +3 -3
- package/docs/index.html +41 -13
- package/docs/variables/default.html +1 -1
- package/eslint.config.js +1 -5
- package/package.json +15 -21
- package/src/device/blindtilt.ts +2 -4
- package/src/device/bot.ts +2 -4
- package/src/device/ceilinglight.ts +2 -4
- package/src/device/colorbulb.ts +2 -4
- package/src/device/contact.ts +2 -4
- package/src/device/curtain.ts +6 -8
- package/src/device/device.ts +19 -9
- package/src/device/fan.ts +2 -4
- package/src/device/hub.ts +3 -5
- package/src/device/humidifier.ts +2 -4
- package/src/device/iosensor.ts +3 -5
- package/src/device/lightstrip.ts +2 -4
- package/src/device/lock.ts +12 -14
- package/src/device/meter.ts +3 -5
- package/src/device/meterplus.ts +3 -5
- package/src/device/meterpro.ts +3 -5
- package/src/device/motion.ts +2 -4
- package/src/device/plug.ts +2 -4
- package/src/device/presence.ts +2 -4
- package/src/device/relayswitch.ts +2 -4
- package/src/device/robotvacuumcleaner.ts +2 -4
- package/src/device/waterdetector.ts +2 -4
- package/src/irdevice/airconditioner.ts +0 -1
- package/src/irdevice/airpurifier.ts +0 -1
- package/src/irdevice/camera.ts +0 -1
- package/src/irdevice/fan.ts +0 -1
- package/src/irdevice/light.ts +0 -1
- package/src/irdevice/other.ts +0 -1
- package/src/irdevice/tv.ts +0 -1
- package/src/irdevice/vacuumcleaner.ts +0 -1
- package/src/irdevice/waterheater.ts +0 -1
- package/src/platform.ts +4 -2
- package/src/settings.ts +1 -1
package/src/device/lock.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { bodyChange, device, lockProServiceData, lockProStatus, lockProWebhookContext, lockServiceData, lockStatus, lockWebhookContext, SwitchBotBLE, SwitchbotDevice, WoSmartLock } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig, lockConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { devicesConfig, lockConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { devicesConfig, lockConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
|
@@ -47,13 +45,13 @@ export class Lock extends deviceBase {
|
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
// OpenAPI
|
|
50
|
-
deviceStatus!: lockStatus | lockProStatus
|
|
48
|
+
deviceStatus!: lockStatus | lockProStatus | any
|
|
51
49
|
|
|
52
50
|
// Webhook
|
|
53
|
-
webhookContext!: lockWebhookContext | lockProWebhookContext
|
|
51
|
+
webhookContext!: lockWebhookContext | lockProWebhookContext | any
|
|
54
52
|
|
|
55
53
|
// BLE
|
|
56
|
-
serviceData!: lockServiceData | lockProServiceData
|
|
54
|
+
serviceData!: lockServiceData | lockProServiceData | any
|
|
57
55
|
|
|
58
56
|
// Updates
|
|
59
57
|
lockUpdateInProgress!: boolean
|
|
@@ -230,7 +228,7 @@ export class Lock extends deviceBase {
|
|
|
230
228
|
this.Battery.BatteryLevel = this.serviceData.battery
|
|
231
229
|
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
|
|
232
230
|
// StatusLowBattery
|
|
233
|
-
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
|
|
231
|
+
this.Battery.StatusLowBattery = Number(this.Battery.BatteryLevel) < 10
|
|
234
232
|
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
|
|
235
233
|
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
|
|
236
234
|
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
|
|
@@ -266,7 +264,7 @@ export class Lock extends deviceBase {
|
|
|
266
264
|
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
|
|
267
265
|
|
|
268
266
|
// StatusLowBattery
|
|
269
|
-
this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
|
|
267
|
+
this.Battery.StatusLowBattery = Number(this.Battery.BatteryLevel) < 10
|
|
270
268
|
? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
|
|
271
269
|
: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
|
|
272
270
|
this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
|
|
@@ -329,10 +327,10 @@ export class Lock extends deviceBase {
|
|
|
329
327
|
// Start to monitor advertisement packets
|
|
330
328
|
(async () => {
|
|
331
329
|
// Start to monitor advertisement packets
|
|
332
|
-
const serviceData = await this.monitorAdvertisementPackets(switchBotBLE) as
|
|
330
|
+
const serviceData = await this.monitorAdvertisementPackets(switchBotBLE) as any
|
|
333
331
|
// Update HomeKit
|
|
334
|
-
if ((serviceData.model === SwitchBotBLEModel.Lock || SwitchBotBLEModel.LockPro)
|
|
335
|
-
&& (serviceData.modelName === SwitchBotBLEModelName.Lock || SwitchBotBLEModelName.LockPro)) {
|
|
332
|
+
if ((serviceData.model === SwitchBotBLEModel.Lock || serviceData.model === SwitchBotBLEModel.LockPro || serviceData.model === SwitchBotBLEModel.LockUltra)
|
|
333
|
+
&& (serviceData.modelName === SwitchBotBLEModelName.Lock || serviceData.modelName === SwitchBotBLEModelName.LockPro || serviceData.modelName === SwitchBotBLEModelName.LockUltra)) {
|
|
336
334
|
this.serviceData = serviceData
|
|
337
335
|
if (serviceData !== undefined || serviceData !== null) {
|
|
338
336
|
await this.BLEparseStatus()
|
|
@@ -357,7 +355,7 @@ export class Lock extends deviceBase {
|
|
|
357
355
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
|
358
356
|
this.device.bleMac = formattedDeviceId
|
|
359
357
|
this.debugLog(`bleMac: ${this.device.bleMac}`)
|
|
360
|
-
this.platform.bleEventHandler[this.device.bleMac] = async (context: lockServiceData | lockProServiceData) => {
|
|
358
|
+
this.platform.bleEventHandler[this.device.bleMac] = async (context: lockServiceData | lockProServiceData | any) => {
|
|
361
359
|
try {
|
|
362
360
|
this.serviceData = context
|
|
363
361
|
if (context !== undefined || context !== null) {
|
|
@@ -403,7 +401,7 @@ export class Lock extends deviceBase {
|
|
|
403
401
|
async registerWebhook() {
|
|
404
402
|
if (this.device.webhook) {
|
|
405
403
|
this.debugLog('is listening webhook.')
|
|
406
|
-
this.platform.webhookEventHandler[this.device.deviceId] = async (context: lockWebhookContext | lockProWebhookContext) => {
|
|
404
|
+
this.platform.webhookEventHandler[this.device.deviceId] = async (context: lockWebhookContext | lockProWebhookContext | any) => {
|
|
407
405
|
try {
|
|
408
406
|
this.webhookContext = context
|
|
409
407
|
if (context !== undefined || context !== null) {
|
package/src/device/meter.ts
CHANGED
|
@@ -3,12 +3,8 @@
|
|
|
3
3
|
* meter.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
-
import type { device, meterServiceData, meterStatus, meterWebhookContext, SwitchBotBLE } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig, meterConfig } from '../settings.js'
|
|
10
|
-
|
|
11
6
|
import { Units } from 'homebridge'
|
|
7
|
+
import type { device, meterServiceData, meterStatus, meterWebhookContext, SwitchBotBLE } from 'node-switchbot'
|
|
12
8
|
/*
|
|
13
9
|
* For Testing Locally:
|
|
14
10
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -16,6 +12,8 @@ import { Units } from 'homebridge'
|
|
|
16
12
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
17
13
|
import { interval, skipWhile, Subject } from 'rxjs'
|
|
18
14
|
|
|
15
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
16
|
+
import type { devicesConfig, meterConfig } from '../settings.js'
|
|
19
17
|
import { convertUnits, formatDeviceIdAsMac, validHumidity } from '../utils.js'
|
|
20
18
|
import { deviceBase } from './device.js'
|
|
21
19
|
|
package/src/device/meterplus.ts
CHANGED
|
@@ -3,12 +3,8 @@
|
|
|
3
3
|
* meterplus.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
-
import type { device, meterPlusServiceData, meterPlusStatus, meterPlusWebhookContext, SwitchBotBLE } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig, meterConfig } from '../settings.js'
|
|
10
|
-
|
|
11
6
|
import { Units } from 'homebridge'
|
|
7
|
+
import type { device, meterPlusServiceData, meterPlusStatus, meterPlusWebhookContext, SwitchBotBLE } from 'node-switchbot'
|
|
12
8
|
/*
|
|
13
9
|
* For Testing Locally:
|
|
14
10
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -16,6 +12,8 @@ import { Units } from 'homebridge'
|
|
|
16
12
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
17
13
|
import { interval, skipWhile, Subject } from 'rxjs'
|
|
18
14
|
|
|
15
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
16
|
+
import type { devicesConfig, meterConfig } from '../settings.js'
|
|
19
17
|
import { convertUnits, formatDeviceIdAsMac, validHumidity } from '../utils.js'
|
|
20
18
|
import { deviceBase } from './device.js'
|
|
21
19
|
|
package/src/device/meterpro.ts
CHANGED
|
@@ -3,12 +3,8 @@
|
|
|
3
3
|
* MeterPro.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
-
import type { device, meterProCO2ServiceData, meterProCO2Status, meterProCO2WebhookContext, meterProServiceData, meterProStatus, meterProWebhookContext, SwitchBotBLE } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig, meterProConfig } from '../settings.js'
|
|
10
|
-
|
|
11
6
|
import { Units } from 'homebridge'
|
|
7
|
+
import type { device, meterProCO2ServiceData, meterProCO2Status, meterProCO2WebhookContext, meterProServiceData, meterProStatus, meterProWebhookContext, SwitchBotBLE } from 'node-switchbot'
|
|
12
8
|
/*
|
|
13
9
|
* For Testing Locally:
|
|
14
10
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -16,6 +12,8 @@ import { Units } from 'homebridge'
|
|
|
16
12
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
17
13
|
import { interval, skipWhile, Subject } from 'rxjs'
|
|
18
14
|
|
|
15
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
16
|
+
import type { devicesConfig, meterProConfig } from '../settings.js'
|
|
19
17
|
import { convertUnits, formatDeviceIdAsMac, validHumidity } from '../utils.js'
|
|
20
18
|
import { deviceBase } from './device.js'
|
|
21
19
|
|
package/src/device/motion.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { device, motionSensorServiceData, motionSensorStatus, motionSensorWebhookContext, SwitchBotBLE } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig, motionConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { devicesConfig, motionConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { interval, skipWhile, Subject } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { devicesConfig, motionConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
package/src/device/plug.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { bodyChange, device, plugMiniJPServiceData, plugMiniJPWebhookContext, plugMiniStatus, plugMiniUSServiceData, plugMiniUSWebhookContext, plugStatus, plugWebhookContext, SwitchBotBLE, SwitchbotDevice, WoPlugMiniUS } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { devicesConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { devicesConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
package/src/device/presence.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { device, presenceSensorServiceData, presenceSensorStatus, presenceSensorWebhookContext, SwitchBotBLE } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig, presenceConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { devicesConfig, presenceConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { interval, skipWhile, Subject } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { devicesConfig, presenceConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { bodyChange, device, relaySwitch1Context, relaySwitch1PMContext, relaySwitch1PMServiceData, relaySwitch1PMStatus, relaySwitch1ServiceData, relaySwitch1Status, SwitchBotBLE, SwitchbotDevice, WoRelaySwitch1, WoRelaySwitch1PM } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig, relaySwitch1Config, relaySwitch1PMConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { devicesConfig, relaySwitch1Config, relaySwitch1PMConfig } from '..
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { devicesConfig, relaySwitch1Config, relaySwitch1PMConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { bodyChange, device, floorCleaningRobotS10Status, floorCleaningRobotS10WebhookContext, robotVacuumCleanerS1PlusStatus, robotVacuumCleanerS1PlusWebhookContext, robotVacuumCleanerS1Status, robotVacuumCleanerS1WebhookContext, robotVacuumCleanerServiceData, SwitchBotBLE, SwitchbotDevice } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { devicesConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { devicesConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { device, SwitchBotBLE, waterLeakDetectorServiceData, waterLeakDetectorStatus, waterLeakDetectorWebhookContext } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig, waterDetectorConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { devicesConfig, waterDetectorConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { interval, skipWhile, Subject } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { devicesConfig, waterDetectorConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
package/src/irdevice/camera.ts
CHANGED
package/src/irdevice/fan.ts
CHANGED
package/src/irdevice/light.ts
CHANGED
package/src/irdevice/other.ts
CHANGED
package/src/irdevice/tv.ts
CHANGED
package/src/platform.ts
CHANGED
|
@@ -607,6 +607,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
607
607
|
'Plug Mini (JP)': this.createPlug.bind(this),
|
|
608
608
|
'Smart Lock': this.createLock.bind(this),
|
|
609
609
|
'Smart Lock Pro': this.createLock.bind(this),
|
|
610
|
+
'Smart Lock Ultra': this.createLock.bind(this),
|
|
611
|
+
'Lock Ultra': this.createLock.bind(this),
|
|
610
612
|
'Color Bulb': this.createColorBulb.bind(this),
|
|
611
613
|
'K10+': this.createRobotVacuumCleaner.bind(this),
|
|
612
614
|
'K10+ Pro': this.createRobotVacuumCleaner.bind(this),
|
|
@@ -1660,7 +1662,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1660
1662
|
existingAccessory.context.device = device
|
|
1661
1663
|
existingAccessory.context.deviceId = device.deviceId
|
|
1662
1664
|
existingAccessory.context.deviceType = device.deviceType
|
|
1663
|
-
existingAccessory.context.model = device.deviceType === 'Smart Lock Pro' ? SwitchBotModel.LockPro : SwitchBotModel.Lock
|
|
1665
|
+
existingAccessory.context.model = device.deviceType === 'Smart Lock Pro' ? SwitchBotModel.LockPro : (device.deviceType === 'Smart Lock Ultra' || device.deviceType === 'Lock Ultra') ? SwitchBotModel.LockUltra : SwitchBotModel.Lock
|
|
1664
1666
|
existingAccessory.displayName = device.configDeviceName
|
|
1665
1667
|
? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
|
|
1666
1668
|
: await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
|
|
@@ -1686,7 +1688,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1686
1688
|
accessory.context.device = device
|
|
1687
1689
|
accessory.context.deviceId = device.deviceId
|
|
1688
1690
|
accessory.context.deviceType = device.deviceType
|
|
1689
|
-
accessory.context.model = device.deviceType === 'Smart Lock Pro' ? SwitchBotModel.LockPro : SwitchBotModel.Lock
|
|
1691
|
+
accessory.context.model = device.deviceType === 'Smart Lock Pro' ? SwitchBotModel.LockPro : (device.deviceType === 'Smart Lock Ultra' || device.deviceType === 'Lock Ultra') ? SwitchBotModel.LockUltra : SwitchBotModel.Lock
|
|
1690
1692
|
accessory.displayName = device.configDeviceName
|
|
1691
1693
|
? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
|
|
1692
1694
|
: await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
|
package/src/settings.ts
CHANGED
|
@@ -218,7 +218,7 @@ export interface ceilingLightConfig extends BaseDeviceConfig {
|
|
|
218
218
|
};
|
|
219
219
|
|
|
220
220
|
export interface lockConfig extends BaseDeviceConfig {
|
|
221
|
-
configDeviceType: 'Smart Lock' | 'Smart Lock Pro'
|
|
221
|
+
configDeviceType: 'Smart Lock' | 'Smart Lock Pro' | 'Smart Lock Ultra' | 'Lock Ultra'
|
|
222
222
|
hide_contactsensor?: boolean
|
|
223
223
|
activate_latchbutton?: boolean
|
|
224
224
|
};
|