@switchbot/homebridge-switchbot 3.8.3-beta.11 → 3.8.3-beta.13
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 +1 -4
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +6 -6
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +1 -4
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +3 -3
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +1 -4
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +8 -8
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +1 -4
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +8 -8
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +1 -4
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +1 -4
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +4 -4
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +3 -3
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +2 -8
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts +1 -4
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +6 -6
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts +1 -4
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +1 -4
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +6 -6
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +1 -4
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +1 -4
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +6 -6
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +1 -4
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +3 -3
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +1 -4
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +1 -4
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +1 -4
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +1 -4
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +2 -2
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +1 -4
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +4 -4
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts +1 -4
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +6 -6
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +6 -6
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +4 -4
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +10 -10
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +2 -2
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js +1 -7
- 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 +4 -4
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +4 -4
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +22 -22
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +4 -4
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +4 -4
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +4 -13
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +20 -132
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +1 -3
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +3 -4
- package/src/device/blindtilt.ts +8 -11
- package/src/device/bot.ts +4 -7
- package/src/device/ceilinglight.ts +9 -12
- package/src/device/colorbulb.ts +9 -12
- package/src/device/contact.ts +1 -4
- package/src/device/curtain.ts +6 -9
- package/src/device/device.ts +4 -11
- package/src/device/fan.ts +7 -10
- package/src/device/hub.ts +1 -4
- package/src/device/humidifier.ts +7 -10
- package/src/device/iosensor.ts +1 -4
- package/src/device/lightstrip.ts +7 -10
- package/src/device/lock.ts +4 -7
- package/src/device/meter.ts +1 -4
- package/src/device/meterplus.ts +1 -4
- package/src/device/motion.ts +1 -4
- package/src/device/plug.ts +3 -6
- package/src/device/robotvacuumcleaner.ts +5 -12
- package/src/device/waterdetector.ts +1 -4
- package/src/irdevice/airconditioner.ts +7 -8
- package/src/irdevice/airpurifier.ts +7 -7
- package/src/irdevice/camera.ts +5 -5
- package/src/irdevice/fan.ts +11 -11
- package/src/irdevice/irdevice.ts +3 -11
- package/src/irdevice/light.ts +5 -5
- package/src/irdevice/other.ts +5 -5
- package/src/irdevice/tv.ts +23 -23
- package/src/irdevice/vacuumcleaner.ts +5 -5
- package/src/irdevice/waterheater.ts +5 -5
- package/src/platform.ts +23 -132
- package/src/settings.ts +1 -4
- package/src/utils.ts +2 -1
- package/dist/types/bledevicestatus.d.ts +0 -281
- package/dist/types/bledevicestatus.d.ts.map +0 -1
- package/dist/types/bledevicestatus.js +0 -2
- package/dist/types/bledevicestatus.js.map +0 -1
- package/dist/types/devicelist.d.ts +0 -89
- package/dist/types/devicelist.d.ts.map +0 -1
- package/dist/types/devicelist.js +0 -6
- package/dist/types/devicelist.js.map +0 -1
- package/dist/types/deviceresponse.d.ts +0 -13
- package/dist/types/deviceresponse.d.ts.map +0 -1
- package/dist/types/deviceresponse.js +0 -2
- package/dist/types/deviceresponse.js.map +0 -1
- package/dist/types/devicestatus.d.ts +0 -149
- package/dist/types/devicestatus.d.ts.map +0 -1
- package/dist/types/devicestatus.js +0 -3
- package/dist/types/devicestatus.js.map +0 -1
- package/dist/types/devicewebhookstatus.d.ts +0 -156
- package/dist/types/devicewebhookstatus.d.ts.map +0 -1
- package/dist/types/devicewebhookstatus.js +0 -2
- package/dist/types/devicewebhookstatus.js.map +0 -1
- package/dist/types/irdevicelist.d.ts +0 -10
- package/dist/types/irdevicelist.d.ts.map +0 -1
- package/dist/types/irdevicelist.js +0 -2
- package/dist/types/irdevicelist.js.map +0 -1
- package/dist/types/pushbody.d.ts +0 -6
- package/dist/types/pushbody.d.ts.map +0 -1
- package/dist/types/pushbody.js +0 -2
- package/dist/types/pushbody.js.map +0 -1
- package/src/types/bledevicestatus.ts +0 -303
- package/src/types/devicelist.ts +0 -124
- package/src/types/deviceresponse.ts +0 -14
- package/src/types/devicestatus.ts +0 -178
- package/src/types/devicewebhookstatus.ts +0 -191
- package/src/types/irdevicelist.ts +0 -15
- package/src/types/pushbody.ts +0 -9
package/src/device/humidifier.ts
CHANGED
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
* humidifier.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { bodyChange, device, humidifierServiceData, humidifierStatus, humidifierWebhookContext } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { devicesConfig } from '../settings.js'
|
|
9
|
-
import type { humidifierServiceData } from '../types/bledevicestatus.js'
|
|
10
|
-
import type { device } from '../types/devicelist.js'
|
|
11
|
-
import type { humidifierStatus } from '../types/devicestatus.js'
|
|
12
|
-
import type { humidifierWebhookContext } from '../types/devicewebhookstatus.js'
|
|
13
10
|
|
|
14
11
|
/*
|
|
15
12
|
* For Testing Locally:
|
|
@@ -470,11 +467,11 @@ export class Humidifier extends deviceBase {
|
|
|
470
467
|
&& (this.HumidifierDehumidifier.Active === this.hap.Characteristic.Active.ACTIVE)
|
|
471
468
|
&& (this.HumidifierDehumidifier.RelativeHumidityHumidifierThreshold !== this.HumidifierDehumidifier.CurrentRelativeHumidity)) {
|
|
472
469
|
await this.debugLog(`Auto Off, RelativeHumidityHumidifierThreshold: ${this.HumidifierDehumidifier.RelativeHumidityHumidifierThreshold}!`)
|
|
473
|
-
const bodyChange =
|
|
470
|
+
const bodyChange: bodyChange = {
|
|
474
471
|
command: 'setMode',
|
|
475
472
|
parameter: `${this.HumidifierDehumidifier.RelativeHumidityHumidifierThreshold}`,
|
|
476
473
|
commandType: 'command',
|
|
477
|
-
}
|
|
474
|
+
}
|
|
478
475
|
await this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
479
476
|
try {
|
|
480
477
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
|
@@ -507,11 +504,11 @@ export class Humidifier extends deviceBase {
|
|
|
507
504
|
=== this.hap.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER_OR_DEHUMIDIFIER)
|
|
508
505
|
&& (this.HumidifierDehumidifier.Active === this.hap.Characteristic.Active.ACTIVE)) {
|
|
509
506
|
await this.debugLog('Pushing Auto')
|
|
510
|
-
const bodyChange =
|
|
507
|
+
const bodyChange: bodyChange = {
|
|
511
508
|
command: 'setMode',
|
|
512
509
|
parameter: 'auto',
|
|
513
510
|
commandType: 'command',
|
|
514
|
-
}
|
|
511
|
+
}
|
|
515
512
|
await this.debugLog(`pushAutoChanges, SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
516
513
|
try {
|
|
517
514
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
|
@@ -540,11 +537,11 @@ export class Humidifier extends deviceBase {
|
|
|
540
537
|
await this.debugLog('pushActiveChanges')
|
|
541
538
|
if (this.HumidifierDehumidifier.Active === this.hap.Characteristic.Active.INACTIVE) {
|
|
542
539
|
await this.debugLog('Pushing Off')
|
|
543
|
-
const bodyChange =
|
|
540
|
+
const bodyChange: bodyChange = {
|
|
544
541
|
command: 'turnOff',
|
|
545
542
|
parameter: 'default',
|
|
546
543
|
commandType: 'command',
|
|
547
|
-
}
|
|
544
|
+
}
|
|
548
545
|
await this.debugLog(`pushActiveChanges, SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
549
546
|
try {
|
|
550
547
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
package/src/device/iosensor.ts
CHANGED
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
* iosensor.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { device, outdoorMeterServiceData, outdoorMeterStatus, outdoorMeterWebhookContext } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { devicesConfig } from '../settings.js'
|
|
9
|
-
import type { outdoorMeterServiceData } from '../types/bledevicestatus.js'
|
|
10
|
-
import type { device } from '../types/devicelist.js'
|
|
11
|
-
import type { outdoorMeterStatus } from '../types/devicestatus.js'
|
|
12
|
-
import type { outdoorMeterWebhookContext } from '../types/devicewebhookstatus.js'
|
|
13
10
|
|
|
14
11
|
import { Units } from 'homebridge'
|
|
15
12
|
/*
|
package/src/device/lightstrip.ts
CHANGED
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
* lightstrip.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, Controller, ControllerConstructor, ControllerServiceMap, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { bodyChange, device, stripLightServiceData, stripLightStatus, stripLightWebhookContext } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { devicesConfig } from '../settings.js'
|
|
9
|
-
import type { stripLightServiceData } from '../types/bledevicestatus.js'
|
|
10
|
-
import type { device } from '../types/devicelist.js'
|
|
11
|
-
import type { stripLightStatus } from '../types/devicestatus.js'
|
|
12
|
-
import type { stripLightWebhookContext } from '../types/devicewebhookstatus.js'
|
|
13
10
|
|
|
14
11
|
/*
|
|
15
12
|
* For Testing Locally:
|
|
@@ -580,11 +577,11 @@ export class StripLight extends deviceBase {
|
|
|
580
577
|
await this.debugLog('openAPIpushChanges')
|
|
581
578
|
if (this.LightBulb.On !== this.accessory.context.On) {
|
|
582
579
|
const command = this.LightBulb.On ? 'turnOn' : 'turnOff'
|
|
583
|
-
const bodyChange =
|
|
580
|
+
const bodyChange: bodyChange = {
|
|
584
581
|
command: `${command}`,
|
|
585
582
|
parameter: 'default',
|
|
586
583
|
commandType: 'command',
|
|
587
|
-
}
|
|
584
|
+
}
|
|
588
585
|
await this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
589
586
|
try {
|
|
590
587
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
|
@@ -612,11 +609,11 @@ export class StripLight extends deviceBase {
|
|
|
612
609
|
await this.debugLog(`Hue: ${JSON.stringify(this.LightBulb.Hue)}, Saturation: ${JSON.stringify(this.LightBulb.Saturation)}`)
|
|
613
610
|
const [red, green, blue] = hs2rgb(this.LightBulb.Hue, this.LightBulb.Saturation)
|
|
614
611
|
await this.debugLog(`rgb: ${JSON.stringify([red, green, blue])}`)
|
|
615
|
-
const bodyChange =
|
|
612
|
+
const bodyChange: bodyChange = {
|
|
616
613
|
command: 'setColor',
|
|
617
614
|
parameter: `${red}:${green}:${blue}`,
|
|
618
615
|
commandType: 'command',
|
|
619
|
-
}
|
|
616
|
+
}
|
|
620
617
|
await this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
621
618
|
try {
|
|
622
619
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
|
@@ -641,11 +638,11 @@ export class StripLight extends deviceBase {
|
|
|
641
638
|
async pushBrightnessChanges(): Promise<void> {
|
|
642
639
|
await this.debugLog('pushBrightnessChanges')
|
|
643
640
|
if (this.LightBulb.Brightness !== this.accessory.context.Brightness) {
|
|
644
|
-
const bodyChange =
|
|
641
|
+
const bodyChange: bodyChange = {
|
|
645
642
|
command: 'setBrightness',
|
|
646
643
|
parameter: `${this.LightBulb.Brightness}`,
|
|
647
644
|
commandType: 'command',
|
|
648
|
-
}
|
|
645
|
+
}
|
|
649
646
|
await this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
650
647
|
try {
|
|
651
648
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
package/src/device/lock.ts
CHANGED
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
* lock.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { bodyChange, device, lockProServiceData, lockProStatus, lockProWebhookContext, lockServiceData, lockStatus, lockWebhookContext } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { devicesConfig } from '../settings.js'
|
|
9
|
-
import type { lockProServiceData, lockServiceData } from '../types/bledevicestatus.js'
|
|
10
|
-
import type { device } from '../types/devicelist.js'
|
|
11
|
-
import type { lockProStatus, lockStatus } from '../types/devicestatus.js'
|
|
12
|
-
import type { lockProWebhookContext, lockWebhookContext } from '../types/devicewebhookstatus.js'
|
|
13
10
|
|
|
14
11
|
/*
|
|
15
12
|
* For Testing Locally:
|
|
@@ -222,7 +219,7 @@ export class Lock extends deviceBase {
|
|
|
222
219
|
|
|
223
220
|
// Contact Sensor
|
|
224
221
|
if (!this.device.lock?.hide_contactsensor && this.ContactSensor?.Service) {
|
|
225
|
-
this.ContactSensor.ContactSensorState = this.serviceData.door_open
|
|
222
|
+
this.ContactSensor.ContactSensorState = this.serviceData.door_open
|
|
226
223
|
? this.hap.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED
|
|
227
224
|
: this.hap.Characteristic.ContactSensorState.CONTACT_DETECTED
|
|
228
225
|
await this.debugLog(`ContactSensorState: ${this.ContactSensor.ContactSensorState}`)
|
|
@@ -486,11 +483,11 @@ export class Lock extends deviceBase {
|
|
|
486
483
|
if ((this.LockMechanism.LockTargetState !== this.accessory.context.LockTargetState) || LatchUnlock) {
|
|
487
484
|
// Determine the command based on the LockTargetState or the forceUnlock parameter
|
|
488
485
|
const command = LatchUnlock ? 'unlock' : this.LockMechanism.LockTargetState ? 'lock' : 'unlock'
|
|
489
|
-
const bodyChange =
|
|
486
|
+
const bodyChange: bodyChange = {
|
|
490
487
|
command: `${command}`,
|
|
491
488
|
parameter: 'default',
|
|
492
489
|
commandType: 'command',
|
|
493
|
-
}
|
|
490
|
+
}
|
|
494
491
|
await this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
495
492
|
try {
|
|
496
493
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
package/src/device/meter.ts
CHANGED
|
@@ -3,13 +3,10 @@
|
|
|
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 } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { devicesConfig } from '../settings.js'
|
|
9
|
-
import type { meterServiceData } from '../types/bledevicestatus.js'
|
|
10
|
-
import type { device } from '../types/devicelist.js'
|
|
11
|
-
import type { meterStatus } from '../types/devicestatus.js'
|
|
12
|
-
import type { meterWebhookContext } from '../types/devicewebhookstatus.js'
|
|
13
10
|
|
|
14
11
|
import { Units } from 'homebridge'
|
|
15
12
|
/*
|
package/src/device/meterplus.ts
CHANGED
|
@@ -3,13 +3,10 @@
|
|
|
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 } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { devicesConfig } from '../settings.js'
|
|
9
|
-
import type { meterPlusServiceData } from '../types/bledevicestatus.js'
|
|
10
|
-
import type { device } from '../types/devicelist.js'
|
|
11
|
-
import type { meterPlusStatus } from '../types/devicestatus.js'
|
|
12
|
-
import type { meterPlusWebhookContext } from '../types/devicewebhookstatus.js'
|
|
13
10
|
|
|
14
11
|
import { Units } from 'homebridge'
|
|
15
12
|
/*
|
package/src/device/motion.ts
CHANGED
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
* motion.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { device, motionSensorServiceData, motionSensorStatus, motionSensorWebhookContext } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { devicesConfig } from '../settings.js'
|
|
9
|
-
import type { motionSensorServiceData } from '../types/bledevicestatus.js'
|
|
10
|
-
import type { device } from '../types/devicelist.js'
|
|
11
|
-
import type { motionSensorStatus } from '../types/devicestatus.js'
|
|
12
|
-
import type { motionSensorWebhookContext } from '../types/devicewebhookstatus.js'
|
|
13
10
|
|
|
14
11
|
/*
|
|
15
12
|
* For Testing Locally:
|
package/src/device/plug.ts
CHANGED
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
* plug.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { bodyChange, device, plugMiniJPServiceData, plugMiniJPWebhookContext, plugMiniStatus, plugMiniUSServiceData, plugMiniUSWebhookContext, plugStatus, plugWebhookContext } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { devicesConfig } from '../settings.js'
|
|
9
|
-
import type { plugMiniJPServiceData, plugMiniUSServiceData } from '../types/bledevicestatus.js'
|
|
10
|
-
import type { device } from '../types/devicelist.js'
|
|
11
|
-
import type { plugMiniStatus, plugStatus } from '../types/devicestatus.js'
|
|
12
|
-
import type { plugMiniJPWebhookContext, plugMiniUSWebhookContext, plugWebhookContext } from '../types/devicewebhookstatus.js'
|
|
13
10
|
|
|
14
11
|
/*
|
|
15
12
|
* For Testing Locally:
|
|
@@ -347,11 +344,11 @@ export class Plug extends deviceBase {
|
|
|
347
344
|
await this.debugLog('openAPIpushChanges')
|
|
348
345
|
if (this.Outlet.On !== this.accessory.context.On) {
|
|
349
346
|
const command = this.Outlet.On ? 'turnOn' : 'turnOff'
|
|
350
|
-
const bodyChange =
|
|
347
|
+
const bodyChange: bodyChange = {
|
|
351
348
|
command: `${command}`,
|
|
352
349
|
parameter: 'default',
|
|
353
350
|
commandType: 'command',
|
|
354
|
-
}
|
|
351
|
+
}
|
|
355
352
|
await this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
356
353
|
try {
|
|
357
354
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
|
@@ -3,17 +3,10 @@
|
|
|
3
3
|
* robotvacuumcleaner.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { bodyChange, device, floorCleaningRobotS10Status, floorCleaningRobotS10WebhookContext, robotVacuumCleanerS1PlusStatus, robotVacuumCleanerS1PlusWebhookContext, robotVacuumCleanerS1Status, robotVacuumCleanerS1WebhookContext, robotVacuumCleanerServiceData } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { devicesConfig } from '../settings.js'
|
|
9
|
-
import type { robotVacuumCleanerServiceData } from '../types/bledevicestatus.js'
|
|
10
|
-
import type { device } from '../types/devicelist.js'
|
|
11
|
-
import type { floorCleaningRobotS10Status, robotVacuumCleanerS1PlusStatus, robotVacuumCleanerS1Status } from '../types/devicestatus.js'
|
|
12
|
-
import type {
|
|
13
|
-
floorCleaningRobotS10WebhookContext,
|
|
14
|
-
robotVacuumCleanerS1PlusWebhookContext,
|
|
15
|
-
robotVacuumCleanerS1WebhookContext,
|
|
16
|
-
} from '../types/devicewebhookstatus.js'
|
|
17
10
|
|
|
18
11
|
/*
|
|
19
12
|
* For Testing Locally:
|
|
@@ -434,11 +427,11 @@ export class RobotVacuumCleaner extends deviceBase {
|
|
|
434
427
|
await this.debugLog('openAPIpushChanges')
|
|
435
428
|
if (this.LightBulb.On !== this.accessory.context.On) {
|
|
436
429
|
const command = this.LightBulb.On ? 'start' : 'dock'
|
|
437
|
-
const bodyChange =
|
|
430
|
+
const bodyChange: bodyChange = {
|
|
438
431
|
command: `${command}`,
|
|
439
432
|
parameter: 'default',
|
|
440
433
|
commandType: 'command',
|
|
441
|
-
}
|
|
434
|
+
}
|
|
442
435
|
await this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
443
436
|
try {
|
|
444
437
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
|
@@ -471,11 +464,11 @@ export class RobotVacuumCleaner extends deviceBase {
|
|
|
471
464
|
: this.LightBulb.Brightness === 75
|
|
472
465
|
? '2'
|
|
473
466
|
: this.LightBulb.Brightness === 100 ? '3' : 'default'
|
|
474
|
-
const bodyChange =
|
|
467
|
+
const bodyChange: bodyChange = {
|
|
475
468
|
command: `${command}`,
|
|
476
469
|
parameter: `${parameter}`,
|
|
477
470
|
commandType: 'command',
|
|
478
|
-
}
|
|
471
|
+
}
|
|
479
472
|
await this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
480
473
|
try {
|
|
481
474
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
* waterdetector.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { device, waterLeakDetectorServiceData, waterLeakDetectorStatus, waterLeakDetectorWebhookContext } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { devicesConfig } from '../settings.js'
|
|
9
|
-
import type { waterLeakDetectorServiceData } from '../types/bledevicestatus.js'
|
|
10
|
-
import type { device } from '../types/devicelist.js'
|
|
11
|
-
import type { waterLeakDetectorStatus } from '../types/devicestatus.js'
|
|
12
|
-
import type { waterLeakDetectorWebhookContext } from '../types/devicewebhookstatus.js'
|
|
13
10
|
|
|
14
11
|
/*
|
|
15
12
|
* For Testing Locally:
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* airconditioners.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { bodyChange, irdevice } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { irDevicesConfig } from '../settings.js'
|
|
9
|
-
import type { irdevice } from '../types/irdevicelist.js'
|
|
10
10
|
|
|
11
11
|
import { irdeviceBase } from './irdevice.js'
|
|
12
12
|
|
|
@@ -162,11 +162,11 @@ export class AirConditioner extends irdeviceBase {
|
|
|
162
162
|
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
163
163
|
const commandType: string = await this.commandType()
|
|
164
164
|
const command: string = await this.commandOn()
|
|
165
|
-
const bodyChange =
|
|
165
|
+
const bodyChange: bodyChange = {
|
|
166
166
|
command,
|
|
167
167
|
parameter: 'default',
|
|
168
168
|
commandType,
|
|
169
|
-
}
|
|
169
|
+
}
|
|
170
170
|
await this.pushChanges(bodyChange)
|
|
171
171
|
}
|
|
172
172
|
}
|
|
@@ -176,11 +176,11 @@ export class AirConditioner extends irdeviceBase {
|
|
|
176
176
|
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
177
177
|
const commandType: string = await this.commandType()
|
|
178
178
|
const command: string = await this.commandOff()
|
|
179
|
-
const bodyChange =
|
|
179
|
+
const bodyChange: bodyChange = {
|
|
180
180
|
command,
|
|
181
181
|
parameter: 'default',
|
|
182
182
|
commandType,
|
|
183
|
-
}
|
|
183
|
+
}
|
|
184
184
|
await this.pushChanges(bodyChange)
|
|
185
185
|
}
|
|
186
186
|
}
|
|
@@ -219,12 +219,11 @@ export class AirConditioner extends irdeviceBase {
|
|
|
219
219
|
const parameter = `${this.HeaterCooler.ThresholdTemperature},${this.CurrentMode},${this.CurrentFanSpeed},${this.state}`
|
|
220
220
|
|
|
221
221
|
await this.UpdateCurrentHeaterCoolerState()
|
|
222
|
-
const bodyChange =
|
|
222
|
+
const bodyChange: bodyChange = {
|
|
223
223
|
command: 'setAll',
|
|
224
224
|
parameter: `${parameter}`,
|
|
225
225
|
commandType: 'command',
|
|
226
|
-
}
|
|
227
|
-
|
|
226
|
+
}
|
|
228
227
|
await this.pushChanges(bodyChange)
|
|
229
228
|
}
|
|
230
229
|
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* airpurifier.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { bodyChange, irdevice } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { irDevicesConfig } from '../settings.js'
|
|
9
|
-
import type { irdevice } from '../types/irdevicelist.js'
|
|
10
10
|
|
|
11
11
|
import { irdeviceBase } from './irdevice.js'
|
|
12
12
|
|
|
@@ -149,11 +149,11 @@ export class AirPurifier extends irdeviceBase {
|
|
|
149
149
|
if (this.AirPurifier.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
150
150
|
const commandType: string = await this.commandType()
|
|
151
151
|
const command: string = await this.commandOn()
|
|
152
|
-
const bodyChange =
|
|
152
|
+
const bodyChange: bodyChange = {
|
|
153
153
|
command,
|
|
154
154
|
parameter: 'default',
|
|
155
155
|
commandType,
|
|
156
|
-
}
|
|
156
|
+
}
|
|
157
157
|
await this.pushChanges(bodyChange)
|
|
158
158
|
}
|
|
159
159
|
}
|
|
@@ -163,11 +163,11 @@ export class AirPurifier extends irdeviceBase {
|
|
|
163
163
|
if (this.AirPurifier.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOn) {
|
|
164
164
|
const commandType: string = await this.commandType()
|
|
165
165
|
const command: string = await this.commandOff()
|
|
166
|
-
const bodyChange =
|
|
166
|
+
const bodyChange: bodyChange = {
|
|
167
167
|
command,
|
|
168
168
|
parameter: 'default',
|
|
169
169
|
commandType,
|
|
170
|
-
}
|
|
170
|
+
}
|
|
171
171
|
await this.pushChanges(bodyChange)
|
|
172
172
|
}
|
|
173
173
|
}
|
|
@@ -191,11 +191,11 @@ export class AirPurifier extends irdeviceBase {
|
|
|
191
191
|
this.CurrentAPFanSpeed = this.CurrentFanSpeed ?? 1
|
|
192
192
|
this.APActive = this.AirPurifier.Active === 1 ? 'on' : 'off'
|
|
193
193
|
const parameter = `${this.CurrentAPTemp},${this.CurrentAPMode},${this.CurrentAPFanSpeed},${this.APActive}`
|
|
194
|
-
const bodyChange =
|
|
194
|
+
const bodyChange: bodyChange = {
|
|
195
195
|
command: 'setAll',
|
|
196
196
|
parameter: `${parameter}`,
|
|
197
197
|
commandType: 'command',
|
|
198
|
-
}
|
|
198
|
+
}
|
|
199
199
|
if (this.AirPurifier.Active === 1) {
|
|
200
200
|
if ((Number(this.TemperatureSensor!.CurrentTemperature) || 24) < (this.LastTemperature || 30)) {
|
|
201
201
|
this.AirPurifier.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.COOLING
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* camera.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { bodyChange, irdevice } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { irDevicesConfig } from '../settings.js'
|
|
9
|
-
import type { irdevice } from '../types/irdevicelist.js'
|
|
10
10
|
|
|
11
11
|
import { irdeviceBase } from './irdevice.js'
|
|
12
12
|
|
|
@@ -72,11 +72,11 @@ export class Camera extends irdeviceBase {
|
|
|
72
72
|
if (this.Switch.On && !this.disablePushOn) {
|
|
73
73
|
const commandType: string = await this.commandType()
|
|
74
74
|
const command: string = await this.commandOn()
|
|
75
|
-
const bodyChange =
|
|
75
|
+
const bodyChange: bodyChange = {
|
|
76
76
|
command,
|
|
77
77
|
parameter: 'default',
|
|
78
78
|
commandType,
|
|
79
|
-
}
|
|
79
|
+
}
|
|
80
80
|
await this.pushChanges(bodyChange)
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -86,11 +86,11 @@ export class Camera extends irdeviceBase {
|
|
|
86
86
|
if (!this.Switch.On && !this.disablePushOff) {
|
|
87
87
|
const commandType: string = await this.commandType()
|
|
88
88
|
const command: string = await this.commandOff()
|
|
89
|
-
const bodyChange =
|
|
89
|
+
const bodyChange: bodyChange = {
|
|
90
90
|
command,
|
|
91
91
|
parameter: 'default',
|
|
92
92
|
commandType,
|
|
93
|
-
}
|
|
93
|
+
}
|
|
94
94
|
await this.pushChanges(bodyChange)
|
|
95
95
|
}
|
|
96
96
|
}
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* fan.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { bodyChange, irdevice } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { irDevicesConfig } from '../settings.js'
|
|
9
|
-
import type { irdevice } from '../types/irdevicelist.js'
|
|
10
10
|
|
|
11
11
|
import { irdeviceBase } from './irdevice.js'
|
|
12
12
|
|
|
@@ -136,11 +136,11 @@ export class IRFan extends irdeviceBase {
|
|
|
136
136
|
if (this.Fan.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
137
137
|
const commandType: string = await this.commandType()
|
|
138
138
|
const command: string = await this.commandOn()
|
|
139
|
-
const bodyChange =
|
|
139
|
+
const bodyChange: bodyChange = {
|
|
140
140
|
command,
|
|
141
141
|
parameter: 'default',
|
|
142
142
|
commandType,
|
|
143
|
-
}
|
|
143
|
+
}
|
|
144
144
|
await this.pushChanges(bodyChange)
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -150,39 +150,39 @@ export class IRFan extends irdeviceBase {
|
|
|
150
150
|
if (this.Fan.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
151
151
|
const commandType: string = await this.commandType()
|
|
152
152
|
const command: string = await this.commandOff()
|
|
153
|
-
const bodyChange =
|
|
153
|
+
const bodyChange: bodyChange = {
|
|
154
154
|
command,
|
|
155
155
|
parameter: 'default',
|
|
156
156
|
commandType,
|
|
157
|
-
}
|
|
157
|
+
}
|
|
158
158
|
await this.pushChanges(bodyChange)
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
async pushFanSpeedUpChanges(): Promise<void> {
|
|
163
|
-
const bodyChange =
|
|
163
|
+
const bodyChange: bodyChange = {
|
|
164
164
|
command: 'highSpeed',
|
|
165
165
|
parameter: 'default',
|
|
166
166
|
commandType: 'command',
|
|
167
|
-
}
|
|
167
|
+
}
|
|
168
168
|
await this.pushChanges(bodyChange)
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
async pushFanSpeedDownChanges(): Promise<void> {
|
|
172
|
-
const bodyChange =
|
|
172
|
+
const bodyChange: bodyChange = {
|
|
173
173
|
command: 'lowSpeed',
|
|
174
174
|
parameter: 'default',
|
|
175
175
|
commandType: 'command',
|
|
176
|
-
}
|
|
176
|
+
}
|
|
177
177
|
await this.pushChanges(bodyChange)
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
async pushFanSwingChanges(): Promise<void> {
|
|
181
|
-
const bodyChange =
|
|
181
|
+
const bodyChange: bodyChange = {
|
|
182
182
|
command: 'swing',
|
|
183
183
|
parameter: 'default',
|
|
184
184
|
commandType: 'command',
|
|
185
|
-
}
|
|
185
|
+
}
|
|
186
186
|
await this.pushChanges(bodyChange)
|
|
187
187
|
}
|
|
188
188
|
|
package/src/irdevice/irdevice.ts
CHANGED
|
@@ -3,14 +3,10 @@
|
|
|
3
3
|
* device.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { API, CharacteristicValue, HAP, Logging, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { bodyChange, irdevice } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { irDevicesConfig, SwitchBotPlatformConfig } from '../settings.js'
|
|
9
|
-
import type { irdevice } from '../types/irdevicelist.js'
|
|
10
|
-
|
|
11
|
-
import { request } from 'undici'
|
|
12
|
-
|
|
13
|
-
import { Devices } from '../settings.js'
|
|
14
10
|
|
|
15
11
|
export abstract class irdeviceBase {
|
|
16
12
|
public readonly api: API
|
|
@@ -129,12 +125,8 @@ export abstract class irdeviceBase {
|
|
|
129
125
|
this.debugSuccessLog(`version: ${accessory.context.version}`)
|
|
130
126
|
}
|
|
131
127
|
|
|
132
|
-
async pushChangeRequest(bodyChange:
|
|
133
|
-
return
|
|
134
|
-
body: bodyChange,
|
|
135
|
-
method: 'POST',
|
|
136
|
-
headers: this.platform.generateHeaders(),
|
|
137
|
-
})
|
|
128
|
+
async pushChangeRequest(bodyChange: bodyChange): Promise<{ body: any, statusCode: any }> {
|
|
129
|
+
return this.platform.switchBotAPI.controlDevice(this.device.deviceId, bodyChange.command, bodyChange.parameter, bodyChange.commandType)
|
|
138
130
|
}
|
|
139
131
|
|
|
140
132
|
async successfulStatusCodes(statusCode: any, deviceStatus: any) {
|
package/src/irdevice/light.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* light.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { bodyChange, irdevice } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { irDevicesConfig } from '../settings.js'
|
|
9
|
-
import type { irdevice } from '../types/irdevicelist.js'
|
|
10
10
|
|
|
11
11
|
import { irdeviceBase } from './irdevice.js'
|
|
12
12
|
|
|
@@ -170,11 +170,11 @@ export class Light extends irdeviceBase {
|
|
|
170
170
|
if (On === true && this.disablePushOn === false) {
|
|
171
171
|
const commandType: string = await this.commandType()
|
|
172
172
|
const command: string = await this.commandOn()
|
|
173
|
-
const bodyChange =
|
|
173
|
+
const bodyChange: bodyChange = {
|
|
174
174
|
command,
|
|
175
175
|
parameter: 'default',
|
|
176
176
|
commandType,
|
|
177
|
-
}
|
|
177
|
+
}
|
|
178
178
|
await this.pushChanges(bodyChange, On)
|
|
179
179
|
}
|
|
180
180
|
}
|
|
@@ -184,11 +184,11 @@ export class Light extends irdeviceBase {
|
|
|
184
184
|
if (On === false && this.disablePushOff === false) {
|
|
185
185
|
const commandType: string = await this.commandType()
|
|
186
186
|
const command: string = await this.commandOff()
|
|
187
|
-
const bodyChange =
|
|
187
|
+
const bodyChange: bodyChange = {
|
|
188
188
|
command,
|
|
189
189
|
parameter: 'default',
|
|
190
190
|
commandType,
|
|
191
|
-
}
|
|
191
|
+
}
|
|
192
192
|
await this.pushChanges(bodyChange, On)
|
|
193
193
|
}
|
|
194
194
|
}
|
package/src/irdevice/other.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* other.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
+
import type { bodyChange, irdevice } from 'node-switchbot'
|
|
6
7
|
|
|
7
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
9
|
import type { irDevicesConfig } from '../settings.js'
|
|
9
|
-
import type { irdevice } from '../types/irdevicelist.js'
|
|
10
10
|
|
|
11
11
|
import { irdeviceBase } from './irdevice.js'
|
|
12
12
|
|
|
@@ -412,11 +412,11 @@ export class Others extends irdeviceBase {
|
|
|
412
412
|
if (On === true && !this.disablePushOn) {
|
|
413
413
|
const commandType: string = await this.commandType()
|
|
414
414
|
const command: string = await this.commandOn()
|
|
415
|
-
const bodyChange =
|
|
415
|
+
const bodyChange: bodyChange = {
|
|
416
416
|
command,
|
|
417
417
|
parameter: 'default',
|
|
418
418
|
commandType,
|
|
419
|
-
}
|
|
419
|
+
}
|
|
420
420
|
await this.pushChanges(bodyChange)
|
|
421
421
|
}
|
|
422
422
|
} else {
|
|
@@ -430,11 +430,11 @@ export class Others extends irdeviceBase {
|
|
|
430
430
|
if (On === false && !this.disablePushOff) {
|
|
431
431
|
const commandType: string = await this.commandType()
|
|
432
432
|
const command: string = await this.commandOff()
|
|
433
|
-
const bodyChange =
|
|
433
|
+
const bodyChange: bodyChange = {
|
|
434
434
|
command,
|
|
435
435
|
parameter: 'default',
|
|
436
436
|
commandType,
|
|
437
|
-
}
|
|
437
|
+
}
|
|
438
438
|
await this.pushChanges(bodyChange)
|
|
439
439
|
}
|
|
440
440
|
} else {
|