@switchbot/homebridge-switchbot 2.8.0-beta.1 → 2.8.0-beta.10
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 -0
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +9 -6
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +1 -0
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +8 -5
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +1 -0
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +12 -9
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +1 -0
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +8 -5
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +2 -0
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +45 -34
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +2 -0
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +31 -36
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +3 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +29 -4
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +9 -6
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +1 -0
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +10 -6
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +1 -0
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +9 -6
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +2 -0
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +11 -6
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +2 -0
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +12 -8
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +4 -3
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +56 -54
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +2 -0
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +46 -31
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +1 -0
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +9 -6
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +1 -0
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +26 -2
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +7 -5
- 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 +3 -3
- 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 +3 -3
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +2 -2
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +3 -3
- package/dist/irdevice/fan.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 +3 -3
- 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 +3 -3
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +2 -2
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +3 -3
- 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 +3 -3
- 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 +3 -3
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +3 -2
- package/dist/platform.js.map +1 -1
- package/package.json +3 -3
- package/src/device/blindtilt.ts +8 -6
- package/src/device/bot.ts +8 -5
- package/src/device/ceilinglight.ts +12 -6
- package/src/device/colorbulb.ts +10 -5
- package/src/device/contact.ts +44 -30
- package/src/device/curtain.ts +30 -33
- package/src/device/hub.ts +30 -4
- package/src/device/humidifier.ts +8 -5
- package/src/device/iosensor.ts +9 -5
- package/src/device/lightstrip.ts +10 -5
- package/src/device/lock.ts +12 -5
- package/src/device/meter.ts +12 -7
- package/src/device/meterplus.ts +60 -53
- package/src/device/motion.ts +45 -27
- package/src/device/plug.ts +8 -5
- package/src/device/robotvacuumcleaner.ts +29 -2
- package/src/irdevice/airconditioner.ts +7 -5
- package/src/irdevice/airpurifier.ts +5 -5
- package/src/irdevice/camera.ts +5 -5
- package/src/irdevice/fan.ts +5 -5
- package/src/irdevice/light.ts +5 -5
- package/src/irdevice/other.ts +5 -5
- package/src/irdevice/tv.ts +5 -5
- package/src/irdevice/vacuumcleaner.ts +5 -5
- package/src/irdevice/waterheater.ts +5 -5
- package/src/platform.ts +3 -2
- package/src/settings.ts +1 -1
package/src/irdevice/other.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
1
2
|
import { request } from 'undici';
|
|
2
3
|
import { SwitchBotPlatform } from '../platform';
|
|
3
|
-
import { irDevicesConfig, irdevice
|
|
4
|
-
import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
4
|
+
import { Devices, irDevicesConfig, irdevice } from '../settings';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Platform Accessory
|
|
@@ -29,10 +29,10 @@ export class Others {
|
|
|
29
29
|
// default placeholders
|
|
30
30
|
this.logs(device);
|
|
31
31
|
this.deviceType(device);
|
|
32
|
-
this.config(device);
|
|
33
32
|
this.context();
|
|
34
33
|
this.disablePushOnChanges({ device });
|
|
35
34
|
this.disablePushOffChanges({ device });
|
|
35
|
+
this.config(device);
|
|
36
36
|
|
|
37
37
|
// set accessory information
|
|
38
38
|
accessory
|
|
@@ -135,7 +135,7 @@ export class Others {
|
|
|
135
135
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
136
136
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
|
|
137
137
|
if (this.device.connectionType === 'OpenAPI') {
|
|
138
|
-
this.
|
|
138
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
139
139
|
try {
|
|
140
140
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
141
141
|
body: bodyChange,
|
|
@@ -329,7 +329,7 @@ export class Others {
|
|
|
329
329
|
config['disablePushOff'] = device.disablePushOff;
|
|
330
330
|
}
|
|
331
331
|
if (Object.entries(config).length !== 0) {
|
|
332
|
-
this.
|
|
332
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
1
2
|
import { request } from 'undici';
|
|
2
3
|
import { SwitchBotPlatform } from '../platform';
|
|
3
|
-
import {
|
|
4
|
-
import { irdevice, irDevicesConfig, Devices } from '../settings';
|
|
4
|
+
import { Devices, irDevicesConfig, irdevice } from '../settings';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Platform Accessory
|
|
@@ -33,11 +33,11 @@ export class TV {
|
|
|
33
33
|
) {
|
|
34
34
|
// default placeholders
|
|
35
35
|
this.logs(device);
|
|
36
|
-
this.config(device);
|
|
37
36
|
this.context();
|
|
38
37
|
this.disablePushOnChanges({ device });
|
|
39
38
|
this.disablePushOffChanges({ device });
|
|
40
39
|
this.disablePushDetailChanges({ device });
|
|
40
|
+
this.config(device);
|
|
41
41
|
|
|
42
42
|
// set accessory information
|
|
43
43
|
accessory
|
|
@@ -368,7 +368,7 @@ export class TV {
|
|
|
368
368
|
async pushTVChanges(bodyChange: any): Promise<void> {
|
|
369
369
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushTVChanges`);
|
|
370
370
|
if (this.device.connectionType === 'OpenAPI') {
|
|
371
|
-
this.
|
|
371
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
372
372
|
try {
|
|
373
373
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
374
374
|
body: bodyChange,
|
|
@@ -574,7 +574,7 @@ export class TV {
|
|
|
574
574
|
config['disablePushDetail'] = device.disablePushDetail;
|
|
575
575
|
}
|
|
576
576
|
if (Object.entries(config).length !== 0) {
|
|
577
|
-
this.
|
|
577
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
1
2
|
import { request } from 'undici';
|
|
2
3
|
import { SwitchBotPlatform } from '../platform';
|
|
3
|
-
import { irDevicesConfig, irdevice
|
|
4
|
-
import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
4
|
+
import { Devices, irDevicesConfig, irdevice } from '../settings';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Platform Accessory
|
|
@@ -27,10 +27,10 @@ export class VacuumCleaner {
|
|
|
27
27
|
) {
|
|
28
28
|
// default placeholders
|
|
29
29
|
this.logs(device);
|
|
30
|
-
this.config(device);
|
|
31
30
|
this.context();
|
|
32
31
|
this.disablePushOnChanges({ device });
|
|
33
32
|
this.disablePushOffChanges({ device });
|
|
33
|
+
this.config(device);
|
|
34
34
|
|
|
35
35
|
// set accessory information
|
|
36
36
|
accessory
|
|
@@ -112,7 +112,7 @@ export class VacuumCleaner {
|
|
|
112
112
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
113
113
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
|
|
114
114
|
if (this.device.connectionType === 'OpenAPI') {
|
|
115
|
-
this.
|
|
115
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
116
116
|
try {
|
|
117
117
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
118
118
|
body: bodyChange,
|
|
@@ -294,7 +294,7 @@ export class VacuumCleaner {
|
|
|
294
294
|
config['disablePushOff'] = device.disablePushOff;
|
|
295
295
|
}
|
|
296
296
|
if (Object.entries(config).length !== 0) {
|
|
297
|
-
this.
|
|
297
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
1
2
|
import { request } from 'undici';
|
|
2
3
|
import { SwitchBotPlatform } from '../platform';
|
|
3
|
-
import { irDevicesConfig, irdevice
|
|
4
|
-
import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
4
|
+
import { Devices, irDevicesConfig, irdevice } from '../settings';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Platform Accessory
|
|
@@ -27,10 +27,10 @@ export class WaterHeater {
|
|
|
27
27
|
) {
|
|
28
28
|
// default placeholders
|
|
29
29
|
this.logs({ device });
|
|
30
|
-
this.config({ device });
|
|
31
30
|
this.context();
|
|
32
31
|
this.disablePushOnChanges({ device });
|
|
33
32
|
this.disablePushOffChanges({ device });
|
|
33
|
+
this.config({ device });
|
|
34
34
|
|
|
35
35
|
// set accessory information
|
|
36
36
|
accessory
|
|
@@ -121,7 +121,7 @@ export class WaterHeater {
|
|
|
121
121
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
122
122
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
|
|
123
123
|
if (this.device.connectionType === 'OpenAPI') {
|
|
124
|
-
this.
|
|
124
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
125
125
|
try {
|
|
126
126
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
127
127
|
body: bodyChange,
|
|
@@ -303,7 +303,7 @@ export class WaterHeater {
|
|
|
303
303
|
config['disablePushOff'] = device.disablePushOff;
|
|
304
304
|
}
|
|
305
305
|
if (Object.entries(config).length !== 0) {
|
|
306
|
-
this.
|
|
306
|
+
this.debugWarnLog({ log: [`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`] });
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
|
package/src/platform.ts
CHANGED
|
@@ -138,7 +138,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
138
138
|
platformConfig['pushRate'] = this.config.options.pushRate;
|
|
139
139
|
}
|
|
140
140
|
if (Object.entries(platformConfig).length !== 0) {
|
|
141
|
-
this.
|
|
141
|
+
this.debugWarnLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
if (this.config.options) {
|
|
@@ -245,7 +245,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
245
245
|
} else {
|
|
246
246
|
// eslint-disable-next-line no-useless-escape, max-len
|
|
247
247
|
this.warnLog(
|
|
248
|
-
'This plugin has been updated to use OpenAPI v1.1, config is set with openToken,
|
|
248
|
+
'This plugin has been updated to use OpenAPI v1.1, config is set with openToken, '
|
|
249
|
+
+ '"openToken" config has been moved to the "token" config, please restart Homebridge.',
|
|
249
250
|
);
|
|
250
251
|
}
|
|
251
252
|
|
package/src/settings.ts
CHANGED
|
@@ -286,7 +286,7 @@ export type deviceStatus = {
|
|
|
286
286
|
childLock?: boolean; //determines if a Humidifier's safety lock is on or not. (Used by the following deviceTypes: Humidifier)
|
|
287
287
|
sound?: boolean; //determines if a Humidifier is muted or not. (Used by the following deviceTypes: Humidifier)
|
|
288
288
|
lackWater?: boolean; //determines if the water tank is empty or not. (Used by the following deviceTypes: Humidifier)
|
|
289
|
-
version?: number; //the version of the device. (Used by the following deviceTypes: Blind Tilt)
|
|
289
|
+
version?: number; //the version of the device. (Used by the following deviceTypes: Blind Tilt, Meter, MeterPlus, IOSensor)
|
|
290
290
|
direction?: string; //the opening direction of a Blind Tilt device. (Used by the following deviceTypes: Blind Tilt)
|
|
291
291
|
runStatus?: string; //'static' when not moving. (Used by the following deviceTypes: Blind Tilt)
|
|
292
292
|
mode?: number; //available for devices. the fan mode. (Used by the following deviceTypes: Smart Fan)
|