@switchbot/homebridge-switchbot 2.1.4-beta.0 → 2.2.0-beta.0
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/.github/labeler.yml +2 -2
- package/CHANGELOG.md +9 -0
- package/config.schema.json +30 -11
- package/dist/device/colorbulb.d.ts +6 -0
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +12 -10
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +8 -4
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +45 -19
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +8 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +35 -2
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +8 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +35 -2
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +8 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +42 -11
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +8 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +35 -2
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +8 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +35 -2
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +8 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +42 -11
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +8 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +35 -2
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +8 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +35 -2
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/settings.d.ts +7 -6
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +3 -3
- package/src/device/colorbulb.ts +16 -9
- package/src/irdevice/airconditioner.ts +47 -21
- package/src/irdevice/airpurifier.ts +37 -3
- package/src/irdevice/camera.ts +37 -3
- package/src/irdevice/fan.ts +44 -12
- package/src/irdevice/light.ts +37 -3
- package/src/irdevice/other.ts +37 -3
- package/src/irdevice/tv.ts +44 -12
- package/src/irdevice/vacuumcleaner.ts +37 -3
- package/src/irdevice/waterheater.ts +37 -3
- package/src/settings.ts +8 -6
package/src/irdevice/tv.ts
CHANGED
|
@@ -24,14 +24,17 @@ export class TV {
|
|
|
24
24
|
deviceStatus!: any;
|
|
25
25
|
|
|
26
26
|
// Config
|
|
27
|
+
allowPushOn?: boolean;
|
|
28
|
+
allowPushOff?: boolean;
|
|
27
29
|
deviceLogging!: string;
|
|
28
|
-
allowPush?: boolean;
|
|
29
30
|
|
|
30
31
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
31
32
|
// default placeholders
|
|
32
33
|
this.logs(device);
|
|
33
34
|
this.config(device);
|
|
34
35
|
this.context();
|
|
36
|
+
this.allowPushOnChanges({ device });
|
|
37
|
+
this.allowPushOffChanges({ device });
|
|
35
38
|
|
|
36
39
|
// set accessory information
|
|
37
40
|
accessory
|
|
@@ -227,7 +230,7 @@ export class TV {
|
|
|
227
230
|
* TV "command" "channelSub" "default" previous channel
|
|
228
231
|
*/
|
|
229
232
|
async pushTvOnChanges(): Promise<void> {
|
|
230
|
-
if (this.Active !== 1
|
|
233
|
+
if (this.Active !== 1) {
|
|
231
234
|
const commandType: string = await this.commandType();
|
|
232
235
|
const command: string = await this.commandOn();
|
|
233
236
|
const body = superStringify({
|
|
@@ -240,16 +243,14 @@ export class TV {
|
|
|
240
243
|
}
|
|
241
244
|
|
|
242
245
|
async pushTvOffChanges(): Promise<void> {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
await this.pushTVChanges(body);
|
|
252
|
-
}
|
|
246
|
+
const commandType: string = await this.commandType();
|
|
247
|
+
const command: string = await this.commandOff();
|
|
248
|
+
const body = superStringify({
|
|
249
|
+
'command': command,
|
|
250
|
+
'parameter': 'default',
|
|
251
|
+
'commandType': commandType,
|
|
252
|
+
});
|
|
253
|
+
await this.pushTVChanges(body);
|
|
253
254
|
}
|
|
254
255
|
|
|
255
256
|
async pushOkChanges(): Promise<void> {
|
|
@@ -405,6 +406,22 @@ export class TV {
|
|
|
405
406
|
}
|
|
406
407
|
}
|
|
407
408
|
|
|
409
|
+
async allowPushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
410
|
+
if (device.allowPushOn) {
|
|
411
|
+
this.allowPushOn = true;
|
|
412
|
+
} else {
|
|
413
|
+
this.allowPushOn = false;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
async allowPushOffChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
418
|
+
if (device.allowPushOff) {
|
|
419
|
+
this.allowPushOn = true;
|
|
420
|
+
} else {
|
|
421
|
+
this.allowPushOn = false;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
408
425
|
async commandType(): Promise<string> {
|
|
409
426
|
let commandType: string;
|
|
410
427
|
if (this.device.customize) {
|
|
@@ -510,6 +527,21 @@ export class TV {
|
|
|
510
527
|
if (device.external !== undefined) {
|
|
511
528
|
config['external'] = device.external;
|
|
512
529
|
}
|
|
530
|
+
if (device.customOn !== undefined) {
|
|
531
|
+
config['customOn'] = device.customOn;
|
|
532
|
+
}
|
|
533
|
+
if (device.customOff !== undefined) {
|
|
534
|
+
config['customOff'] = device.customOff;
|
|
535
|
+
}
|
|
536
|
+
if (device.customize !== undefined) {
|
|
537
|
+
config['customize'] = device.customize;
|
|
538
|
+
}
|
|
539
|
+
if (device.allowPushOn !== undefined) {
|
|
540
|
+
config['allowPushOn'] = device.allowPushOn;
|
|
541
|
+
}
|
|
542
|
+
if (device.allowPushOff !== undefined) {
|
|
543
|
+
config['allowPushOff'] = device.allowPushOff;
|
|
544
|
+
}
|
|
513
545
|
if (Object.entries(config).length !== 0) {
|
|
514
546
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
515
547
|
}
|
|
@@ -19,14 +19,17 @@ export class VacuumCleaner {
|
|
|
19
19
|
On!: CharacteristicValue;
|
|
20
20
|
|
|
21
21
|
// Config
|
|
22
|
+
allowPushOn?: boolean;
|
|
23
|
+
allowPushOff?: boolean;
|
|
22
24
|
deviceLogging!: string;
|
|
23
|
-
allowPush?: boolean;
|
|
24
25
|
|
|
25
26
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
26
27
|
// default placeholders
|
|
27
28
|
this.logs(device);
|
|
28
29
|
this.config(device);
|
|
29
30
|
this.context();
|
|
31
|
+
this.allowPushOnChanges({ device });
|
|
32
|
+
this.allowPushOffChanges({ device });
|
|
30
33
|
|
|
31
34
|
// set accessory information
|
|
32
35
|
accessory
|
|
@@ -77,7 +80,7 @@ export class VacuumCleaner {
|
|
|
77
80
|
* Vacuum Cleaner "command" "turnOn" "default" set to ON state
|
|
78
81
|
*/
|
|
79
82
|
async pushOnChanges(): Promise<void> {
|
|
80
|
-
if (this.On
|
|
83
|
+
if (this.On) {
|
|
81
84
|
const commandType: string = await this.commandType();
|
|
82
85
|
const command: string = await this.commandOn();
|
|
83
86
|
const body = superStringify({
|
|
@@ -90,7 +93,7 @@ export class VacuumCleaner {
|
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
async pushOffChanges(): Promise<void> {
|
|
93
|
-
if (!this.On
|
|
96
|
+
if (!this.On) {
|
|
94
97
|
const commandType: string = await this.commandType();
|
|
95
98
|
const command: string = await this.commandOff();
|
|
96
99
|
const body = superStringify({
|
|
@@ -166,6 +169,22 @@ export class VacuumCleaner {
|
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
|
|
172
|
+
async allowPushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
173
|
+
if (device.allowPushOn) {
|
|
174
|
+
this.allowPushOn = true;
|
|
175
|
+
} else {
|
|
176
|
+
this.allowPushOn = false;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async allowPushOffChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
181
|
+
if (device.allowPushOff) {
|
|
182
|
+
this.allowPushOn = true;
|
|
183
|
+
} else {
|
|
184
|
+
this.allowPushOn = false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
169
188
|
async commandType(): Promise<string> {
|
|
170
189
|
let commandType: string;
|
|
171
190
|
if (this.device.customize) {
|
|
@@ -269,6 +288,21 @@ export class VacuumCleaner {
|
|
|
269
288
|
if (device.external !== undefined) {
|
|
270
289
|
config['external'] = device.external;
|
|
271
290
|
}
|
|
291
|
+
if (device.customOn !== undefined) {
|
|
292
|
+
config['customOn'] = device.customOn;
|
|
293
|
+
}
|
|
294
|
+
if (device.customOff !== undefined) {
|
|
295
|
+
config['customOff'] = device.customOff;
|
|
296
|
+
}
|
|
297
|
+
if (device.customize !== undefined) {
|
|
298
|
+
config['customize'] = device.customize;
|
|
299
|
+
}
|
|
300
|
+
if (device.allowPushOn !== undefined) {
|
|
301
|
+
config['allowPushOn'] = device.allowPushOn;
|
|
302
|
+
}
|
|
303
|
+
if (device.allowPushOff !== undefined) {
|
|
304
|
+
config['allowPushOff'] = device.allowPushOff;
|
|
305
|
+
}
|
|
272
306
|
if (Object.entries(config).length !== 0) {
|
|
273
307
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
274
308
|
}
|
|
@@ -20,14 +20,17 @@ export class WaterHeater {
|
|
|
20
20
|
Active!: CharacteristicValue;
|
|
21
21
|
|
|
22
22
|
// Config
|
|
23
|
+
allowPushOn?: boolean;
|
|
24
|
+
allowPushOff?: boolean;
|
|
23
25
|
deviceLogging!: string;
|
|
24
|
-
allowPush?: boolean;
|
|
25
26
|
|
|
26
27
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
27
28
|
// default placeholders
|
|
28
29
|
this.logs({ device });
|
|
29
30
|
this.config({ device });
|
|
30
31
|
this.context();
|
|
32
|
+
this.allowPushOnChanges({ device });
|
|
33
|
+
this.allowPushOffChanges({ device });
|
|
31
34
|
|
|
32
35
|
// set accessory information
|
|
33
36
|
accessory
|
|
@@ -83,7 +86,7 @@ export class WaterHeater {
|
|
|
83
86
|
* WaterHeater "command" "turnOn" "default" set to ON state
|
|
84
87
|
*/
|
|
85
88
|
async pushWaterHeaterOnChanges(): Promise<void> {
|
|
86
|
-
if (this.Active !== 1
|
|
89
|
+
if (this.Active !== 1) {
|
|
87
90
|
const commandType: string = await this.commandType();
|
|
88
91
|
const command: string = await this.commandOn();
|
|
89
92
|
const body = superStringify({
|
|
@@ -96,7 +99,7 @@ export class WaterHeater {
|
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
async pushWaterHeaterOffChanges(): Promise<void> {
|
|
99
|
-
if (this.Active !== 0
|
|
102
|
+
if (this.Active !== 0) {
|
|
100
103
|
const commandType: string = await this.commandType();
|
|
101
104
|
const command: string = await this.commandOff();
|
|
102
105
|
const body = superStringify({
|
|
@@ -174,6 +177,22 @@ export class WaterHeater {
|
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
179
|
|
|
180
|
+
async allowPushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
181
|
+
if (device.allowPushOn) {
|
|
182
|
+
this.allowPushOn = true;
|
|
183
|
+
} else {
|
|
184
|
+
this.allowPushOn = false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async allowPushOffChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
189
|
+
if (device.allowPushOff) {
|
|
190
|
+
this.allowPushOn = true;
|
|
191
|
+
} else {
|
|
192
|
+
this.allowPushOn = false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
177
196
|
async commandType(): Promise<string> {
|
|
178
197
|
let commandType: string;
|
|
179
198
|
if (this.device.customize) {
|
|
@@ -279,6 +298,21 @@ export class WaterHeater {
|
|
|
279
298
|
if (device.external !== undefined) {
|
|
280
299
|
config['external'] = device.external;
|
|
281
300
|
}
|
|
301
|
+
if (device.customOn !== undefined) {
|
|
302
|
+
config['customOn'] = device.customOn;
|
|
303
|
+
}
|
|
304
|
+
if (device.customOff !== undefined) {
|
|
305
|
+
config['customOff'] = device.customOff;
|
|
306
|
+
}
|
|
307
|
+
if (device.customize !== undefined) {
|
|
308
|
+
config['customize'] = device.customize;
|
|
309
|
+
}
|
|
310
|
+
if (device.allowPushOn !== undefined) {
|
|
311
|
+
config['allowPushOn'] = device.allowPushOn;
|
|
312
|
+
}
|
|
313
|
+
if (device.allowPushOff !== undefined) {
|
|
314
|
+
config['allowPushOff'] = device.allowPushOff;
|
|
315
|
+
}
|
|
282
316
|
if (Object.entries(config).length !== 0) {
|
|
283
317
|
this.infoLog({ log: [`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`] });
|
|
284
318
|
}
|
package/src/settings.ts
CHANGED
|
@@ -131,16 +131,17 @@ export type lock = {
|
|
|
131
131
|
|
|
132
132
|
export interface irDevicesConfig extends irdevice {
|
|
133
133
|
configRemoteType?: string;
|
|
134
|
-
|
|
134
|
+
connectionType?: string;
|
|
135
|
+
hide_device?: boolean;
|
|
135
136
|
external?: boolean;
|
|
136
137
|
firmware?: string;
|
|
138
|
+
deviceId: string;
|
|
137
139
|
logging?: string;
|
|
138
|
-
connectionType?: string;
|
|
139
|
-
hide_device?: boolean;
|
|
140
|
-
customize?: boolean;
|
|
141
140
|
customOn?: string;
|
|
142
141
|
customOff?: string;
|
|
143
|
-
|
|
142
|
+
customize?: boolean;
|
|
143
|
+
allowPushOn?: boolean;
|
|
144
|
+
allowPushOff?: boolean;
|
|
144
145
|
irfan?: irfan;
|
|
145
146
|
irair?: irair;
|
|
146
147
|
irpur?: Record<any, any>;
|
|
@@ -180,7 +181,6 @@ export type set_min = {
|
|
|
180
181
|
|
|
181
182
|
export type irair = {
|
|
182
183
|
hide_automode?: boolean;
|
|
183
|
-
pushOn?: boolean;
|
|
184
184
|
};
|
|
185
185
|
|
|
186
186
|
export type irtv = {
|
|
@@ -355,6 +355,8 @@ export type serviceData = {
|
|
|
355
355
|
overload?: boolean;
|
|
356
356
|
//PlugMini - Plug Mini current power value of the load
|
|
357
357
|
currentPower?: number;
|
|
358
|
+
//Color Bulb's brightness level
|
|
359
|
+
brightness?: boolean | string;
|
|
358
360
|
};
|
|
359
361
|
|
|
360
362
|
export type temperature = {
|