@switchbot/homebridge-switchbot 3.5.0-beta.57 → 3.5.0-beta.58
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/.vscode/settings.json +4 -1
- package/dist/device/blindtilt.d.ts +4 -4
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +2 -2
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +3 -3
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +1 -1
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +3 -3
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +2 -2
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +3 -3
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +1 -1
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +4 -4
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +8 -2
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +3 -3
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +1 -1
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +4 -4
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +4 -0
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts +3 -3
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +1 -1
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts +4 -4
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +1 -5
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +3 -3
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +1 -1
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +3 -3
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +1 -5
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +4 -4
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +2 -2
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +3 -3
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +1 -1
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +3 -3
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +1 -5
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +3 -3
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +1 -5
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +3 -3
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +14 -12
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +3 -3
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +1 -1
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +4 -4
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +3 -3
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts +3 -3
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +1 -1
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/homebridge-ui/public/index.html +20 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +3 -3
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +9 -9
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +3 -3
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +1 -1
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +3 -3
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +2 -2
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +6 -6
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +37 -29
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +3 -3
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.d.ts +9 -14
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +67 -88
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +3 -3
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +1 -1
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +3 -3
- 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 +3 -3
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +2 -2
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +3 -3
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +2 -2
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +7 -7
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +20 -23
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +24 -10
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +16 -0
- package/dist/settings.js.map +1 -1
- package/eslint.config.js +89 -78
- package/package.json +3 -3
- package/src/device/blindtilt.ts +6 -4
- package/src/device/bot.ts +6 -4
- package/src/device/ceilinglight.ts +6 -4
- package/src/device/colorbulb.ts +5 -3
- package/src/device/contact.ts +19 -10
- package/src/device/curtain.ts +7 -5
- package/src/device/device.ts +5 -4
- package/src/device/fan.ts +5 -3
- package/src/device/hub.ts +7 -4
- package/src/device/humidifier.ts +7 -5
- package/src/device/iosensor.ts +8 -5
- package/src/device/lightstrip.ts +6 -4
- package/src/device/lock.ts +5 -3
- package/src/device/meter.ts +7 -4
- package/src/device/meterplus.ts +7 -4
- package/src/device/motion.ts +21 -16
- package/src/device/plug.ts +5 -3
- package/src/device/robotvacuumcleaner.ts +7 -5
- package/src/device/waterdetector.ts +5 -3
- package/src/homebridge-ui/public/index.html +20 -14
- package/src/index.ts +3 -2
- package/src/irdevice/airconditioner.ts +13 -11
- package/src/irdevice/airpurifier.ts +5 -3
- package/src/irdevice/camera.ts +6 -4
- package/src/irdevice/fan.ts +42 -29
- package/src/irdevice/irdevice.ts +4 -5
- package/src/irdevice/light.ts +83 -103
- package/src/irdevice/other.ts +5 -3
- package/src/irdevice/tv.ts +7 -5
- package/src/irdevice/vacuumcleaner.ts +6 -4
- package/src/irdevice/waterheater.ts +6 -4
- package/src/platform.ts +59 -66
- package/src/settings.ts +73 -58
package/src/platform.ts
CHANGED
|
@@ -2,24 +2,23 @@
|
|
|
2
2
|
*
|
|
3
3
|
* platform.ts: @switchbot/homebridge-switchbot platform class.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import { PLATFORM_NAME, PLUGIN_NAME, irdevice, device, SwitchBotPlatformConfig, devicesConfig, irDevicesConfig, Devices } from './settings.js';
|
|
5
|
+
import { Hub } from './device/hub.js';
|
|
7
6
|
import { Bot } from './device/bot.js';
|
|
8
7
|
import { Plug } from './device/plug.js';
|
|
9
8
|
import { Lock } from './device/lock.js';
|
|
10
9
|
import { Meter } from './device/meter.js';
|
|
11
10
|
import { Motion } from './device/motion.js';
|
|
12
|
-
import { Hub } from './device/hub.js';
|
|
13
11
|
import { Contact } from './device/contact.js';
|
|
14
12
|
import { Curtain } from './device/curtain.js';
|
|
15
13
|
import { IOSensor } from './device/iosensor.js';
|
|
16
|
-
import { WaterDetector } from './device/waterdetector.js';
|
|
17
14
|
import { MeterPlus } from './device/meterplus.js';
|
|
18
15
|
import { ColorBulb } from './device/colorbulb.js';
|
|
19
|
-
import { CeilingLight } from './device/ceilinglight.js';
|
|
20
16
|
import { StripLight } from './device/lightstrip.js';
|
|
21
17
|
import { Humidifier } from './device/humidifier.js';
|
|
18
|
+
import { CeilingLight } from './device/ceilinglight.js';
|
|
19
|
+
import { WaterDetector } from './device/waterdetector.js';
|
|
22
20
|
import { RobotVacuumCleaner } from './device/robotvacuumcleaner.js';
|
|
21
|
+
|
|
23
22
|
import { Fan } from './device/fan.js';
|
|
24
23
|
import { TV } from './irdevice/tv.js';
|
|
25
24
|
import { IRFan } from './irdevice/fan.js';
|
|
@@ -31,18 +30,25 @@ import { AirPurifier } from './irdevice/airpurifier.js';
|
|
|
31
30
|
import { WaterHeater } from './irdevice/waterheater.js';
|
|
32
31
|
import { VacuumCleaner } from './irdevice/vacuumcleaner.js';
|
|
33
32
|
import { AirConditioner } from './irdevice/airconditioner.js';
|
|
34
|
-
|
|
33
|
+
|
|
35
34
|
import { Buffer } from 'buffer';
|
|
36
|
-
import {
|
|
37
|
-
import
|
|
35
|
+
import { request } from 'undici';
|
|
36
|
+
import asyncmqtt from 'async-mqtt';
|
|
37
|
+
import { sleep } from './utils.js';
|
|
38
|
+
import { createServer } from 'http';
|
|
38
39
|
import { queueScheduler } from 'rxjs';
|
|
39
40
|
import fakegato from 'fakegato-history';
|
|
40
|
-
import asyncmqtt from 'async-mqtt';
|
|
41
41
|
import crypto, { randomUUID } from 'crypto';
|
|
42
42
|
import { readFileSync, writeFileSync } from 'fs';
|
|
43
43
|
import { EveHomeKitTypes } from 'homebridge-lib/EveHomeKitTypes';
|
|
44
|
-
import {
|
|
45
|
-
|
|
44
|
+
import { PLATFORM_NAME, PLUGIN_NAME, Devices, setupWebhook, updateWebhook, deleteWebhook, queryWebhook } from './settings.js';
|
|
45
|
+
|
|
46
|
+
import type { UrlObject } from 'url';
|
|
47
|
+
import type { MqttClient } from 'mqtt';
|
|
48
|
+
import type { Dispatcher } from 'undici';
|
|
49
|
+
import type { Server, IncomingMessage, ServerResponse } from 'http';
|
|
50
|
+
import type { API, DynamicPlatformPlugin, Logging, PlatformAccessory } from 'homebridge';
|
|
51
|
+
import type { irdevice, device, SwitchBotPlatformConfig, devicesConfig, irDevicesConfig } from './settings.js';
|
|
46
52
|
|
|
47
53
|
/**
|
|
48
54
|
* HomebridgePlatform
|
|
@@ -63,7 +69,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
63
69
|
platformLogging!: SwitchBotPlatformConfig['logging'];
|
|
64
70
|
config!: SwitchBotPlatformConfig;
|
|
65
71
|
|
|
66
|
-
webhookEventListener:
|
|
72
|
+
webhookEventListener: Server | null = null;
|
|
67
73
|
mqttClient: MqttClient | null = null;
|
|
68
74
|
|
|
69
75
|
public readonly fakegatoAPI: any;
|
|
@@ -121,7 +127,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
121
127
|
if (this.config.credentials?.openToken && !this.config.credentials.token) {
|
|
122
128
|
await this.updateToken();
|
|
123
129
|
} else if (this.config.credentials?.token && !this.config.credentials?.secret) {
|
|
124
|
-
|
|
130
|
+
|
|
125
131
|
this.errorLog('"secret" config is not populated, you must populate then please restart Homebridge.');
|
|
126
132
|
} else {
|
|
127
133
|
this.discoverDevices();
|
|
@@ -175,7 +181,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
175
181
|
const xurl = new URL(url);
|
|
176
182
|
const port = Number(xurl.port);
|
|
177
183
|
const path = xurl.pathname;
|
|
178
|
-
this.webhookEventListener =
|
|
184
|
+
this.webhookEventListener = createServer((request: IncomingMessage, response: ServerResponse) => {
|
|
179
185
|
try {
|
|
180
186
|
if (request.url === path && request.method === 'POST') {
|
|
181
187
|
request.on('data', async (data) => {
|
|
@@ -212,16 +218,15 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
212
218
|
}
|
|
213
219
|
|
|
214
220
|
try {
|
|
215
|
-
const { body, statusCode } = await request(
|
|
216
|
-
'
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
});
|
|
221
|
+
const { body, statusCode } = await request(setupWebhook, {
|
|
222
|
+
method: 'POST',
|
|
223
|
+
headers: this.generateHeaders(),
|
|
224
|
+
body: JSON.stringify({
|
|
225
|
+
'action': 'setupWebhook',
|
|
226
|
+
'url': url,
|
|
227
|
+
'deviceList': 'ALL',
|
|
228
|
+
}),
|
|
229
|
+
});
|
|
225
230
|
const response: any = await body.json();
|
|
226
231
|
this.debugLog(`setupWebhook: url:${url}`);
|
|
227
232
|
this.debugLog(`setupWebhook: body:${JSON.stringify(response)}`);
|
|
@@ -235,18 +240,15 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
235
240
|
}
|
|
236
241
|
|
|
237
242
|
try {
|
|
238
|
-
const { body, statusCode } = await request(
|
|
239
|
-
'
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
'
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
},
|
|
248
|
-
}),
|
|
249
|
-
});
|
|
243
|
+
const { body, statusCode } = await request(updateWebhook, {
|
|
244
|
+
method: 'POST', headers: this.generateHeaders(), body: JSON.stringify({
|
|
245
|
+
'action': 'updateWebhook',
|
|
246
|
+
'config': {
|
|
247
|
+
'url': url,
|
|
248
|
+
'enable': true,
|
|
249
|
+
},
|
|
250
|
+
}),
|
|
251
|
+
});
|
|
250
252
|
const response: any = await body.json();
|
|
251
253
|
this.debugLog(`updateWebhook: url:${url}`);
|
|
252
254
|
this.debugLog(`updateWebhook: body:${JSON.stringify(response)}`);
|
|
@@ -259,14 +261,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
259
261
|
}
|
|
260
262
|
|
|
261
263
|
try {
|
|
262
|
-
const { body, statusCode } = await request(
|
|
263
|
-
'
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
});
|
|
264
|
+
const { body, statusCode } = await request(queryWebhook, {
|
|
265
|
+
method: 'POST',
|
|
266
|
+
headers: this.generateHeaders(),
|
|
267
|
+
body: JSON.stringify({
|
|
268
|
+
'action': 'queryUrl',
|
|
269
|
+
}),
|
|
270
|
+
});
|
|
270
271
|
const response: any = await body.json();
|
|
271
272
|
this.debugLog(`queryWebhook: body:${JSON.stringify(response)}`);
|
|
272
273
|
this.debugLog(`queryWebhook: statusCode:${statusCode}`);
|
|
@@ -281,15 +282,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
281
282
|
|
|
282
283
|
this.api.on('shutdown', async () => {
|
|
283
284
|
try {
|
|
284
|
-
const { body, statusCode } = await request(
|
|
285
|
-
'
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
});
|
|
285
|
+
const { body, statusCode } = await request(deleteWebhook, {
|
|
286
|
+
method: 'POST',
|
|
287
|
+
headers: this.generateHeaders(),
|
|
288
|
+
body: JSON.stringify({
|
|
289
|
+
'action': 'deleteWebhook',
|
|
290
|
+
'url': url,
|
|
291
|
+
}),
|
|
292
|
+
});
|
|
293
293
|
const response: any = await body.json();
|
|
294
294
|
this.debugLog(`deleteWebhook: url:${url}`);
|
|
295
295
|
this.debugLog(`deleteWebhook: body:${JSON.stringify(response)}`);
|
|
@@ -449,18 +449,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
449
449
|
}
|
|
450
450
|
// Move openToken to token
|
|
451
451
|
if (!this.config.credentials.secret) {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
'This plugin has been updated to use OpenAPI v1.1, config is set with openToken, "openToken" cconfig has been moved to the "token" config',
|
|
455
|
-
);
|
|
456
|
-
// eslint-disable-next-line no-useless-escape
|
|
452
|
+
this.warnLog('This plugin has been updated to use OpenAPI v1.1, config is set with openToken,'
|
|
453
|
+
+ ' "openToken" cconfig has been moved to the "token" config');
|
|
457
454
|
this.errorLog('"secret" config is not populated, you must populate then please restart Homebridge.');
|
|
458
455
|
} else {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
'This plugin has been updated to use OpenAPI v1.1, config is set with openToken, '
|
|
462
|
-
+ '"openToken" config has been moved to the "token" config, please restart Homebridge.',
|
|
463
|
-
);
|
|
456
|
+
this.warnLog('This plugin has been updated to use OpenAPI v1.1, config is set with openToken, '
|
|
457
|
+
+ '"openToken" config has been moved to the "token" config, please restart Homebridge.');
|
|
464
458
|
}
|
|
465
459
|
|
|
466
460
|
// set the refresh token
|
|
@@ -754,9 +748,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
754
748
|
this.createFan(device);
|
|
755
749
|
break;
|
|
756
750
|
default:
|
|
757
|
-
this.warnLog(`Device: ${device.deviceName} with Device Type: ${device.deviceType}, is currently not supported
|
|
758
|
-
|
|
759
|
-
this.warnLog('Submit Feature Requests Here: ' + 'https://tinyurl.com/SwitchBotFeatureRequest');
|
|
751
|
+
this.warnLog(`Device: ${device.deviceName} with Device Type: ${device.deviceType}, is currently not supported.`,
|
|
752
|
+
+ 'Submit Feature Requests Here: https://tinyurl.com/SwitchBotFeatureRequest');
|
|
760
753
|
}
|
|
761
754
|
}
|
|
762
755
|
|
package/src/settings.ts
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
*
|
|
3
3
|
* settings.ts: @switchbot/homebridge-switchbot platform class.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
import { MacAddress, PlatformConfig } from 'homebridge';
|
|
7
|
-
import { IClientOptions } from 'async-mqtt';
|
|
5
|
+
import type { IClientOptions } from 'async-mqtt';
|
|
6
|
+
import type { MacAddress, PlatformConfig } from 'homebridge';
|
|
8
7
|
/**
|
|
9
8
|
* This is the name of the platform that users will use to register the plugin in the Homebridge config.json
|
|
10
9
|
*/
|
|
@@ -20,6 +19,26 @@ export const PLUGIN_NAME = '@switchbot/homebridge-switchbot';
|
|
|
20
19
|
*/
|
|
21
20
|
export const Devices = 'https://api.switch-bot.com/v1.1/devices';
|
|
22
21
|
|
|
22
|
+
/**
|
|
23
|
+
* This is the updateWebhook url used to access SwitchBot API
|
|
24
|
+
*/
|
|
25
|
+
export const setupWebhook = 'https://api.switch-bot.com/v1.1/webhook/setupWebhook';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* This is the updateWebhook url used to access SwitchBot API
|
|
29
|
+
*/
|
|
30
|
+
export const queryWebhook = 'https://api.switch-bot.com/v1.1/webhook/queryWebhook';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This is the updateWebhook url used to access SwitchBot API
|
|
34
|
+
*/
|
|
35
|
+
export const updateWebhook = 'https://api.switch-bot.com/v1.1/webhook/updateWebhook';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* This is the deleteWebhook url used to access SwitchBot API
|
|
39
|
+
*/
|
|
40
|
+
export const deleteWebhook = 'https://api.switch-bot.com/v1.1/webhook/deleteWebhook';
|
|
41
|
+
|
|
23
42
|
//Config
|
|
24
43
|
export interface SwitchBotPlatformConfig extends PlatformConfig {
|
|
25
44
|
credentials?: credentials;
|
|
@@ -39,8 +58,8 @@ export type options = {
|
|
|
39
58
|
maxRetries?: number;
|
|
40
59
|
delayBetweenRetries?: number;
|
|
41
60
|
logging?: string;
|
|
42
|
-
devices?:
|
|
43
|
-
irdevices?:
|
|
61
|
+
devices?: devicesConfig[];
|
|
62
|
+
irdevices?: irDevicesConfig[];
|
|
44
63
|
webhookURL?: string;
|
|
45
64
|
mqttURL?: string;
|
|
46
65
|
mqttOptions?: IClientOptions;
|
|
@@ -245,7 +264,7 @@ export type body = {
|
|
|
245
264
|
|
|
246
265
|
//a list of physical devices.
|
|
247
266
|
export type deviceList = {
|
|
248
|
-
device:
|
|
267
|
+
device: device[];
|
|
249
268
|
};
|
|
250
269
|
|
|
251
270
|
export type device = {
|
|
@@ -260,9 +279,9 @@ export type device = {
|
|
|
260
279
|
//device's parent Hub ID.
|
|
261
280
|
hubDeviceId: string;
|
|
262
281
|
//only available for Curtain devices. a list of Curtain device IDs such that the Curtain devices are being paired or grouped.
|
|
263
|
-
curtainDevicesIds?:
|
|
282
|
+
curtainDevicesIds?: string[];
|
|
264
283
|
//only available for Blind Titl devices. a list of Blind Tilt device IDs such that the Blind Tilt devices are being paired or grouped.
|
|
265
|
-
blindTiltDevicesIds?:
|
|
284
|
+
blindTiltDevicesIds?: string[];
|
|
266
285
|
//only available for Curtain/Lock devices. determines if the open position and the close position of a device have been properly calibrated or not
|
|
267
286
|
calibrate?: boolean;
|
|
268
287
|
//only available for Curtain devices. determines if a Curtain is paired with or grouped with another Curtain or not.
|
|
@@ -295,13 +314,9 @@ export type device = {
|
|
|
295
314
|
fanSpeed: number;
|
|
296
315
|
};
|
|
297
316
|
|
|
298
|
-
// values defined but not displayed by API
|
|
299
|
-
export interface deviceInfo extends device {
|
|
300
|
-
}
|
|
301
|
-
|
|
302
317
|
//a list of virtual infrared remote devices.
|
|
303
318
|
export type infraredRemoteList = {
|
|
304
|
-
device:
|
|
319
|
+
device: irdevice[];
|
|
305
320
|
};
|
|
306
321
|
|
|
307
322
|
export type irdevice = {
|
|
@@ -320,51 +335,51 @@ export type deviceStatus = {
|
|
|
320
335
|
|
|
321
336
|
export type deviceStatusBody = {
|
|
322
337
|
//v1.1 of API
|
|
323
|
-
deviceId: string;
|
|
324
|
-
deviceType: string;
|
|
325
|
-
hubDeviceId: string;
|
|
326
|
-
power?: string;
|
|
327
|
-
calibrate?: boolean;
|
|
328
|
-
group?: boolean;
|
|
329
|
-
moving?: boolean;
|
|
330
|
-
slidePosition?: number;
|
|
331
|
-
temperature?: number;
|
|
332
|
-
humidity?: number;
|
|
333
|
-
lockState?: string;
|
|
334
|
-
doorState?: string;
|
|
335
|
-
moveDetected?: boolean;
|
|
336
|
-
brightness?: string | number;
|
|
337
|
-
openState?: string;
|
|
338
|
-
colorTemperature?: number;
|
|
339
|
-
voltage?: number;
|
|
340
|
-
weight?: number;
|
|
341
|
-
electricityOfDay?: number;
|
|
342
|
-
electricCurrent?: number;
|
|
343
|
-
color?: string;
|
|
344
|
-
workingStatus?: string;
|
|
345
|
-
onlineStatus?: string;
|
|
346
|
-
battery?: number;
|
|
347
|
-
deviceName?: string;
|
|
348
|
-
nebulizationEfficiency?: number;
|
|
349
|
-
auto?: boolean;
|
|
350
|
-
childLock?: boolean;
|
|
351
|
-
sound?: boolean;
|
|
352
|
-
lackWater?: boolean;
|
|
353
|
-
version?: number;
|
|
354
|
-
direction?: string;
|
|
355
|
-
runStatus?: string;
|
|
356
|
-
mode?: number | string;
|
|
357
|
-
speed?: number;
|
|
358
|
-
shaking?: boolean;
|
|
359
|
-
shakeCenter?: string;
|
|
360
|
-
shakeRange?: string;
|
|
361
|
-
status?: number
|
|
362
|
-
lightLevel?: number;
|
|
363
|
-
nightStatus: number
|
|
364
|
-
oscillation: string
|
|
365
|
-
verticalOscillation: string
|
|
366
|
-
chargingStatus: string
|
|
367
|
-
fanSpeed: number
|
|
338
|
+
deviceId: string;
|
|
339
|
+
deviceType: string;
|
|
340
|
+
hubDeviceId: string;
|
|
341
|
+
power?: string;
|
|
342
|
+
calibrate?: boolean;
|
|
343
|
+
group?: boolean;
|
|
344
|
+
moving?: boolean;
|
|
345
|
+
slidePosition?: number;
|
|
346
|
+
temperature?: number;
|
|
347
|
+
humidity?: number;
|
|
348
|
+
lockState?: string;
|
|
349
|
+
doorState?: string;
|
|
350
|
+
moveDetected?: boolean;
|
|
351
|
+
brightness?: string | number;
|
|
352
|
+
openState?: string;
|
|
353
|
+
colorTemperature?: number;
|
|
354
|
+
voltage?: number;
|
|
355
|
+
weight?: number;
|
|
356
|
+
electricityOfDay?: number;
|
|
357
|
+
electricCurrent?: number;
|
|
358
|
+
color?: string;
|
|
359
|
+
workingStatus?: string;
|
|
360
|
+
onlineStatus?: string;
|
|
361
|
+
battery?: number;
|
|
362
|
+
deviceName?: string;
|
|
363
|
+
nebulizationEfficiency?: number;
|
|
364
|
+
auto?: boolean;
|
|
365
|
+
childLock?: boolean;
|
|
366
|
+
sound?: boolean;
|
|
367
|
+
lackWater?: boolean;
|
|
368
|
+
version?: number;
|
|
369
|
+
direction?: string;
|
|
370
|
+
runStatus?: string;
|
|
371
|
+
mode?: number | string;
|
|
372
|
+
speed?: number;
|
|
373
|
+
shaking?: boolean;
|
|
374
|
+
shakeCenter?: string;
|
|
375
|
+
shakeRange?: string;
|
|
376
|
+
status?: number;
|
|
377
|
+
lightLevel?: number;
|
|
378
|
+
nightStatus: number;
|
|
379
|
+
oscillation: string;
|
|
380
|
+
verticalOscillation: string;
|
|
381
|
+
chargingStatus: string;
|
|
382
|
+
fanSpeed: number;
|
|
368
383
|
};
|
|
369
384
|
|
|
370
385
|
export type ad = {
|