@switchbot/homebridge-switchbot 4.1.7-beta.4 → 4.1.7-beta.6
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/dist/device/device.js +2 -2
- package/dist/device/device.js.map +1 -1
- package/dist/irdevice/irdevice.js +1 -1
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/platform.d.ts +7 -3
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +21 -2
- package/dist/platform.js.map +1 -1
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/main.js +4 -4
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +6 -6
- package/docs/functions/default.html +1 -1
- package/docs/index.html +51 -50
- package/package.json +3 -3
- package/src/device/device.ts +2 -2
- package/src/irdevice/irdevice.ts +1 -1
- package/src/platform.ts +22 -3
package/docs/index.html
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<!DOCTYPE html><html class="default" lang="en" data-base="."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@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"><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"><h1>@switchbot/homebridge-switchbot</h1></div><div class="tsd-panel tsd-typography"><span align="center">
|
|
2
2
|
<p><a href="https://github.com/homebridge/verified/blob/master/verified-plugins.json"><img alt="homebridge-verified" src="https://raw.githubusercontent.com/OpenWonderLabs/homebridge-switchbot/latest/branding/Homebridge_x_SwitchBot.svg?sanitize=true" width="350px"></a></p>
|
|
3
|
-
<a id="switchbothomebridge-switchbot" class="tsd-anchor"></a><h1 class="tsd-anchor-link">@switchbot/homebridge-switchbot<a href="#switchbothomebridge-switchbot" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><p><a href="https://www.npmjs.com/package/@switchbot/homebridge-switchbot"
|
|
4
|
-
<a href="https://www.npmjs.com/package/@switchbot/homebridge-switchbot"
|
|
5
|
-
<a href="https://discord.gg/5wYTbwP4ha"
|
|
3
|
+
<a id="switchbothomebridge-switchbot" class="tsd-anchor"></a><h1 class="tsd-anchor-link">@switchbot/homebridge-switchbot<a href="#switchbothomebridge-switchbot" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><p><a href="https://www.npmjs.com/package/@switchbot/homebridge-switchbot"><img src="https://badgen.net/npm/v/@switchbot/homebridge-switchbot" alt="npm version"></a>
|
|
4
|
+
<a href="https://www.npmjs.com/package/@switchbot/homebridge-switchbot"><img src="https://badgen.net/npm/dt/@switchbot/homebridge-switchbot" alt="npm downloads"></a>
|
|
5
|
+
<a href="https://discord.gg/5wYTbwP4ha"><img src="https://badgen.net/discord/online-members/5wYTbwP4ha?icon=discord&label=discord" alt="discord-switchbot"></a></p>
|
|
6
6
|
<p>The Homebridge <a href="https://www.switch-bot.com">SwitchBot</a> plugin allows you to access your SwitchBot Device(s) from HomeKit with
|
|
7
7
|
<a href="https://homebridge.io">Homebridge</a>.
|
|
8
8
|
</p>
|
|
9
9
|
</span>
|
|
10
10
|
<a id="installation" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Installation<a href="#installation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><ol>
|
|
11
|
-
<li>Search for "SwitchBot" on the plugin screen of <a href="https://github.com/oznu/homebridge-config-ui-x"
|
|
11
|
+
<li>Search for "SwitchBot" on the plugin screen of <a href="https://github.com/oznu/homebridge-config-ui-x">Homebridge Config UI X</a></li>
|
|
12
12
|
<li>Find: <code>@switchbot/homebridge-switchbot</code>
|
|
13
13
|
<ul>
|
|
14
|
-
<li>See noble <a href="https://github.com/abandonware/noble#prerequisites"
|
|
14
|
+
<li>See noble <a href="https://github.com/abandonware/noble#prerequisites">prerequisites</a> for your OS. (This is used for BLE connection.)</li>
|
|
15
15
|
</ul>
|
|
16
16
|
</li>
|
|
17
17
|
<li>Click <strong>Install</strong></li>
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
<a id="if-using-macos" class="tsd-anchor"></a><h3 class="tsd-anchor-link">If using MacOS<a href="#if-using-macos" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><ol>
|
|
86
86
|
<li>Manually grant Bluetooth access in System Settings UI for <code>Security & Privacy -> Privacy</code> to the node executable, eg <code>/usr/local/bin/node</code>
|
|
87
87
|
<img src="media/security-privacy-bluetooth.png" alt="Security & Privacy -> Privacy">
|
|
88
|
-
(This is what is intended in documentation for the noble bluetooth package <a href="https://github.com/abandonware/noble#prerequisites"
|
|
88
|
+
(This is what is intended in documentation for the noble bluetooth package <a href="https://github.com/abandonware/noble#prerequisites">prerequisites</a> by "Add terminal app", however for HomeBridge it is <code>node</code> that needs the permission granted, not <code>terminal</code>.
|
|
89
89
|
Without this step, then you will receive the following error when the swichbot plugin launches, which will cause Homebridge or the child bridge process to restart:</li>
|
|
90
90
|
</ol>
|
|
91
91
|
<pre><code><span class="hl-0">Error</span><span class="hl-1">: </span><span class="hl-2">Failed</span><span class="hl-1"> </span><span class="hl-2">to</span><span class="hl-1"> </span><span class="hl-2">initialize</span><span class="hl-1"> </span><span class="hl-2">the</span><span class="hl-1"> </span><span class="hl-2">Noble</span><span class="hl-1"> </span><span class="hl-0">object</span><span class="hl-1">: </span><span class="hl-2">unauthorized</span><br/><span class="hl-1"> </span><span class="hl-2">at</span><span class="hl-1"> </span><span class="hl-2">Noble</span><span class="hl-1">.<</span><span class="hl-3">anonymous</span><span class="hl-1">> (</span><span class="hl-2">file</span><span class="hl-1">:</span><span class="hl-4">///usr/local/lib/node_modules/@switchbot/homebridge-switchbot/node_modules/node-switchbot/src/switchbot.ts:244:19)</span><br/><span class="hl-1"> </span><span class="hl-3">at</span><span class="hl-1"> </span><span class="hl-3">Object</span><span class="hl-1">.</span><span class="hl-3">onceWrapper</span><span class="hl-1"> (</span><span class="hl-2">node</span><span class="hl-1">:</span><span class="hl-3">events</span><span class="hl-1">:</span><span class="hl-5">629</span><span class="hl-1">:</span><span class="hl-5">26</span><span class="hl-1">)</span><br/><span class="hl-1"> </span><span class="hl-3">at</span><span class="hl-1"> </span><span class="hl-3">Noble</span><span class="hl-1">.</span><span class="hl-3">emit</span><span class="hl-1"> (</span><span class="hl-2">node</span><span class="hl-1">:</span><span class="hl-3">events</span><span class="hl-1">:</span><span class="hl-5">514</span><span class="hl-1">:</span><span class="hl-5">28</span><span class="hl-1">)</span><br/><span class="hl-1"> </span><span class="hl-3">at</span><span class="hl-1"> </span><span class="hl-3">Noble</span><span class="hl-1">.</span><span class="hl-3">onStateChange</span><span class="hl-1"> (/</span><span class="hl-3">usr</span><span class="hl-1">/</span><span class="hl-3">local</span><span class="hl-1">/</span><span class="hl-3">lib</span><span class="hl-1">/</span><span class="hl-3">node_modules</span><span class="hl-1">/@</span><span class="hl-3">switchbot</span><span class="hl-1">/</span><span class="hl-3">homebridge</span><span class="hl-1">-</span><span class="hl-3">switchbot</span><span class="hl-1">/</span><span class="hl-3">node_modules</span><span class="hl-1">/@</span><span class="hl-3">stoprocent</span><span class="hl-1">/</span><span class="hl-3">noble</span><span class="hl-1">/</span><span class="hl-3">lib</span><span class="hl-1">/</span><span class="hl-3">noble</span><span class="hl-1">.</span><span class="hl-3">js</span><span class="hl-1">:</span><span class="hl-5">92</span><span class="hl-1">:</span><span class="hl-5">8</span><span class="hl-1">)</span><br/><span class="hl-1"> </span><span class="hl-3">at</span><span class="hl-1"> </span><span class="hl-3">NobleMac</span><span class="hl-1">.</span><span class="hl-3">emit</span><span class="hl-1"> (</span><span class="hl-2">node</span><span class="hl-1">:</span><span class="hl-3">events</span><span class="hl-1">:</span><span class="hl-5">514</span><span class="hl-1">:</span><span class="hl-5">28</span><span class="hl-1">)</span>
|
|
@@ -94,7 +94,7 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
94
94
|
</li>
|
|
95
95
|
</ul>
|
|
96
96
|
<a id="supported-switchbot-devices" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Supported SwitchBot Devices<a href="#supported-switchbot-devices" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><ul>
|
|
97
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-smart-humidifier"
|
|
97
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-smart-humidifier">SwitchBot Humidifier</a>
|
|
98
98
|
<ul>
|
|
99
99
|
<li>Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
|
|
100
100
|
<ul>
|
|
@@ -104,15 +104,16 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
104
104
|
</li>
|
|
105
105
|
</ul>
|
|
106
106
|
</li>
|
|
107
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-
|
|
108
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-meter
|
|
109
|
-
<li><a href="https://www.
|
|
110
|
-
<li><a href="https://www.
|
|
107
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-evaporative-humidifier-auto-refill">SwitchBot Evaporative Humidifier (Auto-refill)</a></li>
|
|
108
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-meter">SwitchBot Meter</a></li>
|
|
109
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-meter-plus">SwitchBot Meter Plus (US)</a></li>
|
|
110
|
+
<li><a href="https://www.switchbot.jp/products/switchbot-meter-plus">SwitchBot Meter Plus (JP)</a></li>
|
|
111
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-indoor-outdoor-thermo-hygrometer">SwitchBot Indoor/Outdoor Thermo-Hygrometer</a>
|
|
111
112
|
<ul>
|
|
112
113
|
<li>Supports OpenAPI & Bluetooth Low Energy (BLE) Connections</li>
|
|
113
114
|
<li>If using OpenAPI:
|
|
114
115
|
<ul>
|
|
115
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini"
|
|
116
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini">SwitchBot Hub Mini</a> or <a href="https://us.switch-bot.com/products/switchbot-hub-2">SwitchBot Hub 2</a> Required</li>
|
|
116
117
|
<li>Enable Cloud Services for Device on SwitchBot App</li>
|
|
117
118
|
</ul>
|
|
118
119
|
</li>
|
|
@@ -124,12 +125,12 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
124
125
|
</li>
|
|
125
126
|
</ul>
|
|
126
127
|
</li>
|
|
127
|
-
<li><a href="https://www.switch-bot.com/products/motion-sensor"
|
|
128
|
+
<li><a href="https://www.switch-bot.com/products/motion-sensor">SwitchBot Motion Sensor</a>
|
|
128
129
|
<ul>
|
|
129
130
|
<li>Supports OpenAPI & Bluetooth Low Energy (BLE) Connections</li>
|
|
130
131
|
<li>If using OpenAPI:
|
|
131
132
|
<ul>
|
|
132
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini"
|
|
133
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini">SwitchBot Hub Mini</a> or <a href="https://us.switch-bot.com/products/switchbot-hub-2">SwitchBot Hub 2</a> Required</li>
|
|
133
134
|
<li>Enable Cloud Services for Device on SwitchBot App</li>
|
|
134
135
|
</ul>
|
|
135
136
|
</li>
|
|
@@ -141,12 +142,12 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
141
142
|
</li>
|
|
142
143
|
</ul>
|
|
143
144
|
</li>
|
|
144
|
-
<li><a href="https://www.switch-bot.com/products/contact-sensor"
|
|
145
|
+
<li><a href="https://www.switch-bot.com/products/contact-sensor">SwitchBot Contact Sensor</a>
|
|
145
146
|
<ul>
|
|
146
147
|
<li>Supports OpenAPI & Bluetooth Low Energy (BLE) Connections</li>
|
|
147
148
|
<li>If using OpenAPI:
|
|
148
149
|
<ul>
|
|
149
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini"
|
|
150
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini">SwitchBot Hub Mini</a> or <a href="https://us.switch-bot.com/products/switchbot-hub-2">SwitchBot Hub 2</a> Required</li>
|
|
150
151
|
<li>Enable Cloud Services for Device on SwitchBot App</li>
|
|
151
152
|
</ul>
|
|
152
153
|
</li>
|
|
@@ -158,13 +159,13 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
158
159
|
</li>
|
|
159
160
|
</ul>
|
|
160
161
|
</li>
|
|
161
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-curtain"
|
|
162
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-curtain-3"
|
|
162
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-curtain">SwitchBot Curtain</a></li>
|
|
163
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-curtain-3">SwitchBot Curtain 3</a>
|
|
163
164
|
<ul>
|
|
164
165
|
<li>Supports OpenAPI & Bluetooth Low Energy (BLE) Connections</li>
|
|
165
166
|
<li>If using OpenAPI:
|
|
166
167
|
<ul>
|
|
167
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini"
|
|
168
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini">SwitchBot Hub Mini</a> or <a href="https://us.switch-bot.com/products/switchbot-hub-2">SwitchBot Hub 2</a> Required</li>
|
|
168
169
|
<li>Enable Cloud Services for Device on SwitchBot App</li>
|
|
169
170
|
</ul>
|
|
170
171
|
</li>
|
|
@@ -176,70 +177,70 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
176
177
|
</li>
|
|
177
178
|
</ul>
|
|
178
179
|
</li>
|
|
179
|
-
<li><a href="https://us.switch-bot.com/products/switchbot-blind-tilt"
|
|
180
|
+
<li><a href="https://us.switch-bot.com/products/switchbot-blind-tilt">SwitchBot Blind Tilt</a>
|
|
180
181
|
<ul>
|
|
181
182
|
<li>Supports OpenAPI & partial Bluetooth Low Energy (BLE) Connections</li>
|
|
182
183
|
<li>If using OpenAPI:
|
|
183
184
|
<ul>
|
|
184
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini"
|
|
185
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini">SwitchBot Hub Mini</a> or <a href="https://us.switch-bot.com/products/switchbot-hub-2">SwitchBot Hub 2</a> Required</li>
|
|
185
186
|
<li>Enable Cloud Services for Device on SwitchBot App</li>
|
|
186
187
|
</ul>
|
|
187
188
|
</li>
|
|
188
189
|
</ul>
|
|
189
190
|
</li>
|
|
190
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-color-bulb"
|
|
191
|
-
<li><a href="https://www.switchbot.jp/collections/all/products/switchbot-ceiling-light"
|
|
192
|
-
<li><a href="https://www.switchbot.jp/collections/all/products/switchbot-ceiling-light"
|
|
193
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-light-strip"
|
|
191
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-color-bulb">SwitchBot Bulb</a></li>
|
|
192
|
+
<li><a href="https://www.switchbot.jp/collections/all/products/switchbot-ceiling-light">SwitchBot Ceiling Light</a></li>
|
|
193
|
+
<li><a href="https://www.switchbot.jp/collections/all/products/switchbot-ceiling-light">SwitchBot Ceiling Light Pro</a></li>
|
|
194
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-light-strip">SwitchBot Light Strip</a>
|
|
194
195
|
<ul>
|
|
195
196
|
<li>Supports OpenAPI & partial Bluetooth Low Energy (BLE) Connections</li>
|
|
196
197
|
<li>If using OpenAPI:
|
|
197
198
|
<ul>
|
|
198
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini"
|
|
199
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini">SwitchBot Hub Mini</a> or <a href="https://us.switch-bot.com/products/switchbot-hub-2">SwitchBot Hub 2</a> Required</li>
|
|
199
200
|
<li>Enable Cloud Services for Device on SwitchBot App</li>
|
|
200
201
|
</ul>
|
|
201
202
|
</li>
|
|
202
203
|
</ul>
|
|
203
204
|
</li>
|
|
204
|
-
<li><a href="https://us.switch-bot.com/products/switchbot-lock"
|
|
205
|
-
<li><a href="https://www.switchbot.jp/products/switchbot-lock-pro"
|
|
205
|
+
<li><a href="https://us.switch-bot.com/products/switchbot-lock">SwitchBot Lock</a></li>
|
|
206
|
+
<li><a href="https://www.switchbot.jp/products/switchbot-lock-pro">SwitchBot Lock Pro</a>
|
|
206
207
|
<ul>
|
|
207
208
|
<li>Supports OpenAPI & Bluetooth Low Energy (BLE) Connections</li>
|
|
208
209
|
<li>If using OpenAPI:
|
|
209
210
|
<ul>
|
|
210
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini"
|
|
211
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini">SwitchBot Hub Mini</a> or <a href="https://us.switch-bot.com/products/switchbot-hub-2">SwitchBot Hub 2</a> Required</li>
|
|
211
212
|
<li>Enable Cloud Services for Device on SwitchBot App</li>
|
|
212
213
|
</ul>
|
|
213
214
|
</li>
|
|
214
215
|
</ul>
|
|
215
216
|
</li>
|
|
216
|
-
<li>US: <a href="https://www.switch-bot.com/products/switchbot-mini-robot-vacuum-k10"
|
|
217
|
-
<li>US: <a href="https://www.switch-bot.com/products/switchbot-floor-cleaning-robot-s10"
|
|
218
|
-
<li>JP: <a href="https://www.switchbot.jp/products/switchbot-robot-vacuum-cleaner"
|
|
219
|
-
<li>JP: <a href="https://www.switchbot.jp/products/switchbot-robot-vacuum-cleaner"
|
|
217
|
+
<li>US: <a href="https://www.switch-bot.com/products/switchbot-mini-robot-vacuum-k10">SwitchBot Mini Robot Vacuum K10+</a></li>
|
|
218
|
+
<li>US: <a href="https://www.switch-bot.com/products/switchbot-floor-cleaning-robot-s10">SwitchBot Floor Cleaning Robot S10</a></li>
|
|
219
|
+
<li>JP: <a href="https://www.switchbot.jp/products/switchbot-robot-vacuum-cleaner">SwitchBot Robot Vacuum Cleaner S1</a></li>
|
|
220
|
+
<li>JP: <a href="https://www.switchbot.jp/products/switchbot-robot-vacuum-cleaner">SwitchBot Robot Vacuum Cleaner S1 Plus</a>
|
|
220
221
|
<ul>
|
|
221
222
|
<li>Supports OpenAPI Connection Only</li>
|
|
222
223
|
</ul>
|
|
223
224
|
</li>
|
|
224
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-plug"
|
|
225
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-plug-mini"
|
|
226
|
-
<li><a href="https://www.switchbot.jp/products/switchbot-plug-mini"
|
|
225
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-plug">SwitchBot Plug</a></li>
|
|
226
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-plug-mini">SwitchBot Plug Mini (US)</a></li>
|
|
227
|
+
<li><a href="https://www.switchbot.jp/products/switchbot-plug-mini">SwitchBot Plug Mini (JP)</a>
|
|
227
228
|
<ul>
|
|
228
229
|
<li>Supports OpenAPI & Bluetooth Low Energy (BLE) Connections</li>
|
|
229
230
|
<li>If using OpenAPI:
|
|
230
231
|
<ul>
|
|
231
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini"
|
|
232
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini">SwitchBot Hub Mini</a> or <a href="https://us.switch-bot.com/products/switchbot-hub-2">SwitchBot Hub 2</a> Required</li>
|
|
232
233
|
<li>Enable Cloud Services for Device on SwitchBot App</li>
|
|
233
234
|
</ul>
|
|
234
235
|
</li>
|
|
235
236
|
</ul>
|
|
236
237
|
</li>
|
|
237
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-bot"
|
|
238
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-bot">SwitchBot Bot</a>
|
|
238
239
|
<ul>
|
|
239
240
|
<li>Supports OpenAPI & Bluetooth Low Energy (BLE) Connections</li>
|
|
240
241
|
<li>If using OpenAPI:
|
|
241
242
|
<ul>
|
|
242
|
-
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini"
|
|
243
|
+
<li><a href="https://www.switch-bot.com/products/switchbot-hub-mini">SwitchBot Hub Mini</a> or <a href="https://us.switch-bot.com/products/switchbot-hub-2">SwitchBot Hub 2</a> Required</li>
|
|
243
244
|
<li>Enable Cloud Services for Device on SwitchBot App</li>
|
|
244
245
|
<li>You must set your Bot's Device ID for either Press Mode or Switch Mode in Plugin Config (SwitchBot Device Settings > Bot Settings)
|
|
245
246
|
<ul>
|
|
@@ -262,7 +263,7 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
262
263
|
</li>
|
|
263
264
|
</ul>
|
|
264
265
|
</li>
|
|
265
|
-
<li><a href="https://us.switch-bot.com/products/switchbot-hub-2"
|
|
266
|
+
<li><a href="https://us.switch-bot.com/products/switchbot-hub-2">SwitchBot Hub 2</a>
|
|
266
267
|
<ul>
|
|
267
268
|
<li>Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
|
|
268
269
|
<ul>
|
|
@@ -271,18 +272,18 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
271
272
|
</li>
|
|
272
273
|
</ul>
|
|
273
274
|
</li>
|
|
274
|
-
<li><a href="https://us.switch-bot.com/products/switchbot-battery-circulator-fan"
|
|
275
|
+
<li><a href="https://us.switch-bot.com/products/switchbot-battery-circulator-fan">SwitchBot Battery Circulator Fan</a>
|
|
275
276
|
<ul>
|
|
276
277
|
<li>Supports OpenAPI Connection Only</li>
|
|
277
278
|
</ul>
|
|
278
279
|
</li>
|
|
279
|
-
<li><a href="https://us.switch-bot.com/products/switchbot-water-leak-detector"
|
|
280
|
+
<li><a href="https://us.switch-bot.com/products/switchbot-water-leak-detector">SwitchBot Water Leak Detector</a>
|
|
280
281
|
<ul>
|
|
281
282
|
<li>Supports OpenAPI & Bluetooth Low Energy (BLE) Connections</li>
|
|
282
283
|
</ul>
|
|
283
284
|
</li>
|
|
284
285
|
</ul>
|
|
285
|
-
<a id="supported-ir-devices" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Supported IR Devices<a href="#supported-ir-devices" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="all-ir-devices-require-switchbot-hub-2-or-hub-mini" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><em>(All IR Devices require <a href="https://us.switch-bot.com/products/switchbot-hub-2"
|
|
286
|
+
<a id="supported-ir-devices" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Supported IR Devices<a href="#supported-ir-devices" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="all-ir-devices-require-switchbot-hub-2-or-hub-mini" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><em>(All IR Devices require <a href="https://us.switch-bot.com/products/switchbot-hub-2">SwitchBot Hub 2</a> or <a href="https://www.switch-bot.com/products/switchbot-hub-mini">Hub Mini</a>)</em><a href="#all-ir-devices-require-switchbot-hub-2-or-hub-mini" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><ul>
|
|
286
287
|
<li>TV
|
|
287
288
|
<ul>
|
|
288
289
|
<li>Allows for On/Off and Volume Controls</li>
|
|
@@ -364,16 +365,16 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
364
365
|
</li>
|
|
365
366
|
</ul>
|
|
366
367
|
<a id="switchbot-apis" class="tsd-anchor"></a><h2 class="tsd-anchor-link">SwitchBot APIs<a href="#switchbot-apis" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><ul>
|
|
367
|
-
<li><a href="https://github.com/OpenWonderLabs/node-switchbot"
|
|
368
|
+
<li><a href="https://github.com/OpenWonderLabs/node-switchbot">OpenWonderLabs/node-switchbot</a>
|
|
368
369
|
<ul>
|
|
369
|
-
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI"
|
|
370
|
-
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI-BLE"
|
|
370
|
+
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI">OpenWonderLabs/SwitchBotAPI</a></li>
|
|
371
|
+
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI-BLE">OpenWonderLabs/SwitchBotAPI-BLE</a></li>
|
|
371
372
|
</ul>
|
|
372
373
|
</li>
|
|
373
374
|
</ul>
|
|
374
375
|
<a id="community" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Community<a href="#community" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><ul>
|
|
375
|
-
<li><a href="https://www.switch-bot.com/"
|
|
376
|
-
<li><a href="https://www.facebook.com/SwitchBotRobot/"
|
|
377
|
-
<li><a href="https://twitter.com/switchbot"
|
|
376
|
+
<li><a href="https://www.switch-bot.com/">SwitchBot (Official website)</a></li>
|
|
377
|
+
<li><a href="https://www.facebook.com/SwitchBotRobot/">Facebook @SwitchBotRobot</a></li>
|
|
378
|
+
<li><a href="https://twitter.com/switchbot">Twitter @SwitchBot</a></li>
|
|
378
379
|
</ul>
|
|
379
|
-
</div></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><details open class="tsd-accordion tsd-page-navigation"><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>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#switchbothomebridge-switchbot"><span>@switchbot/homebridge-<wbr/>switchbot</span></a><ul><li><a href="#installation"><span>Installation</span></a></li><li><a href="#configuration"><span>Configuration</span></a></li><li><ul><li><a href="#if-using-openapi-connection"><span>If using <wbr/>OpenAPI <wbr/>Connection</span></a></li><li><a href="#if-using-ble-connection"><span>If using BLE <wbr/>Connection</span></a></li></ul></li><li><a href="#troubleshooting"><span>Troubleshooting</span></a></li><li><ul><li><a href="#if-using-linux--raspberry-pi-os"><span>If using <wbr/>Linux / <wbr/>Raspberry <wbr/>Pi OS</span></a></li><li><a href="#if-using-macos"><span>If using <wbr/>MacOS</span></a></li></ul></li><li><a href="#supported-switchbot-devices"><span>Supported <wbr/>Switch<wbr/>Bot <wbr/>Devices</span></a></li><li><a href="#supported-ir-devices"><span>Supported IR <wbr/>Devices</span></a></li><li><ul><li><a href="#all-ir-devices-require-switchbot-hub-2-or-hub-mini"><span>(<wbr/>All IR <wbr/>Devices require <wbr/>Switch<wbr/>Bot <wbr/>Hub 2 or <wbr/>Hub <wbr/>Mini)</span></a></li></ul></li><li><a href="#switchbot-apis"><span>Switch<wbr/>Bot APIs</span></a></li><li><a href="#community"><span>Community</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html"
|
|
380
|
+
</div></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><details open class="tsd-accordion tsd-page-navigation"><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>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#switchbothomebridge-switchbot"><span>@switchbot/homebridge-<wbr/>switchbot</span></a><ul><li><a href="#installation"><span>Installation</span></a></li><li><a href="#configuration"><span>Configuration</span></a></li><li><ul><li><a href="#if-using-openapi-connection"><span>If using <wbr/>OpenAPI <wbr/>Connection</span></a></li><li><a href="#if-using-ble-connection"><span>If using BLE <wbr/>Connection</span></a></li></ul></li><li><a href="#troubleshooting"><span>Troubleshooting</span></a></li><li><ul><li><a href="#if-using-linux--raspberry-pi-os"><span>If using <wbr/>Linux / <wbr/>Raspberry <wbr/>Pi OS</span></a></li><li><a href="#if-using-macos"><span>If using <wbr/>MacOS</span></a></li></ul></li><li><a href="#supported-switchbot-devices"><span>Supported <wbr/>Switch<wbr/>Bot <wbr/>Devices</span></a></li><li><a href="#supported-ir-devices"><span>Supported IR <wbr/>Devices</span></a></li><li><ul><li><a href="#all-ir-devices-require-switchbot-hub-2-or-hub-mini"><span>(<wbr/>All IR <wbr/>Devices require <wbr/>Switch<wbr/>Bot <wbr/>Hub 2 or <wbr/>Hub <wbr/>Mini)</span></a></li></ul></li><li><a href="#switchbot-apis"><span>Switch<wbr/>Bot APIs</span></a></li><li><a href="#community"><span>Community</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">@switchbot/homebridge-switchbot</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><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.7-beta.
|
|
5
|
+
"version": "4.1.7-beta.6",
|
|
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": [
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"watch": "npm run build && npm run plugin-ui && npm link && nodemon",
|
|
66
66
|
"plugin-ui": "rsync ./src/homebridge-ui/public/index.html ./dist/homebridge-ui/public/",
|
|
67
67
|
"build": "npm run clean && tsc && npm run plugin-ui",
|
|
68
|
-
"prepublishOnly": "npm run lint && npm run build && npm run plugin-ui ",
|
|
68
|
+
"prepublishOnly": "npm run lint && npm run build && npm run plugin-ui && npm run docs && npm run lint-docs",
|
|
69
69
|
"postpublish": "npm run clean && npm ci",
|
|
70
70
|
"clean": "shx rm -rf ./dist",
|
|
71
71
|
"test": "npm run lint",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"async-mqtt": "^2.6.3",
|
|
81
81
|
"fakegato-history": "^0.6.5",
|
|
82
82
|
"homebridge-lib": "^7.1.1",
|
|
83
|
-
"node-switchbot": "^3.4.3-beta.
|
|
83
|
+
"node-switchbot": "^3.4.3-beta.6",
|
|
84
84
|
"rxjs": "^7.8.1"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
package/src/device/device.ts
CHANGED
|
@@ -361,12 +361,12 @@ export abstract class deviceBase {
|
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
async pushChangeRequest(bodyChange: bodyChange): Promise<{ body: pushResponse['body'], statusCode: pushResponse['statusCode'] }> {
|
|
364
|
-
const { response, statusCode } = await this.platform.
|
|
364
|
+
const { response, statusCode } = await this.platform.retryCommand(this.device, bodyChange, this.deviceMaxRetries, this.deviceDelayBetweenRetries)
|
|
365
365
|
return { body: response, statusCode }
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
async deviceRefreshStatus(): Promise<{ body: deviceStatus, statusCode: deviceStatusRequest['statusCode'] }> {
|
|
369
|
-
const { response, statusCode } = await this.platform.retryRequest(this.device
|
|
369
|
+
const { response, statusCode } = await this.platform.retryRequest(this.device, this.deviceMaxRetries, this.deviceDelayBetweenRetries)
|
|
370
370
|
return { body: response, statusCode }
|
|
371
371
|
}
|
|
372
372
|
|
package/src/irdevice/irdevice.ts
CHANGED
|
@@ -168,7 +168,7 @@ export abstract class irdeviceBase {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
async pushChangeRequest(bodyChange: bodyChange): Promise<{ body: any, statusCode: number }> {
|
|
171
|
-
const { response, statusCode } = await this.platform.
|
|
171
|
+
const { response, statusCode } = await this.platform.retryCommand(this.device, bodyChange, this.deviceMaxRetries, this.deviceDelayBetweenRetries)
|
|
172
172
|
return { body: response, statusCode }
|
|
173
173
|
}
|
|
174
174
|
|
package/src/platform.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { MqttClient } from 'mqtt'
|
|
|
11
11
|
* import type { blindTilt, curtain, curtain3, device, irdevice } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
12
12
|
* import { LogLevel, SwitchBotBLE, SwitchBotModel, SwitchBotOpenAPI } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
13
13
|
*/
|
|
14
|
-
import type { blindTilt, curtain, curtain3, device, deviceStatus, deviceStatusRequest, irdevice } from 'node-switchbot'
|
|
14
|
+
import type { blindTilt, bodyChange, curtain, curtain3, device, deviceStatus, deviceStatusRequest, irdevice } from 'node-switchbot'
|
|
15
15
|
|
|
16
16
|
import type { blindTiltConfig, curtainConfig, devicesConfig, irDevicesConfig, options, SwitchBotPlatformConfig } from './settings.js'
|
|
17
17
|
|
|
@@ -2601,13 +2601,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
2601
2601
|
}
|
|
2602
2602
|
}
|
|
2603
2603
|
|
|
2604
|
-
async retryRequest(
|
|
2604
|
+
async retryRequest(device: (device & devicesConfig) | (irdevice & irDevicesConfig), deviceMaxRetries: number, deviceDelayBetweenRetries: number): Promise<{ response: any, statusCode: deviceStatusRequest['statusCode'] }> {
|
|
2605
2605
|
let retryCount = 0
|
|
2606
2606
|
const maxRetries = deviceMaxRetries
|
|
2607
2607
|
const delayBetweenRetries = deviceDelayBetweenRetries
|
|
2608
2608
|
while (retryCount < maxRetries) {
|
|
2609
2609
|
try {
|
|
2610
|
-
const { response, statusCode } = await this.switchBotAPI.getDeviceStatus(deviceId, this.config.credentials?.token, this.config.credentials?.secret)
|
|
2610
|
+
const { response, statusCode } = await this.switchBotAPI.getDeviceStatus(device.deviceId, this.config.credentials?.token, this.config.credentials?.secret)
|
|
2611
2611
|
this.debugLog(`response: ${JSON.stringify(response)}`)
|
|
2612
2612
|
return { response, statusCode }
|
|
2613
2613
|
} catch (error: any) {
|
|
@@ -2627,6 +2627,25 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
2627
2627
|
}, statusCode: 500 }
|
|
2628
2628
|
}
|
|
2629
2629
|
|
|
2630
|
+
async retryCommand(device: (device & devicesConfig) | (irdevice & irDevicesConfig), bodyChange: bodyChange, deviceMaxRetries?: number, deviceDelayBetweenRetries?: number): Promise<{ response: any, statusCode: number }> {
|
|
2631
|
+
let retryCount = 0
|
|
2632
|
+
const maxRetries = deviceMaxRetries ?? 1
|
|
2633
|
+
const delayBetweenRetries = deviceDelayBetweenRetries ?? 1000
|
|
2634
|
+
while (retryCount < maxRetries) {
|
|
2635
|
+
try {
|
|
2636
|
+
const { response, statusCode } = await this.switchBotAPI.controlDevice(device.deviceId, bodyChange.command, bodyChange.parameter, bodyChange.commandType, this.config.credentials?.token, this.config.credentials?.secret)
|
|
2637
|
+
this.debugLog(`response: ${JSON.stringify(response)}`)
|
|
2638
|
+
return { response, statusCode }
|
|
2639
|
+
} catch (error: any) {
|
|
2640
|
+
this.errorLog(`Error making request: ${error.message}`)
|
|
2641
|
+
}
|
|
2642
|
+
retryCount++
|
|
2643
|
+
this.debugLog(`Retry attempt ${retryCount} of ${maxRetries}`)
|
|
2644
|
+
await sleep(delayBetweenRetries)
|
|
2645
|
+
}
|
|
2646
|
+
return { response: {}, statusCode: 500 }
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2630
2649
|
// BLE Connection
|
|
2631
2650
|
async connectBLE(accessory: PlatformAccessory, device: device & devicesConfig): Promise<any> {
|
|
2632
2651
|
try {
|