@switchbot/homebridge-switchbot 4.1.4-beta.2 → 4.1.5

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 (59) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/device/bot.d.ts.map +1 -1
  3. package/dist/device/bot.js +3 -3
  4. package/dist/device/bot.js.map +1 -1
  5. package/dist/device/curtain.d.ts.map +1 -1
  6. package/dist/device/curtain.js +3 -3
  7. package/dist/device/curtain.js.map +1 -1
  8. package/dist/device/device.d.ts +1 -1
  9. package/dist/device/device.js +2 -2
  10. package/dist/device/device.js.map +1 -1
  11. package/dist/irdevice/airconditioner.js +9 -9
  12. package/dist/irdevice/airconditioner.js.map +1 -1
  13. package/dist/irdevice/airpurifier.js +6 -6
  14. package/dist/irdevice/airpurifier.js.map +1 -1
  15. package/dist/irdevice/camera.js +4 -4
  16. package/dist/irdevice/camera.js.map +1 -1
  17. package/dist/irdevice/fan.js +4 -4
  18. package/dist/irdevice/fan.js.map +1 -1
  19. package/dist/irdevice/irdevice.d.ts +9 -6
  20. package/dist/irdevice/irdevice.d.ts.map +1 -1
  21. package/dist/irdevice/irdevice.js +39 -29
  22. package/dist/irdevice/irdevice.js.map +1 -1
  23. package/dist/irdevice/light.js +4 -4
  24. package/dist/irdevice/light.js.map +1 -1
  25. package/dist/irdevice/other.js +4 -4
  26. package/dist/irdevice/other.js.map +1 -1
  27. package/dist/irdevice/tv.js +22 -22
  28. package/dist/irdevice/tv.js.map +1 -1
  29. package/dist/irdevice/vacuumcleaner.js +4 -4
  30. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  31. package/dist/irdevice/waterheater.js +4 -4
  32. package/dist/irdevice/waterheater.js.map +1 -1
  33. package/dist/settings.d.ts +5 -0
  34. package/dist/settings.d.ts.map +1 -1
  35. package/dist/settings.js.map +1 -1
  36. package/docs/assets/hierarchy.js +1 -0
  37. package/docs/assets/icons.js +1 -1
  38. package/docs/assets/icons.svg +1 -1
  39. package/docs/assets/main.js +5 -5
  40. package/docs/assets/style.css +1391 -1288
  41. package/docs/functions/default.html +1 -1
  42. package/docs/index.html +14 -14
  43. package/docs/modules.html +1 -2
  44. package/package.json +10 -10
  45. package/src/device/bot.ts +4 -5
  46. package/src/device/curtain.ts +4 -5
  47. package/src/device/device.ts +2 -2
  48. package/src/irdevice/airconditioner.ts +9 -9
  49. package/src/irdevice/airpurifier.ts +6 -6
  50. package/src/irdevice/camera.ts +4 -4
  51. package/src/irdevice/fan.ts +4 -4
  52. package/src/irdevice/irdevice.ts +42 -30
  53. package/src/irdevice/light.ts +4 -4
  54. package/src/irdevice/other.ts +4 -4
  55. package/src/irdevice/tv.ts +22 -22
  56. package/src/irdevice/vacuumcleaner.ts +4 -4
  57. package/src/irdevice/waterheater.ts +4 -4
  58. package/src/settings.ts +5 -0
  59. package/.github/npm-version-script.cjs +0 -81
@@ -166,8 +166,8 @@ export class Light extends irdeviceBase {
166
166
  * Light - "command" "channelSub" "default" = previous channel
167
167
  */
168
168
  async pushLightOnChanges(On: boolean): Promise<void> {
169
- this.debugLog(`pushLightOnChanges On: ${On}, disablePushOn: ${this.disablePushOn}`)
170
- if (On === true && this.disablePushOn === false) {
169
+ this.debugLog(`pushLightOnChanges On: ${On}, disablePushOn: ${this.deviceDisablePushOn}`)
170
+ if (On === true && this.deviceDisablePushOn === false) {
171
171
  const commandType: string = await this.commandType()
172
172
  const command: string = await this.commandOn()
173
173
  const bodyChange: bodyChange = {
@@ -180,8 +180,8 @@ export class Light extends irdeviceBase {
180
180
  }
181
181
 
182
182
  async pushLightOffChanges(On: boolean): Promise<void> {
183
- this.debugLog(`pushLightOffChanges On: ${On}, disablePushOff: ${this.disablePushOff}`)
184
- if (On === false && this.disablePushOff === false) {
183
+ this.debugLog(`pushLightOffChanges On: ${On}, disablePushOff: ${this.deviceDisablePushOff}`)
184
+ if (On === false && this.deviceDisablePushOff === false) {
185
185
  const commandType: string = await this.commandType()
186
186
  const command: string = await this.commandOff()
187
187
  const bodyChange: bodyChange = {
@@ -407,9 +407,9 @@ export class Others extends irdeviceBase {
407
407
  * Other - "command" "channelSub" "default" = previous channel
408
408
  */
409
409
  async pushOnChanges(On: boolean): Promise<void> {
410
- this.debugLog(`pushOnChanges On: ${On}, disablePushOn: ${this.disablePushOn}, customize: ${this.device.customize}, customOn: ${this.device.customOn}`)
410
+ this.debugLog(`pushOnChanges On: ${On}, disablePushOn: ${this.deviceDisablePushOn}, customize: ${this.device.customize}, customOn: ${this.device.customOn}`)
411
411
  if (this.device.customize) {
412
- if (On === true && !this.disablePushOn) {
412
+ if (On === true && !this.deviceDisablePushOn) {
413
413
  const commandType: string = await this.commandType()
414
414
  const command: string = await this.commandOn()
415
415
  const bodyChange: bodyChange = {
@@ -425,9 +425,9 @@ export class Others extends irdeviceBase {
425
425
  }
426
426
 
427
427
  async pushOffChanges(On: boolean): Promise<void> {
428
- this.debugLog(`pushOffChanges On: ${On}, disablePushOff: ${this.disablePushOff}, customize: ${this.device.customize}, customOff: ${this.device.customOff}`)
428
+ this.debugLog(`pushOffChanges On: ${On}, disablePushOff: ${this.deviceDisablePushOff}, customize: ${this.device.customize}, customOff: ${this.device.customOff}`)
429
429
  if (this.device.customize) {
430
- if (On === false && !this.disablePushOff) {
430
+ if (On === false && !this.deviceDisablePushOff) {
431
431
  const commandType: string = await this.commandType()
432
432
  const command: string = await this.commandOff()
433
433
  const bodyChange: bodyChange = {
@@ -206,8 +206,8 @@ export class TV extends irdeviceBase {
206
206
  * TV "command" "channelSub" "default" previous channel
207
207
  */
208
208
  async pushTvOnChanges(): Promise<void> {
209
- this.debugLog(`pushTvOnChanges Active: ${this.Television.Active}, disablePushOn: ${this.disablePushOn}`)
210
- if (this.Television.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
209
+ this.debugLog(`pushTvOnChanges Active: ${this.Television.Active}, disablePushOn: ${this.deviceDisablePushOn}`)
210
+ if (this.Television.Active === this.hap.Characteristic.Active.ACTIVE && !this.deviceDisablePushOn) {
211
211
  const commandType: string = await this.commandType()
212
212
  const command: string = await this.commandOn()
213
213
  const bodyChange: bodyChange = {
@@ -220,8 +220,8 @@ export class TV extends irdeviceBase {
220
220
  }
221
221
 
222
222
  async pushTvOffChanges(): Promise<void> {
223
- this.debugLog(`pushTvOffChanges Active: ${this.Television.Active}, disablePushOff: ${this.disablePushOff}`)
224
- if (this.Television.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
223
+ this.debugLog(`pushTvOffChanges Active: ${this.Television.Active}, disablePushOff: ${this.deviceDisablePushOff}`)
224
+ if (this.Television.Active === this.hap.Characteristic.Active.INACTIVE && !this.deviceDisablePushOff) {
225
225
  const commandType: string = await this.commandType()
226
226
  const command: string = await this.commandOff()
227
227
  const bodyChange: bodyChange = {
@@ -234,8 +234,8 @@ export class TV extends irdeviceBase {
234
234
  }
235
235
 
236
236
  async pushOkChanges(): Promise<void> {
237
- this.debugLog(`pushOkChanges disablePushDetail: ${this.disablePushDetail}`)
238
- if (!this.disablePushDetail) {
237
+ this.debugLog(`pushOkChanges disablePushDetail: ${this.deviceDisablePushDetail}`)
238
+ if (!this.deviceDisablePushDetail) {
239
239
  const bodyChange: bodyChange = {
240
240
  command: 'Ok',
241
241
  parameter: 'default',
@@ -246,8 +246,8 @@ export class TV extends irdeviceBase {
246
246
  }
247
247
 
248
248
  async pushBackChanges(): Promise<void> {
249
- this.debugLog(`pushBackChanges disablePushDetail: ${this.disablePushDetail}`)
250
- if (!this.disablePushDetail) {
249
+ this.debugLog(`pushBackChanges disablePushDetail: ${this.deviceDisablePushDetail}`)
250
+ if (!this.deviceDisablePushDetail) {
251
251
  const bodyChange: bodyChange = {
252
252
  command: 'Back',
253
253
  parameter: 'default',
@@ -258,8 +258,8 @@ export class TV extends irdeviceBase {
258
258
  }
259
259
 
260
260
  async pushMenuChanges(): Promise<void> {
261
- this.debugLog(`pushMenuChanges disablePushDetail: ${this.disablePushDetail}`)
262
- if (!this.disablePushDetail) {
261
+ this.debugLog(`pushMenuChanges disablePushDetail: ${this.deviceDisablePushDetail}`)
262
+ if (!this.deviceDisablePushDetail) {
263
263
  const bodyChange: bodyChange = {
264
264
  command: 'Menu',
265
265
  parameter: 'default',
@@ -270,8 +270,8 @@ export class TV extends irdeviceBase {
270
270
  }
271
271
 
272
272
  async pushUpChanges(): Promise<void> {
273
- this.debugLog(`pushUpChanges disablePushDetail: ${this.disablePushDetail}`)
274
- if (!this.disablePushDetail) {
273
+ this.debugLog(`pushUpChanges disablePushDetail: ${this.deviceDisablePushDetail}`)
274
+ if (!this.deviceDisablePushDetail) {
275
275
  const bodyChange: bodyChange = {
276
276
  command: 'Up',
277
277
  parameter: 'default',
@@ -282,8 +282,8 @@ export class TV extends irdeviceBase {
282
282
  }
283
283
 
284
284
  async pushDownChanges(): Promise<void> {
285
- this.debugLog(`pushDownChanges disablePushDetail: ${this.disablePushDetail}`)
286
- if (!this.disablePushDetail) {
285
+ this.debugLog(`pushDownChanges disablePushDetail: ${this.deviceDisablePushDetail}`)
286
+ if (!this.deviceDisablePushDetail) {
287
287
  const bodyChange: bodyChange = {
288
288
  command: 'Down',
289
289
  parameter: 'default',
@@ -294,8 +294,8 @@ export class TV extends irdeviceBase {
294
294
  }
295
295
 
296
296
  async pushRightChanges(): Promise<void> {
297
- this.debugLog(`pushRightChanges disablePushDetail: ${this.disablePushDetail}`)
298
- if (!this.disablePushDetail) {
297
+ this.debugLog(`pushRightChanges disablePushDetail: ${this.deviceDisablePushDetail}`)
298
+ if (!this.deviceDisablePushDetail) {
299
299
  const bodyChange: bodyChange = {
300
300
  command: 'Right',
301
301
  parameter: 'default',
@@ -306,8 +306,8 @@ export class TV extends irdeviceBase {
306
306
  }
307
307
 
308
308
  async pushLeftChanges(): Promise<void> {
309
- this.debugLog(`pushLeftChanges disablePushDetail: ${this.disablePushDetail}`)
310
- if (!this.disablePushDetail) {
309
+ this.debugLog(`pushLeftChanges disablePushDetail: ${this.deviceDisablePushDetail}`)
310
+ if (!this.deviceDisablePushDetail) {
311
311
  const bodyChange: bodyChange = {
312
312
  command: 'Left',
313
313
  parameter: 'default',
@@ -318,8 +318,8 @@ export class TV extends irdeviceBase {
318
318
  }
319
319
 
320
320
  async pushVolumeUpChanges(): Promise<void> {
321
- this.debugLog(`pushVolumeUpChanges disablePushDetail: ${this.disablePushDetail}`)
322
- if (!this.disablePushDetail) {
321
+ this.debugLog(`pushVolumeUpChanges disablePushDetail: ${this.deviceDisablePushDetail}`)
322
+ if (!this.deviceDisablePushDetail) {
323
323
  const bodyChange: bodyChange = {
324
324
  command: 'volumeAdd',
325
325
  parameter: 'default',
@@ -330,8 +330,8 @@ export class TV extends irdeviceBase {
330
330
  }
331
331
 
332
332
  async pushVolumeDownChanges(): Promise<void> {
333
- this.debugLog(`pushVolumeDownChanges disablePushDetail: ${this.disablePushDetail}`)
334
- if (!this.disablePushDetail) {
333
+ this.debugLog(`pushVolumeDownChanges disablePushDetail: ${this.deviceDisablePushDetail}`)
334
+ if (!this.deviceDisablePushDetail) {
335
335
  const bodyChange: bodyChange = {
336
336
  command: 'volumeSub',
337
337
  parameter: 'default',
@@ -65,8 +65,8 @@ export class VacuumCleaner extends irdeviceBase {
65
65
  * Vacuum Cleaner "command" "turnOn" "default" set to ON state
66
66
  */
67
67
  async pushOnChanges(): Promise<void> {
68
- this.debugLog(`pushOnChanges On: ${this.Switch.On}, disablePushOn: ${this.disablePushOn}`)
69
- if (this.Switch.On && !this.disablePushOn) {
68
+ this.debugLog(`pushOnChanges On: ${this.Switch.On}, disablePushOn: ${this.deviceDisablePushOn}`)
69
+ if (this.Switch.On && !this.deviceDisablePushOn) {
70
70
  const commandType: string = await this.commandType()
71
71
  const command: string = await this.commandOn()
72
72
  const bodyChange: bodyChange = {
@@ -79,8 +79,8 @@ export class VacuumCleaner extends irdeviceBase {
79
79
  }
80
80
 
81
81
  async pushOffChanges(): Promise<void> {
82
- this.debugLog(`pushOffChanges On: ${this.Switch.On}, disablePushOff: ${this.disablePushOff}`)
83
- if (!this.Switch.On && !this.disablePushOff) {
82
+ this.debugLog(`pushOffChanges On: ${this.Switch.On}, disablePushOff: ${this.deviceDisablePushOff}`)
83
+ if (!this.Switch.On && !this.deviceDisablePushOff) {
84
84
  const commandType: string = await this.commandType()
85
85
  const command: string = await this.commandOff()
86
86
  const bodyChange: bodyChange = {
@@ -66,8 +66,8 @@ export class WaterHeater extends irdeviceBase {
66
66
  * WaterHeater "command" "turnOn" "default" set to ON state
67
67
  */
68
68
  async pushWaterHeaterOnChanges(): Promise<void> {
69
- this.debugLog(`pushWaterHeaterOnChanges Active: ${this.Valve.Active}, disablePushOn: ${this.disablePushOn}`)
70
- if (this.Valve.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
69
+ this.debugLog(`pushWaterHeaterOnChanges Active: ${this.Valve.Active}, disablePushOn: ${this.deviceDisablePushOn}`)
70
+ if (this.Valve.Active === this.hap.Characteristic.Active.ACTIVE && !this.deviceDisablePushOn) {
71
71
  const commandType: string = await this.commandType()
72
72
  const command: string = await this.commandOn()
73
73
  const bodyChange: bodyChange = {
@@ -80,8 +80,8 @@ export class WaterHeater extends irdeviceBase {
80
80
  }
81
81
 
82
82
  async pushWaterHeaterOffChanges(): Promise<void> {
83
- this.debugLog(`pushWaterHeaterOffChanges Active: ${this.Valve.Active}, disablePushOff: ${this.disablePushOff}`)
84
- if (this.Valve.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
83
+ this.debugLog(`pushWaterHeaterOffChanges Active: ${this.Valve.Active}, disablePushOff: ${this.deviceDisablePushOff}`)
84
+ if (this.Valve.Active === this.hap.Characteristic.Active.INACTIVE && !this.deviceDisablePushOff) {
85
85
  const commandType: string = await this.commandType()
86
86
  const command: string = await this.commandOff()
87
87
  const bodyChange: bodyChange = {
package/src/settings.ts CHANGED
@@ -220,6 +220,11 @@ export interface irBaseDeviceConfig extends irdevice {
220
220
  connectionType?: string
221
221
  hide_device?: boolean
222
222
  external?: boolean
223
+ refreshRate?: number
224
+ updateRate?: number
225
+ pushRate?: number
226
+ maxRetries?: number
227
+ delayBetweenRetries?: number
223
228
  firmware?: string
224
229
  deviceId: string
225
230
  logging?: string
@@ -1,81 +0,0 @@
1
- #!/bin/env node
2
-
3
- /**
4
- * This scripts queries the npm registry to pull out the latest version for a given tag.
5
- */
6
-
7
- const fs = require("fs");
8
- const semver = require("semver");
9
- const child_process = require("child_process");
10
- const assert = require("assert");
11
-
12
- const BRANCH_VERSION_PATTERN = /^([A-Za-z]*)-(\d+.\d+.\d+)$/
13
-
14
- // Load the contents of the package.json file
15
- const packageJSON = JSON.parse(fs.readFileSync("package.json", "utf8"));
16
-
17
- let refArgument = process.argv[2];
18
- let tagArgument = process.argv[3] || "latest";
19
-
20
- if (refArgument == null) {
21
- console.error("ref argument is missing");
22
- console.error("Usage: npm-version-script.cjs <ref> [tag]");
23
- process.exit(1);
24
- }
25
-
26
- /**
27
- * Queries the NPM registry for the latest version for the provided tag.
28
- * @param tag The tag to query for.
29
- * @returns {string} Returns the version.
30
- */
31
- function getTagVersionFromNpm(tag) {
32
- try {
33
- return child_process.execSync(`npm info ${packageJSON.name} version --tag="${tag}"`).toString("utf8").trim();
34
- } catch (e) {
35
- throw e;
36
- }
37
- }
38
-
39
- function desiredTargetVersion(ref) {
40
- // ref is a GitHub action ref string
41
- if (ref.startsWith("refs/pull/")) {
42
- throw Error("The version script was executed inside a PR!");
43
- }
44
-
45
- assert(ref.startsWith("refs/heads/"))
46
- let branchName = ref.slice("refs/heads/".length);
47
-
48
- let results = branchName.match(BRANCH_VERSION_PATTERN);
49
- if (results != null) {
50
- if (results[1] !== tagArgument) {
51
- console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`);
52
- }
53
-
54
- return results[2];
55
- }
56
-
57
- // legacy mode were we use the `betaVersion` property in the package.json
58
- if (branchName === "beta" && packageJSON.betaVersion) {
59
- return packageJSON.betaVersion
60
- }
61
-
62
- throw new Error("Malformed branch name for ref: " + ref + ". Can't derive the base version. Use a branch name like: beta-x.x.x!");
63
- }
64
-
65
- // derive the base version from the branch ref
66
- const baseVersion = desiredTargetVersion(refArgument);
67
-
68
- // query the npm registry for the latest version of the provided tag name
69
- const latestReleasedVersion = getTagVersionFromNpm(tagArgument); // e.g. 0.7.0-beta.12
70
- const latestReleaseBase = semver.inc(latestReleasedVersion, "patch"); // will produce 0.7.0 (removing the preid, needed for the equality check below)
71
-
72
- let publishTag;
73
- if (semver.eq(baseVersion, latestReleaseBase)) { // check if we are releasing another version for the latest beta
74
- publishTag = latestReleasedVersion; // set the current latest beta to be incremented
75
- } else {
76
- publishTag = baseVersion; // start of with a new beta version
77
- }
78
-
79
- // save the package.json
80
- packageJSON.version = publishTag;
81
- fs.writeFileSync("package.json", JSON.stringify(packageJSON, null, 2));