@switchbot/homebridge-switchbot 4.1.1-beta.9 → 4.1.2

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.
@@ -12,9 +12,6 @@ export declare const PLUGIN_NAME = "@switchbot/homebridge-switchbot";
12
12
  export interface SwitchBotPlatformConfig extends PlatformConfig {
13
13
  credentials?: credentials;
14
14
  options?: options;
15
- deviceConfig?: {
16
- [deviceType: string]: devicesConfig;
17
- };
18
15
  }
19
16
  interface credentials {
20
17
  token?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAKhD,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/I;;GAEG;AACH,eAAO,MAAM,aAAa,cAAc,CAAA;AAExC;;GAEG;AACH,eAAO,MAAM,WAAW,oCAAoC,CAAA;AAG5D,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC7D,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,YAAY,CAAC,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAAA;KAAE,CAAA;CACvD;AACD,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,OAAO;IACtB,OAAO,CAAC,EAAE,aAAa,EAAE,CAAA;IACzB,YAAY,CAAC,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAAA;KAAE,CAAA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;CACnB;AAED,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD,gBAAgB,CAAC,EAAE,QAAQ,CAAA;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;CACd"}
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAA;AAExC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,iCAAiC,CAAA;AAkC3D,CAAC;AA2CD,CAAC;AAOD,CAAC;AAOD,CAAC;AAOD,CAAC;AAcD,CAAC;AAeD,CAAC;AAQD,CAAC;AAOD,CAAC;AAMD,CAAC;AAID,CAAC;AAMD,CAAC;AAMD,CAAC;AAMD,CAAC;AAMD,CAAC;AAUD,CAAC;AA6BD,CAAC;AAKD,CAAC;AAYD,CAAC;AAKD,CAAC"}
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAA;AAExC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,iCAAiC,CAAA;AAiC3D,CAAC;AA2CD,CAAC;AAOD,CAAC;AAOD,CAAC;AAOD,CAAC;AAcD,CAAC;AAeD,CAAC;AAQD,CAAC;AAOD,CAAC;AAMD,CAAC;AAID,CAAC;AAMD,CAAC;AAMD,CAAC;AAMD,CAAC;AAMD,CAAC;AAUD,CAAC;AA6BD,CAAC;AAKD,CAAC;AAYD,CAAC;AAKD,CAAC"}
@@ -1 +1 @@
1
- <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@switchbot/homebridge-switchbot</a></li><li><a href="default.html">default</a></li></ul><h1>Function default</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="default" class="tsd-anchor"></a><span class="tsd-kind-call-signature">default</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#default" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/d9c0b8713b2594df32e99833a81ea351bd1267d7/src/index.ts#L11">index.ts:11</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@switchbot/homebridge-switchbot</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@switchbot/homebridge-switchbot</a></li><li><a href="default.html">default</a></li></ul><h1>Function default</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="default" class="tsd-anchor"></a><span class="tsd-kind-call-signature">default</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#default" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/ebf590a7c7b218e9a9b9124a9b16a90045eadfdc/src/index.ts#L11">index.ts:11</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@switchbot/homebridge-switchbot</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@switchbot/homebridge-switchbot",
3
3
  "displayName": "SwitchBot",
4
4
  "type": "module",
5
- "version": "4.1.1-beta.9",
5
+ "version": "4.1.2",
6
6
  "description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
7
7
  "author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
8
8
  "contributors": [
@@ -60,7 +60,6 @@
60
60
  },
61
61
  "scripts": {
62
62
  "check": "npm install && npm outdated",
63
- "update": "ncu -u && npm update && npm install",
64
63
  "lint": "eslint src/**/*.ts",
65
64
  "lint:fix": "eslint src/**/*.ts --fix",
66
65
  "watch": "npm run build && npm run plugin-ui && npm link && nodemon",
@@ -80,8 +79,8 @@
80
79
  "@homebridge/plugin-ui-utils": "^1.0.3",
81
80
  "async-mqtt": "^2.6.3",
82
81
  "fakegato-history": "^0.6.5",
83
- "homebridge-lib": "^7.0.9",
84
- "node-switchbot": "^3.2.2-beta.9",
82
+ "homebridge-lib": "^7.1.0",
83
+ "node-switchbot": "^3.3.0",
85
84
  "rxjs": "^7.8.1"
86
85
  },
87
86
  "devDependencies": {
@@ -90,19 +89,18 @@
90
89
  "@types/debug": "^4.1.12",
91
90
  "@types/fs-extra": "^11.0.4",
92
91
  "@types/mdast": "^4.0.4",
93
- "@types/node": "^22.8.5",
92
+ "@types/node": "^22.9.0",
94
93
  "@types/semver": "^7.5.8",
95
94
  "@types/source-map-support": "^0.5.10",
96
95
  "@vitest/coverage-v8": "^2.1.4",
97
- "eslint": "^9.13.0",
96
+ "eslint": "^9.14.0",
98
97
  "eslint-plugin-format": "^0.1.2",
99
98
  "homebridge": "^1.8.5",
100
99
  "homebridge-config-ui-x": "4.62.0",
101
100
  "nodemon": "^3.1.7",
102
- "npm-check-updates": "^17.1.9",
103
101
  "shx": "^0.3.4",
104
102
  "ts-node": "^10.9.2",
105
- "typedoc": "^0.26.10",
103
+ "typedoc": "^0.26.11",
106
104
  "typescript": "^5.6.3",
107
105
  "vitest": "^2.1.4"
108
106
  },
@@ -66,12 +66,10 @@ export abstract class deviceBase {
66
66
  this.BLE = this.device.connectionType === 'BLE' || this.device.connectionType === 'BLE/OpenAPI'
67
67
  this.OpenAPI = this.device.connectionType === 'OpenAPI' || this.device.connectionType === 'BLE/OpenAPI'
68
68
 
69
- this.getDeviceLogSettings(accessory, device)
70
- this.getDeviceRateSettings(accessory, device)
71
- this.getDeviceRetry(device)
69
+ this.getDeviceLogSettings(device)
70
+ this.getDeviceRateSettings(device)
72
71
  this.getDeviceConfigSettings(device)
73
72
  this.getDeviceContext(accessory, device)
74
- this.getDeviceScanDuration(accessory, device)
75
73
  this.getMqttSettings(device)
76
74
 
77
75
  // Set accessory information
@@ -86,35 +84,39 @@ export abstract class deviceBase {
86
84
  .setCharacteristic(this.hap.Characteristic.SerialNumber, device.deviceId)
87
85
  }
88
86
 
89
- async getDeviceLogSettings(accessory: PlatformAccessory, device: device & devicesConfig): Promise<void> {
90
- this.deviceLogging = this.platform.debugMode ? 'debugMode' : device.logging ?? this.config.logging ?? 'standard'
91
- const logging = this.platform.debugMode ? 'Debug Mode' : device.logging ? 'Device Config' : this.config.logging ? 'Platform Config' : 'Default'
92
- accessory.context.deviceLogging = this.deviceLogging
87
+ async getDeviceLogSettings(device: device & devicesConfig): Promise<void> {
88
+ this.deviceLogging = this.platform.debugMode ? 'debugMode' : device.logging ?? this.platform.platformLogging ?? 'standard'
89
+ const logging = this.platform.debugMode ? 'Debug Mode' : device.logging ? 'Device Config' : this.platform.platformLogging ? 'Platform Config' : 'Default'
93
90
  this.debugLog(`Using ${logging} Logging: ${this.deviceLogging}`)
94
91
  }
95
92
 
96
- async getDeviceRateSettings(accessory: PlatformAccessory, device: device & devicesConfig): Promise<void> {
93
+ async getDeviceRateSettings(device: device & devicesConfig): Promise<void> {
97
94
  // refreshRate
98
- this.deviceRefreshRate = device.refreshRate ?? this.config.options?.refreshRate ?? 5
99
- accessory.context.deviceRefreshRate = this.deviceRefreshRate
100
- const refreshRate = device.refreshRate ? 'Device Config' : this.config.options?.refreshRate ? 'Platform Config' : 'Default'
95
+ this.deviceRefreshRate = device.refreshRate ?? this.platform.platformRefreshRate ?? 360
96
+ const refreshRate = device.refreshRate ? 'Device Config' : this.platform.platformRefreshRate ? 'Platform Config' : 'Default'
101
97
  // updateRate
102
- this.deviceUpdateRate = device.updateRate ?? this.config.options?.updateRate ?? 5
103
- accessory.context.deviceUpdateRate = this.deviceUpdateRate
104
- const updateRate = device.updateRate ? 'Device Config' : this.config.options?.updateRate ? 'Platform Config' : 'Default'
98
+ this.deviceUpdateRate = device.updateRate ?? this.platform.platformUpdateRate ?? 5
99
+ const updateRate = device.updateRate ? 'Device Config' : this.platform.platformUpdateRate ? 'Platform Config' : 'Default'
105
100
  // pushRate
106
- this.devicePushRate = device.pushRate ?? this.config.options?.pushRate ?? 1
107
- accessory.context.devicePushRate = this.devicePushRate
108
- const pushRate = device.pushRate ? 'Device Config' : this.config.options?.pushRate ? 'Platform Config' : 'Default'
101
+ this.devicePushRate = device.pushRate ?? this.platform.platformPushRate ?? 0.1
102
+ const pushRate = device.pushRate ? 'Device Config' : this.platform.platformPushRate ? 'Platform Config' : 'Default'
109
103
  this.debugLog(`Using ${refreshRate} refreshRate: ${this.deviceRefreshRate}, ${updateRate} updateRate: ${this.deviceUpdateRate}, ${pushRate} pushRate: ${this.devicePushRate}`)
110
- }
111
-
112
- async getDeviceRetry(device: device & devicesConfig): Promise<void> {
113
- this.deviceMaxRetries = device.maxRetries ?? 5
114
- const maxRetries = device.maxRetries ? 'Device' : 'Default'
115
- this.deviceDelayBetweenRetries = device.delayBetweenRetries ? (device.delayBetweenRetries * 1000) : 3000
116
- const delayBetweenRetries = device.delayBetweenRetries ? 'Device' : 'Default'
117
- this.debugLog(`Using ${maxRetries} Max Retries: ${this.deviceMaxRetries}, ${delayBetweenRetries} Delay Between Retries: ${this.deviceDelayBetweenRetries}`)
104
+ // maxRetries
105
+ this.deviceMaxRetries = device.maxRetries ?? this.platform.platformMaxRetries ?? 5
106
+ const maxRetries = device.maxRetries ? 'Device' : this.platform.platformMaxRetries ? 'Platform' : 'Default'
107
+ this.debugLog(`Using ${maxRetries} Max Retries: ${this.deviceMaxRetries}`)
108
+ // delayBetweenRetries
109
+ this.deviceDelayBetweenRetries = device.delayBetweenRetries ? (device.delayBetweenRetries * 1000) : this.platform.platformDelayBetweenRetries ?? 3000
110
+ const delayBetweenRetries = device.delayBetweenRetries ? 'Device' : this.platform.platformDelayBetweenRetries ? 'Platform' : 'Default'
111
+ this.debugLog(`Using ${delayBetweenRetries} Delay Between Retries: ${this.deviceDelayBetweenRetries}`)
112
+ // scanDuration
113
+ this.scanDuration = Math.max(device.scanDuration ?? 1, this.deviceUpdateRate > 1 ? this.deviceUpdateRate : 1)
114
+ if (this.BLE) {
115
+ this.debugLog(`Using ${device.scanDuration ? 'Device Config' : 'Default'} scanDuration: ${this.scanDuration}`)
116
+ if (device.scanDuration && this.deviceUpdateRate > device.scanDuration) {
117
+ this.warnLog('scanDuration is less than updateRate, overriding scanDuration with updateRate')
118
+ }
119
+ }
118
120
  }
119
121
 
120
122
  async retryBLE({ max, fn }: { max: number, fn: { (): any, (): Promise<any> } }): Promise<null> {
@@ -133,34 +135,6 @@ export abstract class deviceBase {
133
135
  return this.device.maxRetry !== undefined ? this.device.maxRetry : 5
134
136
  }
135
137
 
136
- async getDeviceScanDuration(accessory: PlatformAccessory, device: device & devicesConfig): Promise<void> {
137
- this.scanDuration = device.scanDuration
138
- ? (this.deviceUpdateRate > device.scanDuration) ? this.deviceUpdateRate : device.scanDuration ? (this.deviceUpdateRate > 1) ? this.deviceUpdateRate : 1 : this.deviceUpdateRate
139
- : 1
140
- if (device.scanDuration) {
141
- if (this.deviceUpdateRate > device.scanDuration) {
142
- this.scanDuration = this.deviceUpdateRate
143
- if (this.BLE) {
144
- this.warnLog('scanDuration is less than updateRate, overriding scanDuration with updateRate')
145
- }
146
- } else {
147
- this.scanDuration = accessory.context.scanDuration = device.scanDuration
148
- }
149
- if (this.BLE) {
150
- this.debugLog(`Using Device Config scanDuration: ${this.scanDuration}`)
151
- }
152
- } else {
153
- if (this.deviceUpdateRate > 1) {
154
- this.scanDuration = this.deviceUpdateRate
155
- } else {
156
- this.scanDuration = accessory.context.scanDuration = 1
157
- }
158
- if (this.BLE) {
159
- this.debugLog(`Using Default scanDuration: ${this.scanDuration}`)
160
- }
161
- }
162
- }
163
-
164
138
  async getDeviceConfigSettings(device: device & devicesConfig): Promise<void> {
165
139
  const deviceConfig = Object.assign(
166
140
  {},
@@ -30,7 +30,7 @@ export abstract class irdeviceBase {
30
30
  this.config = this.platform.config
31
31
  this.hap = this.api.hap
32
32
 
33
- this.getDeviceLogSettings(device)
33
+ this.getDeviceLogSettings(accessory, device)
34
34
  this.getDeviceConfigSettings(device)
35
35
  this.getDeviceContext(accessory, device)
36
36
  this.disablePushOnChanges(device)
@@ -48,20 +48,11 @@ export abstract class irdeviceBase {
48
48
  .setCharacteristic(this.hap.Characteristic.SerialNumber, device.deviceId)
49
49
  }
50
50
 
51
- async getDeviceLogSettings(device: irdevice & irDevicesConfig): Promise<void> {
52
- if (this.platform.debugMode) {
53
- this.deviceLogging = this.accessory.context.logging = 'debugMode'
54
- this.debugWarnLog(`Using Debug Mode Logging: ${this.deviceLogging}`)
55
- } else if (device.logging) {
56
- this.deviceLogging = this.accessory.context.logging = device.logging
57
- this.debugWarnLog(`Using Device Config Logging: ${this.deviceLogging}`)
58
- } else if (this.config.logging) {
59
- this.deviceLogging = this.accessory.context.logging = this.config.logging
60
- this.debugWarnLog(`Using Platform Config Logging: ${this.deviceLogging}`)
61
- } else {
62
- this.deviceLogging = this.accessory.context.logging = 'standard'
63
- this.debugWarnLog(`Logging Not Set, Using: ${this.deviceLogging}`)
64
- }
51
+ async getDeviceLogSettings(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): Promise<void> {
52
+ this.deviceLogging = this.platform.debugMode ? 'debugMode' : device.logging ?? this.platform.platformLogging ?? 'standard'
53
+ const logging = this.platform.debugMode ? 'Debug Mode' : device.logging ? 'Device Config' : this.platform.platformLogging ? 'Platform Config' : 'Default'
54
+ accessory.context.deviceLogging = this.deviceLogging
55
+ this.debugLog(`Using ${logging} Logging: ${this.deviceLogging}`)
65
56
  }
66
57
 
67
58
  async getDeviceConfigSettings(device: irdevice & irDevicesConfig): Promise<void> {
package/src/platform.ts CHANGED
@@ -10,7 +10,7 @@ import type { MqttClient } from 'mqtt'
10
10
  import type { blindTiltConfig, curtainConfig, devicesConfig, irDevicesConfig, options, SwitchBotPlatformConfig } from './settings.js'
11
11
 
12
12
  import { readFileSync } from 'node:fs'
13
- import process from 'node:process'
13
+ import process, { argv } from 'node:process'
14
14
 
15
15
  import asyncmqtt from 'async-mqtt'
16
16
  import fakegato from 'fakegato-history'
@@ -68,14 +68,16 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
68
68
  public readonly log: Logging
69
69
 
70
70
  // Configuration properties
71
- version!: string
72
- Logging?: string
73
- debugMode!: boolean
74
- maxRetries!: number
75
- delayBetweenRetries!: number
76
- platformConfig!: SwitchBotPlatformConfig['options']
77
- platformLogging!: SwitchBotPlatformConfig['logging']
71
+ platformConfig!: SwitchBotPlatformConfig
72
+ platformLogging!: options['logging']
73
+ platformRefreshRate!: options['refreshRate']
74
+ platformPushRate!: options['pushRate']
75
+ platformUpdateRate!: options['updateRate']
76
+ platformMaxRetries!: options['maxRetries']
77
+ platformDelayBetweenRetries!: options['delayBetweenRetries']
78
78
  config!: SwitchBotPlatformConfig
79
+ debugMode!: boolean
80
+ version!: string
79
81
 
80
82
  // MQTT and Webhook properties
81
83
  mqttClient: MqttClient | null = null
@@ -114,11 +116,11 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
114
116
  credentials: config.credentials as object,
115
117
  options: config.options as object,
116
118
  devices: config.devices as { deviceId: string }[],
117
- deviceConfig: config.deviceConfig as { [deviceType: string]: devicesConfig },
118
119
  }
119
120
 
120
121
  // Plugin Configuration
121
122
  this.getPlatformLogSettings()
123
+ this.getPlatformRateSettings()
122
124
  this.getPlatformConfigSettings()
123
125
  this.getVersion()
124
126
 
@@ -361,20 +363,6 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
361
363
  this.config = this.config || {}
362
364
  this.config.options = this.config.options || {}
363
365
 
364
- const platformConfig: options = {}
365
- if (this.config.options.logging) {
366
- platformConfig.logging = this.config.options.logging
367
- }
368
- if (this.config.options.logging && this.config.options.refreshRate) {
369
- platformConfig.refreshRate = this.config.options.refreshRate
370
- }
371
- if (this.config.options.logging && this.config.options.pushRate) {
372
- platformConfig.pushRate = this.config.options.pushRate
373
- }
374
- if (Object.entries(platformConfig).length !== 0) {
375
- this.debugWarnLog(`Platform Config: ${JSON.stringify(platformConfig)}`)
376
- }
377
-
378
366
  if (this.config.options) {
379
367
  // Device Config
380
368
  if (this.config.options.devices) {
@@ -405,37 +393,6 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
405
393
  }
406
394
  }
407
395
 
408
- if (this.config.options!.refreshRate! < 5) {
409
- throw new Error('Refresh Rate must be above 5 (5 seconds).')
410
- }
411
-
412
- if (!this.config.options.refreshRate) {
413
- // default 120 seconds (2 minutes)
414
- this.config.options!.refreshRate! = 120
415
- this.debugWarnLog('Using Default Refresh Rate (2 minutes).')
416
- }
417
-
418
- if (!this.config.options.pushRate) {
419
- // default 100 milliseconds
420
- this.config.options!.pushRate! = 0.1
421
- this.debugWarnLog('Using Default Push Rate.')
422
- }
423
-
424
- if (!this.config.options.maxRetries) {
425
- this.config.options.maxRetries = 5
426
- this.debugWarnLog('Using Default Max Retries.')
427
- } else {
428
- this.maxRetries = this.config.options.maxRetries
429
- }
430
-
431
- if (!this.config.options.delayBetweenRetries) {
432
- // default 3 seconds
433
- this.config.options!.delayBetweenRetries! = 3000
434
- this.debugWarnLog('Using Default Delay Between Retries.')
435
- } else {
436
- this.delayBetweenRetries = this.config.options.delayBetweenRetries * 1000
437
- }
438
-
439
396
  if (!this.config.credentials && !this.config.options) {
440
397
  this.debugWarnLog('Missing Credentials')
441
398
  } else if (this.config.credentials && !this.config.credentials.notice) {
@@ -458,12 +415,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
458
415
  }
459
416
 
460
417
  let retryCount = 0
461
- const maxRetries = this.maxRetries
462
- const delayBetweenRetries = this.delayBetweenRetries
418
+ const maxRetries = this.platformMaxRetries ?? 5
419
+ const delayBetweenRetries = this.platformDelayBetweenRetries || 5000
463
420
 
464
421
  this.debugWarnLog(`Retry Count: ${retryCount}`)
465
- this.debugWarnLog(`Max Retries: ${maxRetries}`)
466
- this.debugWarnLog(`Delay Between Retries: ${delayBetweenRetries}`)
422
+ this.debugWarnLog(`Max Retries: ${this.platformMaxRetries}`)
423
+ this.debugWarnLog(`Delay Between Retries: ${this.platformDelayBetweenRetries}`)
467
424
 
468
425
  while (retryCount < maxRetries) {
469
426
  try {
@@ -2680,60 +2637,70 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2680
2637
  }
2681
2638
  }
2682
2639
 
2683
- async getVersion(): Promise<string> {
2684
- const json = JSON.parse(
2685
- readFileSync(
2686
- new URL('../package.json', import.meta.url),
2687
- 'utf-8',
2688
- ),
2689
- )
2690
- this.debugLog(`Plugin Version: ${json.version}`)
2691
- this.version = json.version
2692
- return json.version
2693
- }
2694
-
2695
2640
  async getPlatformConfigSettings() {
2696
- const { options } = this.config
2697
- const platformConfig: SwitchBotPlatformConfig['options'] = {}
2698
-
2699
- if (options) {
2700
- platformConfig.logging = options.logging
2701
- platformConfig.refreshRate = options.refreshRate
2702
- platformConfig.updateRate = options.updateRate
2703
- platformConfig.pushRate = options.pushRate
2704
-
2705
- this.maxRetries = options.maxRetries || 3
2706
- platformConfig.maxRetries = this.maxRetries
2707
- if (!options.maxRetries) {
2708
- this.debugWarnLog('Using Default Max Retries')
2709
- }
2710
-
2711
- this.delayBetweenRetries = (options.delayBetweenRetries || 3) * 1000
2712
- platformConfig.delayBetweenRetries = this.delayBetweenRetries / 1000
2713
- if (!options.delayBetweenRetries) {
2714
- this.debugWarnLog('Using Default Delay Between Retries')
2641
+ if (this.config.options) {
2642
+ const platformConfig: SwitchBotPlatformConfig = {
2643
+ platform: 'Resideo',
2715
2644
  }
2716
-
2717
- if (Object.keys(platformConfig).length) {
2718
- this.debugLog(`Platform Config: ${JSON.stringify(platformConfig)}`)
2645
+ platformConfig.logging = this.config.options.logging ? this.config.options.logging : undefined
2646
+ platformConfig.refreshRate = this.config.options.refreshRate ? this.config.options.refreshRate : undefined
2647
+ platformConfig.updateRate = this.config.options.updateRate ? this.config.options.updateRate : undefined
2648
+ platformConfig.pushRate = this.config.options.pushRate ? this.config.options.pushRate : undefined
2649
+ platformConfig.maxRetries = this.config.options.maxRetries ? this.config.options.maxRetries : undefined
2650
+ platformConfig.delayBetweenRetries = this.config.options.delayBetweenRetries ? this.config.options.delayBetweenRetries : undefined
2651
+ if (Object.entries(platformConfig).length !== 0) {
2652
+ await this.debugLog(`Platform Config: ${JSON.stringify(platformConfig)}`)
2719
2653
  }
2720
-
2721
2654
  this.platformConfig = platformConfig
2722
2655
  }
2723
2656
  }
2724
2657
 
2658
+ async getPlatformRateSettings() {
2659
+ // RefreshRate
2660
+ this.platformRefreshRate = this.config.options?.refreshRate ? this.config.options.refreshRate : undefined
2661
+ const refreshRate = this.config.options?.refreshRate ? 'Using Platform Config refreshRate' : 'Platform Config refreshRate Not Set'
2662
+ await this.debugLog(`${refreshRate}: ${this.platformRefreshRate}`)
2663
+ // UpdateRate
2664
+ this.platformUpdateRate = this.config.options?.updateRate ? this.config.options.updateRate : undefined
2665
+ const updateRate = this.config.options?.updateRate ? 'Using Platform Config updateRate' : 'Platform Config updateRate Not Set'
2666
+ await this.debugLog(`${updateRate}: ${this.platformUpdateRate}`)
2667
+ // PushRate
2668
+ this.platformPushRate = this.config.options?.pushRate ? this.config.options.pushRate : undefined
2669
+ const pushRate = this.config.options?.pushRate ? 'Using Platform Config pushRate' : 'Platform Config pushRate Not Set'
2670
+ await this.debugLog(`${pushRate}: ${this.platformPushRate}`)
2671
+ // MaxRetries
2672
+ this.platformMaxRetries = this.config.options?.maxRetries ? this.config.options.maxRetries : undefined
2673
+ const maxRetries = this.config.options?.maxRetries ? 'Using Platform Config maxRetries' : 'Platform Config maxRetries Not Set'
2674
+ await this.debugLog(`${maxRetries}: ${this.platformMaxRetries}`)
2675
+ // DelayBetweenRetries
2676
+ this.platformDelayBetweenRetries = this.config.options?.delayBetweenRetries ? this.config.options.delayBetweenRetries : undefined
2677
+ const delayBetweenRetries = this.config.options?.delayBetweenRetries ? 'Using Platform Config delayBetweenRetries' : 'Platform Config delayBetweenRetries Not Set'
2678
+ await this.debugLog(`${delayBetweenRetries}: ${this.platformDelayBetweenRetries}`)
2679
+ }
2680
+
2725
2681
  async getPlatformLogSettings() {
2726
- this.debugMode = process.argv.includes('-D') ?? process.argv.includes('--debug')
2727
- if (this.config.options?.logging === 'debug' || this.config.options?.logging === 'standard' || this.config.options?.logging === 'none') {
2728
- this.platformLogging = this.config.options.logging
2729
- this.debugWarnLog(`Using Config Logging: ${this.platformLogging}`)
2730
- } else if (this.debugMode) {
2731
- this.platformLogging = 'debugMode'
2732
- this.debugWarnLog(`Using ${this.platformLogging} Logging`)
2733
- } else {
2734
- this.platformLogging = 'standard'
2735
- this.debugWarnLog(`Using ${this.platformLogging} Logging`)
2736
- }
2682
+ this.debugMode = argv.includes('-D') ?? argv.includes('--debug')
2683
+ this.platformLogging = (this.config.options?.logging === 'debug' || this.config.options?.logging === 'standard'
2684
+ || this.config.options?.logging === 'none')
2685
+ ? this.config.options.logging
2686
+ : this.debugMode ? 'debugMode' : 'standard'
2687
+ const logging = this.config.options?.logging ? 'Platform Config' : this.debugMode ? 'debugMode' : 'Default'
2688
+ await this.debugLog(`Using ${logging} Logging: ${this.platformLogging}`)
2689
+ }
2690
+
2691
+ /**
2692
+ * Asynchronously retrieves the version of the plugin from the package.json file.
2693
+ *
2694
+ * This method reads the package.json file located in the parent directory,
2695
+ * parses its content to extract the version, and logs the version using the debug logger.
2696
+ * The extracted version is then assigned to the `version` property of the class.
2697
+ *
2698
+ * @returns {Promise<void>} A promise that resolves when the version has been retrieved and logged.
2699
+ */
2700
+ async getVersion(): Promise<void> {
2701
+ const { version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf-8'))
2702
+ this.debugLog(`Plugin Version: ${version}`)
2703
+ this.version = version
2737
2704
  }
2738
2705
 
2739
2706
  /**
package/src/settings.ts CHANGED
@@ -23,7 +23,6 @@ export const PLUGIN_NAME = '@switchbot/homebridge-switchbot'
23
23
  export interface SwitchBotPlatformConfig extends PlatformConfig {
24
24
  credentials?: credentials
25
25
  options?: options
26
- deviceConfig?: { [deviceType: string]: devicesConfig }
27
26
  }
28
27
  interface credentials {
29
28
  token?: 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));