@switchbot/homebridge-switchbot 2.1.3-beta.1 → 2.1.4-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.
Files changed (47) hide show
  1. package/.github/labeler.yml +2 -2
  2. package/config.schema.json +9 -18
  3. package/dist/irdevice/airpurifier.d.ts +1 -0
  4. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  5. package/dist/irdevice/airpurifier.js +2 -2
  6. package/dist/irdevice/airpurifier.js.map +1 -1
  7. package/dist/irdevice/camera.d.ts +1 -0
  8. package/dist/irdevice/camera.d.ts.map +1 -1
  9. package/dist/irdevice/camera.js +2 -2
  10. package/dist/irdevice/camera.js.map +1 -1
  11. package/dist/irdevice/fan.d.ts +1 -0
  12. package/dist/irdevice/fan.d.ts.map +1 -1
  13. package/dist/irdevice/fan.js +11 -9
  14. package/dist/irdevice/fan.js.map +1 -1
  15. package/dist/irdevice/light.d.ts +1 -0
  16. package/dist/irdevice/light.d.ts.map +1 -1
  17. package/dist/irdevice/light.js +2 -2
  18. package/dist/irdevice/light.js.map +1 -1
  19. package/dist/irdevice/other.d.ts +1 -0
  20. package/dist/irdevice/other.d.ts.map +1 -1
  21. package/dist/irdevice/other.js +2 -2
  22. package/dist/irdevice/other.js.map +1 -1
  23. package/dist/irdevice/tv.d.ts +1 -0
  24. package/dist/irdevice/tv.d.ts.map +1 -1
  25. package/dist/irdevice/tv.js +11 -9
  26. package/dist/irdevice/tv.js.map +1 -1
  27. package/dist/irdevice/vacuumcleaner.d.ts +1 -0
  28. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  29. package/dist/irdevice/vacuumcleaner.js +2 -2
  30. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  31. package/dist/irdevice/waterheater.d.ts +1 -0
  32. package/dist/irdevice/waterheater.d.ts.map +1 -1
  33. package/dist/irdevice/waterheater.js +2 -2
  34. package/dist/irdevice/waterheater.js.map +1 -1
  35. package/dist/settings.d.ts +1 -0
  36. package/dist/settings.d.ts.map +1 -1
  37. package/dist/settings.js.map +1 -1
  38. package/package.json +1 -1
  39. package/src/irdevice/airpurifier.ts +3 -2
  40. package/src/irdevice/camera.ts +3 -2
  41. package/src/irdevice/fan.ts +12 -9
  42. package/src/irdevice/light.ts +3 -2
  43. package/src/irdevice/other.ts +3 -2
  44. package/src/irdevice/tv.ts +12 -9
  45. package/src/irdevice/vacuumcleaner.ts +3 -2
  46. package/src/irdevice/waterheater.ts +3 -2
  47. package/src/settings.ts +1 -0
@@ -38,6 +38,7 @@ export class AirPurifier {
38
38
 
39
39
  // Config
40
40
  deviceLogging!: string;
41
+ allowPush?: boolean;
41
42
 
42
43
  constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
43
44
  // default placeholders
@@ -130,7 +131,7 @@ export class AirPurifier {
130
131
  * AirPurifier: "command" "highSpeed" "default" = fan speed to high
131
132
  */
132
133
  async pushAirPurifierOnChanges(): Promise<void> {
133
- if (this.Active !== 1) {
134
+ if (this.Active !== 1 || this.allowPush) {
134
135
  const commandType: string = await this.commandType();
135
136
  const command: string = await this.commandOn();
136
137
  const body = superStringify({
@@ -145,7 +146,7 @@ export class AirPurifier {
145
146
  async pushAirPurifierOffChanges(): Promise<void> {
146
147
  const commandType: string = await this.commandType();
147
148
  const command: string = await this.commandOff();
148
- if (this.Active !== 0) {
149
+ if (this.Active !== 0 || this.allowPush) {
149
150
  const body = superStringify({
150
151
  'command': command,
151
152
  'parameter': 'default',
@@ -20,6 +20,7 @@ export class Camera {
20
20
 
21
21
  // Config
22
22
  deviceLogging!: string;
23
+ allowPush?: boolean;
23
24
 
24
25
  constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
25
26
  // default placeholders
@@ -80,7 +81,7 @@ export class Camera {
80
81
  * Camera - "command" "channelSub" "default" = previous channel
81
82
  */
82
83
  async pushOnChanges(): Promise<void> {
83
- if (this.On) {
84
+ if (this.On || this.allowPush) {
84
85
  const commandType: string = await this.commandType();
85
86
  const command: string = await this.commandOn();
86
87
  const body = superStringify({
@@ -95,7 +96,7 @@ export class Camera {
95
96
  async pushOffChanges(): Promise<void> {
96
97
  const commandType: string = await this.commandType();
97
98
  const command: string = await this.commandOff();
98
- if (!this.On) {
99
+ if (!this.On || this.allowPush) {
99
100
  const body = superStringify({
100
101
  'command': command,
101
102
  'parameter': 'default',
@@ -30,6 +30,7 @@ export class Fan {
30
30
  minValue?: number;
31
31
  maxValue?: number;
32
32
  deviceLogging!: string;
33
+ allowPush?: boolean;
33
34
 
34
35
  constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
35
36
  // default placeholders
@@ -170,7 +171,7 @@ export class Fan {
170
171
  * Fan - "command" "highSpeed" "default" = fan speed to high
171
172
  */
172
173
  async pushFanOnChanges(): Promise<void> {
173
- if (this.Active !== 1) {
174
+ if (this.Active !== 1 || this.allowPush) {
174
175
  const commandType: string = await this.commandType();
175
176
  const command: string = await this.commandOn();
176
177
  const body = superStringify({
@@ -183,14 +184,16 @@ export class Fan {
183
184
  }
184
185
 
185
186
  async pushFanOffChanges(): Promise<void> {
186
- const commandType: string = await this.commandType();
187
- const command: string = await this.commandOff();
188
- const body = superStringify({
189
- 'command': command,
190
- 'parameter': 'default',
191
- 'commandType': commandType,
192
- });
193
- await this.pushTVChanges(body);
187
+ if (this.Active === 1 || this.allowPush) {
188
+ const commandType: string = await this.commandType();
189
+ const command: string = await this.commandOff();
190
+ const body = superStringify({
191
+ 'command': command,
192
+ 'parameter': 'default',
193
+ 'commandType': commandType,
194
+ });
195
+ await this.pushTVChanges(body);
196
+ }
194
197
  }
195
198
 
196
199
  async pushFanSpeedUpChanges(): Promise<void> {
@@ -20,6 +20,7 @@ export class Light {
20
20
 
21
21
  // Config
22
22
  deviceLogging!: string;
23
+ allowPush?: boolean;
23
24
 
24
25
  constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
25
26
  // default placeholders
@@ -80,7 +81,7 @@ export class Light {
80
81
  * Light - "command" "channelSub" "default" = previous channel
81
82
  */
82
83
  async pushLightOnChanges(): Promise<void> {
83
- if (this.On) {
84
+ if (this.On || this.allowPush) {
84
85
  const commandType: string = await this.commandType();
85
86
  const command: string = await this.commandOn();
86
87
  const body = superStringify({
@@ -93,7 +94,7 @@ export class Light {
93
94
  }
94
95
 
95
96
  async pushLightOffChanges(): Promise<void> {
96
- if (!this.On) {
97
+ if (!this.On || this.allowPush) {
97
98
  const commandType: string = await this.commandType();
98
99
  const command: string = await this.commandOff();
99
100
  const body = superStringify({
@@ -21,6 +21,7 @@ export class Others {
21
21
  // Config
22
22
  deviceLogging!: string;
23
23
  otherDeviceType?: string;
24
+ allowPush?: boolean;
24
25
 
25
26
  constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
26
27
  // default placeholders
@@ -89,7 +90,7 @@ export class Others {
89
90
  */
90
91
  async pushOnChanges(): Promise<void> {
91
92
  if (this.device.customize) {
92
- if (!this.Active) {
93
+ if (!this.Active || this.allowPush) {
93
94
  const commandType: string = await this.commandType();
94
95
  const command: string = await this.commandOn();
95
96
  const body = superStringify({
@@ -106,7 +107,7 @@ export class Others {
106
107
 
107
108
  async pushOffChanges(): Promise<void> {
108
109
  if (this.device.customize) {
109
- if (this.Active) {
110
+ if (this.Active || this.allowPush) {
110
111
  const commandType: string = await this.commandType();
111
112
  const command: string = await this.commandOff();
112
113
  const body = superStringify({
@@ -25,6 +25,7 @@ export class TV {
25
25
 
26
26
  // Config
27
27
  deviceLogging!: string;
28
+ allowPush?: boolean;
28
29
 
29
30
  constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
30
31
  // default placeholders
@@ -226,7 +227,7 @@ export class TV {
226
227
  * TV "command" "channelSub" "default" previous channel
227
228
  */
228
229
  async pushTvOnChanges(): Promise<void> {
229
- if (this.Active !== 1) {
230
+ if (this.Active !== 1 || this.allowPush) {
230
231
  const commandType: string = await this.commandType();
231
232
  const command: string = await this.commandOn();
232
233
  const body = superStringify({
@@ -239,14 +240,16 @@ export class TV {
239
240
  }
240
241
 
241
242
  async pushTvOffChanges(): Promise<void> {
242
- const commandType: string = await this.commandType();
243
- const command: string = await this.commandOff();
244
- const body = superStringify({
245
- 'command': command,
246
- 'parameter': 'default',
247
- 'commandType': commandType,
248
- });
249
- await this.pushTVChanges(body);
243
+ if (this.Active === 1 || this.allowPush) {
244
+ const commandType: string = await this.commandType();
245
+ const command: string = await this.commandOff();
246
+ const body = superStringify({
247
+ 'command': command,
248
+ 'parameter': 'default',
249
+ 'commandType': commandType,
250
+ });
251
+ await this.pushTVChanges(body);
252
+ }
250
253
  }
251
254
 
252
255
  async pushOkChanges(): Promise<void> {
@@ -20,6 +20,7 @@ export class VacuumCleaner {
20
20
 
21
21
  // Config
22
22
  deviceLogging!: string;
23
+ allowPush?: boolean;
23
24
 
24
25
  constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
25
26
  // default placeholders
@@ -76,7 +77,7 @@ export class VacuumCleaner {
76
77
  * Vacuum Cleaner "command" "turnOn" "default" set to ON state
77
78
  */
78
79
  async pushOnChanges(): Promise<void> {
79
- if (this.On) {
80
+ if (this.On || this.allowPush) {
80
81
  const commandType: string = await this.commandType();
81
82
  const command: string = await this.commandOn();
82
83
  const body = superStringify({
@@ -89,7 +90,7 @@ export class VacuumCleaner {
89
90
  }
90
91
 
91
92
  async pushOffChanges(): Promise<void> {
92
- if (!this.On) {
93
+ if (!this.On || this.allowPush) {
93
94
  const commandType: string = await this.commandType();
94
95
  const command: string = await this.commandOff();
95
96
  const body = superStringify({
@@ -21,6 +21,7 @@ export class WaterHeater {
21
21
 
22
22
  // Config
23
23
  deviceLogging!: string;
24
+ allowPush?: boolean;
24
25
 
25
26
  constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
26
27
  // default placeholders
@@ -82,7 +83,7 @@ export class WaterHeater {
82
83
  * WaterHeater "command" "turnOn" "default" set to ON state
83
84
  */
84
85
  async pushWaterHeaterOnChanges(): Promise<void> {
85
- if (this.Active !== 1) {
86
+ if (this.Active !== 1 || this.allowPush) {
86
87
  const commandType: string = await this.commandType();
87
88
  const command: string = await this.commandOn();
88
89
  const body = superStringify({
@@ -95,7 +96,7 @@ export class WaterHeater {
95
96
  }
96
97
 
97
98
  async pushWaterHeaterOffChanges(): Promise<void> {
98
- if (this.Active !== 0) {
99
+ if (this.Active !== 0 || this.allowPush) {
99
100
  const commandType: string = await this.commandType();
100
101
  const command: string = await this.commandOff();
101
102
  const body = superStringify({
package/src/settings.ts CHANGED
@@ -140,6 +140,7 @@ export interface irDevicesConfig extends irdevice {
140
140
  customize?: boolean;
141
141
  customOn?: string;
142
142
  customOff?: string;
143
+ allowPush?: boolean;
143
144
  irfan?: irfan;
144
145
  irair?: irair;
145
146
  irpur?: Record<any, any>;