@switchbot/homebridge-switchbot 4.3.3 → 4.3.4
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/CHANGELOG.md +426 -0
- package/README.md +10 -0
- package/config.schema.json +480 -2
- package/dist/device/blindtilt.d.ts +1 -1
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +1 -1
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +12 -0
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts +1 -1
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +4 -4
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +4 -4
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/meterpro.d.ts +1 -1
- package/dist/device/meterpro.d.ts.map +1 -1
- package/dist/device/meterpro.js.map +1 -1
- package/dist/device/motion.d.ts +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js.map +1 -1
- package/dist/device/presence.d.ts +1 -1
- package/dist/device/presence.d.ts.map +1 -1
- package/dist/device/presence.js.map +1 -1
- package/dist/device/relayswitch.d.ts +1 -1
- package/dist/device/relayswitch.d.ts.map +1 -1
- package/dist/device/relayswitch.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +4 -2
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +1 -1
- package/dist/settings.d.ts.map +1 -1
- package/docs/assets/highlight.css +14 -0
- package/docs/assets/icons.js +1 -1
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +2 -2
- package/docs/assets/style.css +3 -3
- package/docs/index.html +41 -13
- package/docs/variables/default.html +1 -1
- package/eslint.config.js +1 -5
- package/package.json +15 -21
- package/src/device/blindtilt.ts +2 -4
- package/src/device/bot.ts +2 -4
- package/src/device/ceilinglight.ts +2 -4
- package/src/device/colorbulb.ts +2 -4
- package/src/device/contact.ts +2 -4
- package/src/device/curtain.ts +6 -8
- package/src/device/device.ts +19 -9
- package/src/device/fan.ts +2 -4
- package/src/device/hub.ts +3 -5
- package/src/device/humidifier.ts +2 -4
- package/src/device/iosensor.ts +3 -5
- package/src/device/lightstrip.ts +2 -4
- package/src/device/lock.ts +12 -14
- package/src/device/meter.ts +3 -5
- package/src/device/meterplus.ts +3 -5
- package/src/device/meterpro.ts +3 -5
- package/src/device/motion.ts +2 -4
- package/src/device/plug.ts +2 -4
- package/src/device/presence.ts +2 -4
- package/src/device/relayswitch.ts +2 -4
- package/src/device/robotvacuumcleaner.ts +2 -4
- package/src/device/waterdetector.ts +2 -4
- package/src/irdevice/airconditioner.ts +0 -1
- package/src/irdevice/airpurifier.ts +0 -1
- package/src/irdevice/camera.ts +0 -1
- package/src/irdevice/fan.ts +0 -1
- package/src/irdevice/light.ts +0 -1
- package/src/irdevice/other.ts +0 -1
- package/src/irdevice/tv.ts +0 -1
- package/src/irdevice/vacuumcleaner.ts +0 -1
- package/src/irdevice/waterheater.ts +0 -1
- package/src/platform.ts +4 -2
- package/src/settings.ts +1 -1
package/docs/index.html
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
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(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="index.html" class="title">@switchbot/homebridge-switchbot</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-menu"></use></svg></a></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
|
-
<h1 id="switchbothomebridge-switchbot" class="tsd-anchor-link">@switchbot/homebridge-switchbot<a href="#switchbothomebridge-switchbot" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1
|
|
3
|
+
<h1 id="switchbothomebridge-switchbot" class="tsd-anchor-link">@switchbot/homebridge-switchbot<a href="#switchbothomebridge-switchbot" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1>
|
|
4
|
+
<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
5
|
<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
6
|
<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
7
|
<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
8
|
<a href="https://homebridge.io">Homebridge</a>.
|
|
8
9
|
</p>
|
|
9
10
|
</span>
|
|
10
|
-
<h2 id="installation" class="tsd-anchor-link">Installation<a href="#installation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2
|
|
11
|
+
<h2 id="installation" class="tsd-anchor-link">Installation<a href="#installation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
|
|
12
|
+
<ol>
|
|
11
13
|
<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
14
|
<li>Find: <code>@switchbot/homebridge-switchbot</code>
|
|
13
15
|
<ul>
|
|
@@ -16,9 +18,11 @@
|
|
|
16
18
|
</li>
|
|
17
19
|
<li>Click <strong>Install</strong></li>
|
|
18
20
|
</ol>
|
|
19
|
-
<h2 id="configuration" class="tsd-anchor-link">Configuration<a href="#configuration" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2
|
|
21
|
+
<h2 id="configuration" class="tsd-anchor-link">Configuration<a href="#configuration" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
|
|
22
|
+
<ul>
|
|
20
23
|
<li>
|
|
21
|
-
<h3 id="if-using-openapi-connection" class="tsd-anchor-link">If using OpenAPI Connection<a href="#if-using-openapi-connection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3
|
|
24
|
+
<h3 id="if-using-openapi-connection" class="tsd-anchor-link">If using OpenAPI Connection<a href="#if-using-openapi-connection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
|
|
25
|
+
<ol>
|
|
22
26
|
<li>Download SwitchBot App on App Store or Google Play Store</li>
|
|
23
27
|
<li>Register a SwitchBot account and log in into your account</li>
|
|
24
28
|
<li>Generate an Token within the App
|
|
@@ -44,7 +48,8 @@
|
|
|
44
48
|
</ol>
|
|
45
49
|
</li>
|
|
46
50
|
<li>
|
|
47
|
-
<h3 id="if-using-ble-connection" class="tsd-anchor-link">If using BLE Connection<a href="#if-using-ble-connection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3
|
|
51
|
+
<h3 id="if-using-ble-connection" class="tsd-anchor-link">If using BLE Connection<a href="#if-using-ble-connection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
|
|
52
|
+
<ol>
|
|
48
53
|
<li>Download SwitchBot App on App Store or Google Play Store</li>
|
|
49
54
|
<li>Register a SwitchBot account and log in into your account</li>
|
|
50
55
|
<li>Click on Device wanting to connect too plugin
|
|
@@ -58,9 +63,11 @@
|
|
|
58
63
|
</ol>
|
|
59
64
|
</li>
|
|
60
65
|
</ul>
|
|
61
|
-
<h2 id="troubleshooting" class="tsd-anchor-link">Troubleshooting<a href="#troubleshooting" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2
|
|
66
|
+
<h2 id="troubleshooting" class="tsd-anchor-link">Troubleshooting<a href="#troubleshooting" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
|
|
67
|
+
<ul>
|
|
62
68
|
<li>
|
|
63
|
-
<h3 id="if-using-linux
|
|
69
|
+
<h3 id="if-using-linux-raspberry-pi-os" class="tsd-anchor-link">If using Linux / Raspberry Pi OS<a href="#if-using-linux-raspberry-pi-os" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
|
|
70
|
+
<ol>
|
|
64
71
|
<li>
|
|
65
72
|
<p><code>bluetoothctl</code> must be installed on the device, otherwise it cannot communicate via Bluetooth. Enable it with <code>sudo bluetoothctl power on</code>.</p>
|
|
66
73
|
</li>
|
|
@@ -82,7 +89,8 @@
|
|
|
82
89
|
</ol>
|
|
83
90
|
</li>
|
|
84
91
|
<li>
|
|
85
|
-
<h3 id="if-using-macos" 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" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3
|
|
92
|
+
<h3 id="if-using-macos" 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" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
|
|
93
|
+
<ol>
|
|
86
94
|
<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
95
|
<img src="media/security-privacy-bluetooth.png" alt="Security & Privacy -> Privacy">
|
|
88
96
|
(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>.
|
|
@@ -93,7 +101,8 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
93
101
|
|
|
94
102
|
</li>
|
|
95
103
|
</ul>
|
|
96
|
-
<h2 id="supported-switchbot-devices" 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" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2
|
|
104
|
+
<h2 id="supported-switchbot-devices" 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" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
|
|
105
|
+
<ul>
|
|
97
106
|
<li><a href="https://www.switch-bot.com/products/switchbot-smart-humidifier">SwitchBot Humidifier</a>
|
|
98
107
|
<ul>
|
|
99
108
|
<li>Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
|
|
@@ -292,7 +301,9 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
292
301
|
</ul>
|
|
293
302
|
</li>
|
|
294
303
|
</ul>
|
|
295
|
-
<h2 id="supported-ir-devices" 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" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2
|
|
304
|
+
<h2 id="supported-ir-devices" 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" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
|
|
305
|
+
<h3 id="all-ir-devices-require-switchbot-hub-2-switchbot-hub-3-or-hub-mini" class="tsd-anchor-link"><em>(All IR Devices require <a href="https://us.switch-bot.com/products/switchbot-hub-2">SwitchBot Hub 2</a>, <a href="https://us.switch-bot.com/products/switchbot-hub-3">SwitchBot Hub 3</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-switchbot-hub-3-or-hub-mini" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
|
|
306
|
+
<ul>
|
|
296
307
|
<li>TV
|
|
297
308
|
<ul>
|
|
298
309
|
<li>Allows for On/Off and Volume Controls</li>
|
|
@@ -373,7 +384,8 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
373
384
|
</ul>
|
|
374
385
|
</li>
|
|
375
386
|
</ul>
|
|
376
|
-
<h2 id="switchbot-apis" class="tsd-anchor-link">SwitchBot APIs<a href="#switchbot-apis" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2
|
|
387
|
+
<h2 id="switchbot-apis" class="tsd-anchor-link">SwitchBot APIs<a href="#switchbot-apis" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
|
|
388
|
+
<ul>
|
|
377
389
|
<li><a href="https://github.com/OpenWonderLabs/node-switchbot">OpenWonderLabs/node-switchbot</a>
|
|
378
390
|
<ul>
|
|
379
391
|
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI">OpenWonderLabs/SwitchBotAPI</a></li>
|
|
@@ -381,9 +393,25 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
381
393
|
</ul>
|
|
382
394
|
</li>
|
|
383
395
|
</ul>
|
|
384
|
-
<h2 id="
|
|
396
|
+
<h2 id="development-tests" class="tsd-anchor-link">Development / Tests<a href="#development-tests" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
|
|
397
|
+
<ul>
|
|
398
|
+
<li>
|
|
399
|
+
<p>Run unit tests:</p>
|
|
400
|
+
<pre><code class="bash"><span class="hl-6">npm</span><span class="hl-1"> </span><span class="hl-7">run</span><span class="hl-1"> </span><span class="hl-7">test</span>
|
|
401
|
+
</code><button type="button">Copy</button></pre>
|
|
402
|
+
|
|
403
|
+
</li>
|
|
404
|
+
<li>
|
|
405
|
+
<p>Notes:</p>
|
|
406
|
+
<ul>
|
|
407
|
+
<li>Added Lock Ultra (Cloud + BLE) support (requires <code>node-switchbot</code> v3.6.3).</li>
|
|
408
|
+
</ul>
|
|
409
|
+
</li>
|
|
410
|
+
</ul>
|
|
411
|
+
<h2 id="community" class="tsd-anchor-link">Community<a href="#community" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
|
|
412
|
+
<ul>
|
|
385
413
|
<li><a href="https://www.switch-bot.com/">SwitchBot (Official website)</a></li>
|
|
386
414
|
<li><a href="https://www.facebook.com/SwitchBotRobot/">Facebook @SwitchBotRobot</a></li>
|
|
387
415
|
<li><a href="https://twitter.com/switchbot">Twitter @SwitchBot</a></li>
|
|
388
416
|
</ul>
|
|
389
|
-
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>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"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>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/>Open<wbr/>API <wbr/>Connection</span></a></li><li><a href="#if-using-ble-connection"><span>If using <wbr/>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
|
|
417
|
+
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>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"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>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/>Open<wbr/>API <wbr/>Connection</span></a></li><li><a href="#if-using-ble-connection"><span>If using <wbr/>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 <wbr/>OS</span></a></li><li><a href="#if-using-macos"><span>If using <wbr/>Mac<wbr/>OS</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 <wbr/>IR <wbr/>Devices</span></a></li><li><ul><li><a href="#all-ir-devices-require-switchbot-hub-2-switchbot-hub-3-or-hub-mini"><span>(<wbr/>All <wbr/>IR <wbr/>Devices require <wbr/>Switch<wbr/>Bot <wbr/>Hub 2, <wbr/>Switch<wbr/>Bot <wbr/>Hub 3, or <wbr/>Hub <wbr/>Mini)</span></a></li></ul></li><li><a href="#switchbot-apis"><span>Switch<wbr/>Bot <wbr/>AP<wbr/>Is</span></a></li><li><a href="#development-tests"><span>Development / <wbr/>Tests</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>
|
|
@@ -1 +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>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(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">default</a></li></ul><h1>Variable default</h1></div><div class="tsd-signature"><span class="tsd-kind-variable">default</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-type-declaration"><h4>Type
|
|
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>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(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">default</a></li></ul><h1>Variable default</h1></div><div class="tsd-signature"><span class="tsd-kind-variable">default</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-type-declaration"><h4>Type Declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="__type"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></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></li></ul></li></ul></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/fc89c5e049d1b8be1e0c7e6e046b219399b988b6/src/index.ts#L11">index.ts:11</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>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">@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/eslint.config.js
CHANGED
|
@@ -16,16 +16,12 @@ export default antfu(
|
|
|
16
16
|
'perfectionist/sort-imports': [
|
|
17
17
|
'error',
|
|
18
18
|
{
|
|
19
|
+
// Use groups supported by the installed perfectionist version.
|
|
19
20
|
groups: [
|
|
20
|
-
'builtin-type',
|
|
21
|
-
'external-type',
|
|
22
|
-
'internal-type',
|
|
23
|
-
['parent-type', 'sibling-type', 'index-type'],
|
|
24
21
|
'builtin',
|
|
25
22
|
'external',
|
|
26
23
|
'internal',
|
|
27
24
|
['parent', 'sibling', 'index'],
|
|
28
|
-
'object',
|
|
29
25
|
'unknown',
|
|
30
26
|
],
|
|
31
27
|
order: 'asc',
|
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.3.
|
|
5
|
+
"version": "4.3.4",
|
|
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": [
|
|
@@ -78,33 +78,27 @@
|
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@homebridge/plugin-ui-utils": "^2.1.
|
|
81
|
+
"@homebridge/plugin-ui-utils": "^2.1.2",
|
|
82
82
|
"async-mqtt": "^2.6.3",
|
|
83
83
|
"fakegato-history": "^0.6.7",
|
|
84
|
-
"homebridge-lib": "^7.
|
|
85
|
-
"node-switchbot": "^3.6.
|
|
84
|
+
"homebridge-lib": "^7.3.0",
|
|
85
|
+
"node-switchbot": "^3.6.3",
|
|
86
86
|
"rxjs": "^7.8.2"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@antfu/eslint-config": "^
|
|
90
|
-
"@types/
|
|
91
|
-
"@
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"@vitest/coverage-v8": "^3.2.4",
|
|
98
|
-
"eslint": "^9.32.0",
|
|
99
|
-
"eslint-plugin-format": "^1.0.1",
|
|
100
|
-
"homebridge": "^1.11.0",
|
|
101
|
-
"homebridge-config-ui-x": "5.3.0",
|
|
102
|
-
"nodemon": "^3.1.10",
|
|
89
|
+
"@antfu/eslint-config": "^7.2.0",
|
|
90
|
+
"@types/node": "^25.2.1",
|
|
91
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
92
|
+
"eslint": "^9.39.2",
|
|
93
|
+
"eslint-plugin-format": "^1.3.1",
|
|
94
|
+
"homebridge": "^1.11.1",
|
|
95
|
+
"homebridge-config-ui-x": "5.15.2",
|
|
96
|
+
"nodemon": "^3.1.11",
|
|
103
97
|
"shx": "^0.4.0",
|
|
104
98
|
"ts-node": "^10.9.2",
|
|
105
|
-
"typedoc": "^0.28.
|
|
106
|
-
"typescript": "^5.
|
|
107
|
-
"vitest": "^
|
|
99
|
+
"typedoc": "^0.28.16",
|
|
100
|
+
"typescript": "^5.9.3",
|
|
101
|
+
"vitest": "^4.0.18"
|
|
108
102
|
},
|
|
109
103
|
"directories": {
|
|
110
104
|
"doc": "docs"
|
package/src/device/blindtilt.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { blindTiltServiceData, blindTiltStatus, blindTiltWebhookContext, bodyChange, device, SwitchBotBLE, SwitchbotDevice, WoBlindTilt } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { blindTiltConfig, devicesConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { blindTiltConfig, devicesConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { blindTiltConfig, devicesConfig } from '../settings.js'
|
|
18
16
|
import { BlindTiltMappingMode, formatDeviceIdAsMac } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
package/src/device/bot.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { bodyChange, botServiceData, botStatus, botWebhookContext, device, SwitchBotBLE, SwitchbotDevice, WoHand } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { botConfig, devicesConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { botConfig, devicesConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { botConfig, devicesConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, Controller, ControllerConstructor, ControllerServiceMap, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { bodyChange, ceilingLightProServiceData, ceilingLightProStatus, ceilingLightProWebhookContext, ceilingLightServiceData, ceilingLightStatus, ceilingLightWebhookContext, device, SwitchBotBLE, SwitchbotDevice, WoCeilingLight } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { ceilingLightConfig, devicesConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { ceilingLightConfig, devicesConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { ceilingLightConfig, devicesConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac, hs2rgb, m2hs } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
package/src/device/colorbulb.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, Controller, ControllerConstructor, ControllerServiceMap, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { bodyChange, colorBulbServiceData, colorBulbStatus, colorBulbWebhookContext, device, SwitchBotBLE, SwitchbotDevice, WoBulb } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { colorBulbConfig, devicesConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { colorBulbConfig, devicesConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { colorBulbConfig, devicesConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac, hs2rgb, m2hs, rgb2hs } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
package/src/device/contact.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { contactSensorServiceData, contactSensorStatus, contactSensorWebhookContext, device, SwitchBotBLE } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { contactConfig, devicesConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { contactConfig, devicesConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { interval, skipWhile, Subject } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { contactConfig, devicesConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
package/src/device/curtain.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
+
import { hostname } from 'node:os'
|
|
2
|
+
|
|
1
3
|
/* Copyright(C) 2021-2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
|
|
2
4
|
*
|
|
3
5
|
* curtain.ts: @switchbot/homebridge-switchbot.
|
|
4
6
|
*/
|
|
5
7
|
import type { CharacteristicChange, CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
8
|
import type { bodyChange, curtain3ServiceData, curtain3WebhookContext, curtainServiceData, curtainStatus, curtainWebhookContext, device, SwitchBotBLE, SwitchbotDevice, WoCurtain } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { curtainConfig, devicesConfig } from '../settings.js'
|
|
10
|
-
|
|
11
|
-
import { hostname } from 'node:os'
|
|
12
|
-
|
|
13
9
|
/*
|
|
14
10
|
* For Testing Locally:
|
|
15
11
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -17,6 +13,8 @@ import { hostname } from 'node:os'
|
|
|
17
13
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
18
14
|
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
19
15
|
|
|
16
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
17
|
+
import type { curtainConfig, devicesConfig } from '../settings.js'
|
|
20
18
|
import { formatDeviceIdAsMac, isCurtainDevice } from '../utils.js'
|
|
21
19
|
import { deviceBase } from './device.js'
|
|
22
20
|
|
|
@@ -332,8 +330,8 @@ export class Curtain extends deviceBase {
|
|
|
332
330
|
filename: `${hostname().split('.')[0]}_${this.device.bleMac}_persist.json`,
|
|
333
331
|
})
|
|
334
332
|
const motion: Service
|
|
335
|
-
|
|
336
|
-
|
|
333
|
+
= this.accessory.getService(this.hap.Service.MotionSensor)
|
|
334
|
+
|| this.accessory.addService(this.hap.Service.MotionSensor, 'Motion')
|
|
337
335
|
motion.addOptionalCharacteristic(this.platform.eve.Characteristics.LastActivation)
|
|
338
336
|
motion.getCharacteristic(this.platform.eve.Characteristics.LastActivation).onGet(() => {
|
|
339
337
|
const lastActivation = this.accessory.context.lastActivation
|
package/src/device/device.ts
CHANGED
|
@@ -3,17 +3,15 @@
|
|
|
3
3
|
* device.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { hostname } from 'node:os'
|
|
7
|
+
|
|
6
8
|
import type { API, CharacteristicValue, HAP, Logging, PlatformAccessory, Service } from 'homebridge'
|
|
7
9
|
import type { MqttClient } from 'mqtt'
|
|
8
10
|
import type { ad, bodyChange, device, deviceStatus, deviceStatusRequest, pushResponse, SwitchBotBLE } from 'node-switchbot'
|
|
11
|
+
import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName, SwitchBotModel } from 'node-switchbot'
|
|
9
12
|
|
|
10
13
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
11
14
|
import type { blindTiltConfig, botConfig, ceilingLightConfig, colorBulbConfig, contactConfig, curtainConfig, devicesConfig, hubConfig, humidifierConfig, indoorOutdoorSensorConfig, lockConfig, meterConfig, motionConfig, plugConfig, relaySwitch1Config, relaySwitch1PMConfig, stripLightConfig, SwitchBotPlatformConfig, waterDetectorConfig } from '../settings.js'
|
|
12
|
-
|
|
13
|
-
import { hostname } from 'node:os'
|
|
14
|
-
|
|
15
|
-
import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName, SwitchBotModel } from 'node-switchbot'
|
|
16
|
-
|
|
17
15
|
import { formatDeviceIdAsMac, safeStringify, sleep } from '../utils.js'
|
|
18
16
|
|
|
19
17
|
export abstract class deviceBase {
|
|
@@ -289,10 +287,10 @@ export abstract class deviceBase {
|
|
|
289
287
|
this.debugLog(`bleMac: ${this.device.bleMac}`)
|
|
290
288
|
this.historyService = device.history
|
|
291
289
|
? new this.platform.fakegatoAPI('room', accessory, {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
290
|
+
log: this.platform.log,
|
|
291
|
+
storage: 'fs',
|
|
292
|
+
filename: `${hostname().split('.')[0]}_${this.device.bleMac}_persist.json`,
|
|
293
|
+
})
|
|
296
294
|
: null
|
|
297
295
|
} catch (error) {
|
|
298
296
|
this.errorLog(`failed to format device ID as MAC, Error: ${error}`)
|
|
@@ -584,6 +582,18 @@ export abstract class deviceBase {
|
|
|
584
582
|
bleModelName: SwitchBotBLEModelName.LockPro,
|
|
585
583
|
bleModelFriendlyName: SwitchBotBLEModelFriendlyName.LockPro,
|
|
586
584
|
},
|
|
585
|
+
'Smart Lock Ultra': {
|
|
586
|
+
model: SwitchBotModel.LockUltra,
|
|
587
|
+
bleModel: SwitchBotBLEModel.LockUltra,
|
|
588
|
+
bleModelName: SwitchBotBLEModelName.LockUltra,
|
|
589
|
+
bleModelFriendlyName: SwitchBotBLEModelFriendlyName.LockUltra,
|
|
590
|
+
},
|
|
591
|
+
'Lock Ultra': {
|
|
592
|
+
model: SwitchBotModel.LockUltra,
|
|
593
|
+
bleModel: SwitchBotBLEModel.LockUltra,
|
|
594
|
+
bleModelName: SwitchBotBLEModelName.LockUltra,
|
|
595
|
+
bleModelFriendlyName: SwitchBotBLEModelFriendlyName.LockUltra,
|
|
596
|
+
},
|
|
587
597
|
'Color Bulb': {
|
|
588
598
|
model: SwitchBotModel.ColorBulb,
|
|
589
599
|
bleModel: SwitchBotBLEModel.ColorBulb,
|
package/src/device/fan.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { batteryCirculatorFanServiceData, batteryCirculatorFanStatus, batteryCirculatorFanWebhookContext, bodyChange, device, SwitchBotBLE, SwitchbotDevice } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { devicesConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { devicesConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
package/src/device/hub.ts
CHANGED
|
@@ -3,12 +3,8 @@
|
|
|
3
3
|
* hub.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
-
import type { device, hub2ServiceData, hub2Status, hub2WebhookContext, hub3ServiceData, SwitchBotBLE } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig, hubConfig } from '../settings.js'
|
|
10
|
-
|
|
11
6
|
import { Units } from 'homebridge'
|
|
7
|
+
import type { device, hub2ServiceData, hub2Status, hub2WebhookContext, hub3ServiceData, SwitchBotBLE } from 'node-switchbot'
|
|
12
8
|
/*
|
|
13
9
|
* For Testing Locally:
|
|
14
10
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -16,6 +12,8 @@ import { Units } from 'homebridge'
|
|
|
16
12
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
17
13
|
import { interval, skipWhile, Subject } from 'rxjs'
|
|
18
14
|
|
|
15
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
16
|
+
import type { devicesConfig, hubConfig } from '../settings.js'
|
|
19
17
|
import { convertUnits, formatDeviceIdAsMac, validHumidity } from '../utils.js'
|
|
20
18
|
import { deviceBase } from './device.js'
|
|
21
19
|
|
package/src/device/humidifier.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { bodyChange, device, humidifier2ServiceData, humidifier2Status, humidifier2WebhookContext, humidifierServiceData, humidifierStatus, humidifierWebhookContext, SwitchBotBLE, SwitchbotDevice, WoHumi } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig, humidifierConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { devicesConfig, humidifierConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { devicesConfig, humidifierConfig } from '../settings.js'
|
|
18
16
|
import { convertUnits, formatDeviceIdAsMac, validHumidity } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|
package/src/device/iosensor.ts
CHANGED
|
@@ -3,12 +3,8 @@
|
|
|
3
3
|
* iosensor.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
-
import type { device, outdoorMeterServiceData, outdoorMeterStatus, outdoorMeterWebhookContext, SwitchBotBLE } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig, indoorOutdoorSensorConfig } from '../settings.js'
|
|
10
|
-
|
|
11
6
|
import { Units } from 'homebridge'
|
|
7
|
+
import type { device, outdoorMeterServiceData, outdoorMeterStatus, outdoorMeterWebhookContext, SwitchBotBLE } from 'node-switchbot'
|
|
12
8
|
/*
|
|
13
9
|
* For Testing Locally:
|
|
14
10
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -16,6 +12,8 @@ import { Units } from 'homebridge'
|
|
|
16
12
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
17
13
|
import { interval, skipWhile, Subject } from 'rxjs'
|
|
18
14
|
|
|
15
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
16
|
+
import type { devicesConfig, indoorOutdoorSensorConfig } from '../settings.js'
|
|
19
17
|
import { convertUnits, formatDeviceIdAsMac, validHumidity } from '../utils.js'
|
|
20
18
|
import { deviceBase } from './device.js'
|
|
21
19
|
|
package/src/device/lightstrip.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, Controller, ControllerConstructor, ControllerServiceMap, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { bodyChange, device, stripLightServiceData, stripLightStatus, stripLightWebhookContext, SwitchBotBLE, SwitchbotDevice, WoStrip } from 'node-switchbot'
|
|
7
|
-
|
|
8
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
|
-
import type { devicesConfig, stripLightConfig } from '../settings.js'
|
|
10
|
-
|
|
11
7
|
/*
|
|
12
8
|
* For Testing Locally:
|
|
13
9
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
@@ -15,6 +11,8 @@ import type { devicesConfig, stripLightConfig } from '../settings.js'
|
|
|
15
11
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
12
|
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
17
13
|
|
|
14
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
15
|
+
import type { devicesConfig, stripLightConfig } from '../settings.js'
|
|
18
16
|
import { formatDeviceIdAsMac, hs2rgb, m2hs, rgb2hs } from '../utils.js'
|
|
19
17
|
import { deviceBase } from './device.js'
|
|
20
18
|
|