@switchbot/homebridge-switchbot 4.1.4-beta.2 → 4.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +3 -3
- package/dist/device/bot.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +3 -3
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +1 -1
- package/dist/device/device.js +2 -2
- package/dist/device/device.js.map +1 -1
- package/dist/irdevice/airconditioner.js +9 -9
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.js +6 -6
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.js +4 -4
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.js +4 -4
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +9 -6
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js +39 -29
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.js +4 -4
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.js +4 -4
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.js +22 -22
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +4 -4
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.js +4 -4
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/settings.d.ts +5 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/icons.js +1 -1
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +5 -5
- package/docs/assets/style.css +1391 -1288
- package/docs/functions/default.html +1 -1
- package/docs/index.html +14 -14
- package/docs/modules.html +1 -2
- package/package.json +10 -10
- package/src/device/bot.ts +4 -5
- package/src/device/curtain.ts +4 -5
- package/src/device/device.ts +2 -2
- package/src/irdevice/airconditioner.ts +9 -9
- package/src/irdevice/airpurifier.ts +6 -6
- package/src/irdevice/camera.ts +4 -4
- package/src/irdevice/fan.ts +4 -4
- package/src/irdevice/irdevice.ts +42 -30
- package/src/irdevice/light.ts +4 -4
- package/src/irdevice/other.ts +4 -4
- package/src/irdevice/tv.ts +22 -22
- package/src/irdevice/vacuumcleaner.ts +4 -4
- package/src/irdevice/waterheater.ts +4 -4
- package/src/settings.ts +5 -0
- package/.github/npm-version-script.cjs +0 -81
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"
|
|
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(() => 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"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@switchbot/homebridge-switchbot</a></li><li><a href="default.html">default</a></li></ul><h1>Function default</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="default" class="tsd-anchor"></a><span class="tsd-kind-call-signature">default</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#default" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/0edc67107e66a52e7b8906167ee33c6584579895/src/index.ts#L11">index.ts:11</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@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/docs/index.html
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en"><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"
|
|
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="
|
|
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" target="_blank" class="external"><img src="https://badgen.net/npm/v/@switchbot/homebridge-switchbot" alt="npm version"></a>
|
|
4
4
|
<a href="https://www.npmjs.com/package/@switchbot/homebridge-switchbot" target="_blank" class="external"><img src="https://badgen.net/npm/dt/@switchbot/homebridge-switchbot" alt="npm downloads"></a>
|
|
5
5
|
<a href="https://discord.gg/5wYTbwP4ha" target="_blank" class="external"><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
|
-
<a id="
|
|
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
11
|
<li>Search for "SwitchBot" on the plugin screen of <a href="https://github.com/oznu/homebridge-config-ui-x" target="_blank" class="external">Homebridge Config UI X</a></li>
|
|
12
12
|
<li>Find: <code>@switchbot/homebridge-switchbot</code>
|
|
13
13
|
<ul>
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
</li>
|
|
17
17
|
<li>Click <strong>Install</strong></li>
|
|
18
18
|
</ol>
|
|
19
|
-
<a id="
|
|
19
|
+
<a id="configuration" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Configuration<a href="#configuration" 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>
|
|
20
20
|
<li>
|
|
21
|
-
<a id="
|
|
21
|
+
<a id="if-using-openapi-connection" class="tsd-anchor"></a><h3 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"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><ol>
|
|
22
22
|
<li>Download SwitchBot App on App Store or Google Play Store</li>
|
|
23
23
|
<li>Register a SwitchBot account and log in into your account</li>
|
|
24
24
|
<li>Generate an Token within the App
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
</ol>
|
|
45
45
|
</li>
|
|
46
46
|
<li>
|
|
47
|
-
<a id="
|
|
47
|
+
<a id="if-using-ble-connection" class="tsd-anchor"></a><h3 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"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><ol>
|
|
48
48
|
<li>Download SwitchBot App on App Store or Google Play Store</li>
|
|
49
49
|
<li>Register a SwitchBot account and log in into your account</li>
|
|
50
50
|
<li>Click on Device wanting to connect too plugin
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
</ol>
|
|
59
59
|
</li>
|
|
60
60
|
</ul>
|
|
61
|
-
<a id="
|
|
61
|
+
<a id="troubleshooting" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Troubleshooting<a href="#troubleshooting" 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>
|
|
62
62
|
<li>
|
|
63
|
-
<a id="
|
|
63
|
+
<a id="if-using-linux--raspberry-pi-os" class="tsd-anchor"></a><h3 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"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><ol>
|
|
64
64
|
<li>
|
|
65
65
|
<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
66
|
</li>
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
</ol>
|
|
83
83
|
</li>
|
|
84
84
|
<li>
|
|
85
|
-
<a id="
|
|
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
88
|
(This is what is intended in documentation for the noble bluetooth package <a href="https://github.com/abandonware/noble#prerequisites" target="_blank" class="external">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 +93,7 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
93
93
|
|
|
94
94
|
</li>
|
|
95
95
|
</ul>
|
|
96
|
-
<a id="
|
|
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
97
|
<li><a href="https://www.switch-bot.com/products/switchbot-smart-humidifier" target="_blank" class="external">SwitchBot Humidifier</a>
|
|
98
98
|
<ul>
|
|
99
99
|
<li>Supports OpenAPI & Bluetooth Low Energy (BLE) Connections
|
|
@@ -282,7 +282,7 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
282
282
|
</ul>
|
|
283
283
|
</li>
|
|
284
284
|
</ul>
|
|
285
|
-
<a id="
|
|
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" target="_blank" class="external">SwitchBot Hub 2</a> or <a href="https://www.switch-bot.com/products/switchbot-hub-mini" target="_blank" class="external">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
286
|
<li>TV
|
|
287
287
|
<ul>
|
|
288
288
|
<li>Allows for On/Off and Volume Controls</li>
|
|
@@ -363,7 +363,7 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
363
363
|
</ul>
|
|
364
364
|
</li>
|
|
365
365
|
</ul>
|
|
366
|
-
<a id="
|
|
366
|
+
<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
367
|
<li><a href="https://github.com/OpenWonderLabs/node-switchbot" target="_blank" class="external">OpenWonderLabs/node-switchbot</a>
|
|
368
368
|
<ul>
|
|
369
369
|
<li><a href="https://github.com/OpenWonderLabs/SwitchBotAPI" target="_blank" class="external">OpenWonderLabs/SwitchBotAPI</a></li>
|
|
@@ -371,9 +371,9 @@ Without this step, then you will receive the following error when the swichbot p
|
|
|
371
371
|
</ul>
|
|
372
372
|
</li>
|
|
373
373
|
</ul>
|
|
374
|
-
<a id="
|
|
374
|
+
<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
375
|
<li><a href="https://www.switch-bot.com/" target="_blank" class="external">SwitchBot (Official website)</a></li>
|
|
376
376
|
<li><a href="https://www.facebook.com/SwitchBotRobot/" target="_blank" class="external">Facebook @SwitchBotRobot</a></li>
|
|
377
377
|
<li><a href="https://twitter.com/switchbot" target="_blank" class="external">Twitter @SwitchBot</a></li>
|
|
378
378
|
</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="#
|
|
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" class="current">@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/docs/modules.html
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en"><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"
|
|
2
|
-
</div></section></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>@switchbot/homebridge-switchbot</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="."><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" 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"><ul class="tsd-breadcrumb"><li><a href="modules.html">@switchbot/homebridge-switchbot</a></li></ul><h1>@switchbot/homebridge-switchbot</h1></div><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Functions"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg> Functions</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary"><a id="default" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/default.html">default</a><a href="#default" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details></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"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Functions"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Functions</summary><div><a href="#default" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-64"></use></svg><span>default</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current">@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.
|
|
5
|
+
"version": "4.1.5",
|
|
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": [
|
|
@@ -76,33 +76,33 @@
|
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@homebridge/plugin-ui-utils": "^
|
|
79
|
+
"@homebridge/plugin-ui-utils": "^2.0.0",
|
|
80
80
|
"async-mqtt": "^2.6.3",
|
|
81
81
|
"fakegato-history": "^0.6.5",
|
|
82
82
|
"homebridge-lib": "^7.1.0",
|
|
83
|
-
"node-switchbot": "^3.
|
|
83
|
+
"node-switchbot": "^3.4.0",
|
|
84
84
|
"rxjs": "^7.8.1"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@antfu/eslint-config": "^3.
|
|
87
|
+
"@antfu/eslint-config": "^3.11.0",
|
|
88
88
|
"@types/aes-js": "^3.1.4",
|
|
89
89
|
"@types/debug": "^4.1.12",
|
|
90
90
|
"@types/fs-extra": "^11.0.4",
|
|
91
91
|
"@types/mdast": "^4.0.4",
|
|
92
|
-
"@types/node": "^22.
|
|
92
|
+
"@types/node": "^22.10.0",
|
|
93
93
|
"@types/semver": "^7.5.8",
|
|
94
94
|
"@types/source-map-support": "^0.5.10",
|
|
95
|
-
"@vitest/coverage-v8": "^2.1.
|
|
96
|
-
"eslint": "^9.
|
|
95
|
+
"@vitest/coverage-v8": "^2.1.6",
|
|
96
|
+
"eslint": "^9.15.0",
|
|
97
97
|
"eslint-plugin-format": "^0.1.2",
|
|
98
98
|
"homebridge": "^1.8.5",
|
|
99
|
-
"homebridge-config-ui-x": "4.
|
|
99
|
+
"homebridge-config-ui-x": "4.63.0",
|
|
100
100
|
"nodemon": "^3.1.7",
|
|
101
101
|
"shx": "^0.3.4",
|
|
102
102
|
"ts-node": "^10.9.2",
|
|
103
|
-
"typedoc": "^0.
|
|
103
|
+
"typedoc": "^0.27.0",
|
|
104
104
|
"typescript": "^5.6.3",
|
|
105
|
-
"vitest": "^2.1.
|
|
105
|
+
"vitest": "^2.1.6"
|
|
106
106
|
},
|
|
107
107
|
"directories": {
|
|
108
108
|
"doc": "docs"
|
package/src/device/bot.ts
CHANGED
|
@@ -8,16 +8,15 @@ import type { bodyChange, botServiceData, botStatus, botWebhookContext, device,
|
|
|
8
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
9
|
import type { botConfig, devicesConfig } from '../settings.js'
|
|
10
10
|
|
|
11
|
-
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
12
|
-
|
|
13
|
-
import { formatDeviceIdAsMac } from '../utils.js'
|
|
14
|
-
import { deviceBase } from './device.js'
|
|
15
|
-
|
|
16
11
|
/*
|
|
17
12
|
* For Testing Locally:
|
|
18
13
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
19
14
|
*/
|
|
20
15
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
16
|
+
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
17
|
+
|
|
18
|
+
import { formatDeviceIdAsMac } from '../utils.js'
|
|
19
|
+
import { deviceBase } from './device.js'
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* Platform Accessory
|
package/src/device/curtain.ts
CHANGED
|
@@ -10,16 +10,15 @@ import type { curtainConfig, devicesConfig } from '../settings.js'
|
|
|
10
10
|
|
|
11
11
|
import { hostname } from 'node:os'
|
|
12
12
|
|
|
13
|
-
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
14
|
-
|
|
15
|
-
import { formatDeviceIdAsMac, isCurtainDevice } from '../utils.js'
|
|
16
|
-
import { deviceBase } from './device.js'
|
|
17
|
-
|
|
18
13
|
/*
|
|
19
14
|
* For Testing Locally:
|
|
20
15
|
* import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
|
|
21
16
|
*/
|
|
22
17
|
import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
|
|
18
|
+
import { debounceTime, interval, skipWhile, Subject, take, tap } from 'rxjs'
|
|
19
|
+
|
|
20
|
+
import { formatDeviceIdAsMac, isCurtainDevice } from '../utils.js'
|
|
21
|
+
import { deviceBase } from './device.js'
|
|
23
22
|
|
|
24
23
|
export class Curtain extends deviceBase {
|
|
25
24
|
// Services
|
package/src/device/device.ts
CHANGED
|
@@ -92,7 +92,7 @@ export abstract class deviceBase {
|
|
|
92
92
|
|
|
93
93
|
async getDeviceRateSettings(device: device & devicesConfig): Promise<void> {
|
|
94
94
|
// refreshRate
|
|
95
|
-
this.deviceRefreshRate = device.refreshRate ?? this.platform.platformRefreshRate ??
|
|
95
|
+
this.deviceRefreshRate = device.refreshRate ?? this.platform.platformRefreshRate ?? 300
|
|
96
96
|
const refreshRate = device.refreshRate ? 'Device Config' : this.platform.platformRefreshRate ? 'Platform Config' : 'Default'
|
|
97
97
|
// updateRate
|
|
98
98
|
this.deviceUpdateRate = device.updateRate ?? this.platform.platformUpdateRate ?? 5
|
|
@@ -102,7 +102,7 @@ export abstract class deviceBase {
|
|
|
102
102
|
const pushRate = device.pushRate ? 'Device Config' : this.platform.platformPushRate ? 'Platform Config' : 'Default'
|
|
103
103
|
this.debugLog(`Using ${refreshRate} refreshRate: ${this.deviceRefreshRate}, ${updateRate} updateRate: ${this.deviceUpdateRate}, ${pushRate} pushRate: ${this.devicePushRate}`)
|
|
104
104
|
// maxRetries
|
|
105
|
-
this.deviceMaxRetries = device.maxRetries ?? this.platform.platformMaxRetries ??
|
|
105
|
+
this.deviceMaxRetries = device.maxRetries ?? this.platform.platformMaxRetries ?? 2
|
|
106
106
|
const maxRetries = device.maxRetries ? 'Device' : this.platform.platformMaxRetries ? 'Platform' : 'Default'
|
|
107
107
|
this.debugLog(`Using ${maxRetries} Max Retries: ${this.deviceMaxRetries}`)
|
|
108
108
|
// delayBetweenRetries
|
|
@@ -158,8 +158,8 @@ export class AirConditioner extends irdeviceBase {
|
|
|
158
158
|
* AirConditioner: "command" "highSpeed" "default" = fan speed to high
|
|
159
159
|
*/
|
|
160
160
|
async pushAirConditionerOnChanges(): Promise<void> {
|
|
161
|
-
this.debugLog(`pushAirConditionerOnChanges Active: ${this.HeaterCooler.Active}, disablePushOn: ${this.
|
|
162
|
-
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE && !this.
|
|
161
|
+
this.debugLog(`pushAirConditionerOnChanges Active: ${this.HeaterCooler.Active}, disablePushOn: ${this.deviceDisablePushOn}`)
|
|
162
|
+
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE && !this.deviceDisablePushOn) {
|
|
163
163
|
const commandType: string = await this.commandType()
|
|
164
164
|
const command: string = await this.commandOn()
|
|
165
165
|
const bodyChange: bodyChange = {
|
|
@@ -172,8 +172,8 @@ export class AirConditioner extends irdeviceBase {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
async pushAirConditionerOffChanges(): Promise<void> {
|
|
175
|
-
this.debugLog(`pushAirConditionerOffChanges Active: ${this.HeaterCooler.Active}, disablePushOff: ${this.
|
|
176
|
-
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.INACTIVE && !this.
|
|
175
|
+
this.debugLog(`pushAirConditionerOffChanges Active: ${this.HeaterCooler.Active}, disablePushOff: ${this.deviceDisablePushOff}`)
|
|
176
|
+
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.INACTIVE && !this.deviceDisablePushOff) {
|
|
177
177
|
const commandType: string = await this.commandType()
|
|
178
178
|
const command: string = await this.commandOff()
|
|
179
179
|
const bodyChange: bodyChange = {
|
|
@@ -186,7 +186,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
async pushAirConditionerStatusChanges(): Promise<void> {
|
|
189
|
-
this.debugLog(`pushAirConditionerStatusChanges Active: ${this.HeaterCooler.Active}, disablePushOff: ${this.
|
|
189
|
+
this.debugLog(`pushAirConditionerStatusChanges Active: ${this.HeaterCooler.Active}, disablePushOff: ${this.deviceDisablePushOff}, disablePushOn: ${this.deviceDisablePushOn}`)
|
|
190
190
|
if (!this.Busy) {
|
|
191
191
|
this.Busy = true
|
|
192
192
|
this.HeaterCooler.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE
|
|
@@ -198,7 +198,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
async pushAirConditionerDetailsChanges(): Promise<void> {
|
|
201
|
-
this.debugLog(`pushAirConditionerDetailsChanges Active: ${this.HeaterCooler.Active}, disablePushOff: ${this.
|
|
201
|
+
this.debugLog(`pushAirConditionerDetailsChanges Active: ${this.HeaterCooler.Active}, disablePushOff: ${this.deviceDisablePushOff}, disablePushOn: ${this.deviceDisablePushOn}`)
|
|
202
202
|
// await this.deviceContext();
|
|
203
203
|
if (this.CurrentMode === undefined) {
|
|
204
204
|
this.CurrentMode = 1
|
|
@@ -313,7 +313,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
313
313
|
|
|
314
314
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
315
315
|
this.debugLog('pushChanges')
|
|
316
|
-
if (this.device.connectionType === 'OpenAPI' && !this.
|
|
316
|
+
if (this.device.connectionType === 'OpenAPI' && !this.deviceDisablePushDetail) {
|
|
317
317
|
this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
|
|
318
318
|
try {
|
|
319
319
|
const response = await this.pushChangeRequest(bodyChange)
|
|
@@ -331,7 +331,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
331
331
|
}
|
|
332
332
|
} else {
|
|
333
333
|
this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
|
|
334
|
-
this.debugLog(`Connection Type: ${this.device.connectionType}, disablePushDetails: ${this.
|
|
334
|
+
this.debugLog(`Connection Type: ${this.device.connectionType}, disablePushDetails: ${this.deviceDisablePushDetail}`)
|
|
335
335
|
await this.updateHomeKitCharacteristics()
|
|
336
336
|
}
|
|
337
337
|
}
|
|
@@ -385,7 +385,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
385
385
|
this.HeaterCooler.Active = value
|
|
386
386
|
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
387
387
|
this.debugLog(`pushAirConditionerOnChanges, Active: ${this.HeaterCooler.Active}`)
|
|
388
|
-
if (this.
|
|
388
|
+
if (this.deviceDisablePushOn) {
|
|
389
389
|
this.pushAirConditionerStatusChanges()
|
|
390
390
|
} else {
|
|
391
391
|
this.pushAirConditionerOnChanges()
|
|
@@ -145,8 +145,8 @@ export class AirPurifier extends irdeviceBase {
|
|
|
145
145
|
* AirPurifier: "command" "highSpeed" "default" = fan speed to high
|
|
146
146
|
*/
|
|
147
147
|
async pushAirPurifierOnChanges(): Promise<void> {
|
|
148
|
-
this.debugLog(`pushAirPurifierOnChanges Active: ${this.AirPurifier.Active}, disablePushOn: ${this.
|
|
149
|
-
if (this.AirPurifier.Active === this.hap.Characteristic.Active.ACTIVE && !this.
|
|
148
|
+
this.debugLog(`pushAirPurifierOnChanges Active: ${this.AirPurifier.Active}, disablePushOn: ${this.deviceDisablePushOn}`)
|
|
149
|
+
if (this.AirPurifier.Active === this.hap.Characteristic.Active.ACTIVE && !this.deviceDisablePushOn) {
|
|
150
150
|
const commandType: string = await this.commandType()
|
|
151
151
|
const command: string = await this.commandOn()
|
|
152
152
|
const bodyChange: bodyChange = {
|
|
@@ -159,8 +159,8 @@ export class AirPurifier extends irdeviceBase {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
async pushAirPurifierOffChanges(): Promise<void> {
|
|
162
|
-
this.debugLog(`pushAirPurifierOffChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.
|
|
163
|
-
if (this.AirPurifier.Active === this.hap.Characteristic.Active.INACTIVE && !this.
|
|
162
|
+
this.debugLog(`pushAirPurifierOffChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.deviceDisablePushOff}`)
|
|
163
|
+
if (this.AirPurifier.Active === this.hap.Characteristic.Active.INACTIVE && !this.deviceDisablePushOn) {
|
|
164
164
|
const commandType: string = await this.commandType()
|
|
165
165
|
const command: string = await this.commandOff()
|
|
166
166
|
const bodyChange: bodyChange = {
|
|
@@ -173,7 +173,7 @@ export class AirPurifier extends irdeviceBase {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
async pushAirPurifierStatusChanges(): Promise<void> {
|
|
176
|
-
this.debugLog(`pushAirPurifierStatusChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.
|
|
176
|
+
this.debugLog(`pushAirPurifierStatusChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.deviceDisablePushOff}, disablePushOn: ${this.deviceDisablePushOn}`)
|
|
177
177
|
if (!this.Busy) {
|
|
178
178
|
this.Busy = true
|
|
179
179
|
this.AirPurifier.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE
|
|
@@ -185,7 +185,7 @@ export class AirPurifier extends irdeviceBase {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
async pushAirPurifierDetailsChanges(): Promise<void> {
|
|
188
|
-
this.debugLog(`pushAirPurifierDetailsChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.
|
|
188
|
+
this.debugLog(`pushAirPurifierDetailsChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.deviceDisablePushOff}, disablePushOn: ${this.deviceDisablePushOn}`)
|
|
189
189
|
this.CurrentAPTemp = this.TemperatureSensor!.CurrentTemperature ?? 24
|
|
190
190
|
this.CurrentAPMode = this.CurrentMode ?? 1
|
|
191
191
|
this.CurrentAPFanSpeed = this.CurrentFanSpeed ?? 1
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -68,8 +68,8 @@ export class Camera extends irdeviceBase {
|
|
|
68
68
|
* Camera - "command" "channelSub" "default" = previous channel
|
|
69
69
|
*/
|
|
70
70
|
async pushOnChanges(): Promise<void> {
|
|
71
|
-
this.debugLog(`pushOnChanges On: ${this.Switch.On}, disablePushOn: ${this.
|
|
72
|
-
if (this.Switch.On && !this.
|
|
71
|
+
this.debugLog(`pushOnChanges On: ${this.Switch.On}, disablePushOn: ${this.deviceDisablePushOn}`)
|
|
72
|
+
if (this.Switch.On && !this.deviceDisablePushOn) {
|
|
73
73
|
const commandType: string = await this.commandType()
|
|
74
74
|
const command: string = await this.commandOn()
|
|
75
75
|
const bodyChange: bodyChange = {
|
|
@@ -82,8 +82,8 @@ export class Camera extends irdeviceBase {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
async pushOffChanges(): Promise<void> {
|
|
85
|
-
this.debugLog(`pushOffChanges On: ${this.Switch.On}, disablePushOff: ${this.
|
|
86
|
-
if (!this.Switch.On && !this.
|
|
85
|
+
this.debugLog(`pushOffChanges On: ${this.Switch.On}, disablePushOff: ${this.deviceDisablePushOff}`)
|
|
86
|
+
if (!this.Switch.On && !this.deviceDisablePushOff) {
|
|
87
87
|
const commandType: string = await this.commandType()
|
|
88
88
|
const command: string = await this.commandOff()
|
|
89
89
|
const bodyChange: bodyChange = {
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -132,8 +132,8 @@ export class IRFan extends irdeviceBase {
|
|
|
132
132
|
* Fan - "command" "highSpeed" "default" = fan speed to high
|
|
133
133
|
*/
|
|
134
134
|
async pushFanOnChanges(): Promise<void> {
|
|
135
|
-
this.debugLog(`pushFanOnChanges Active: ${this.Fan.Active}, disablePushOn: ${this.
|
|
136
|
-
if (this.Fan.Active === this.hap.Characteristic.Active.ACTIVE && !this.
|
|
135
|
+
this.debugLog(`pushFanOnChanges Active: ${this.Fan.Active}, disablePushOn: ${this.deviceDisablePushOn}`)
|
|
136
|
+
if (this.Fan.Active === this.hap.Characteristic.Active.ACTIVE && !this.deviceDisablePushOn) {
|
|
137
137
|
const commandType: string = await this.commandType()
|
|
138
138
|
const command: string = await this.commandOn()
|
|
139
139
|
const bodyChange: bodyChange = {
|
|
@@ -146,8 +146,8 @@ export class IRFan extends irdeviceBase {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
async pushFanOffChanges(): Promise<void> {
|
|
149
|
-
this.debugLog(`pushLightOffChanges Active: ${this.Fan.Active}, disablePushOff: ${this.
|
|
150
|
-
if (this.Fan.Active === this.hap.Characteristic.Active.INACTIVE && !this.
|
|
149
|
+
this.debugLog(`pushLightOffChanges Active: ${this.Fan.Active}, disablePushOff: ${this.deviceDisablePushOff}`)
|
|
150
|
+
if (this.Fan.Active === this.hap.Characteristic.Active.INACTIVE && !this.deviceDisablePushOff) {
|
|
151
151
|
const commandType: string = await this.commandType()
|
|
152
152
|
const command: string = await this.commandOff()
|
|
153
153
|
const bodyChange: bodyChange = {
|
package/src/irdevice/irdevice.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* Copyright(C) 2021-2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
|
|
2
2
|
*
|
|
3
|
-
*
|
|
3
|
+
* irdevice.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { API, CharacteristicValue, HAP, Logging, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
import type { bodyChange, irdevice } from 'node-switchbot'
|
|
@@ -16,9 +16,14 @@ export abstract class irdeviceBase {
|
|
|
16
16
|
|
|
17
17
|
// Config
|
|
18
18
|
protected deviceLogging!: string
|
|
19
|
-
protected
|
|
20
|
-
protected
|
|
21
|
-
protected
|
|
19
|
+
protected deviceRefreshRate!: number
|
|
20
|
+
protected deviceUpdateRate!: number
|
|
21
|
+
protected devicePushRate!: number
|
|
22
|
+
protected deviceMaxRetries!: number
|
|
23
|
+
protected deviceDelayBetweenRetries!: number
|
|
24
|
+
protected deviceDisablePushOn!: boolean
|
|
25
|
+
protected deviceDisablePushOff!: boolean
|
|
26
|
+
protected deviceDisablePushDetail?: boolean
|
|
22
27
|
|
|
23
28
|
constructor(
|
|
24
29
|
protected readonly platform: SwitchBotPlatform,
|
|
@@ -31,10 +36,9 @@ export abstract class irdeviceBase {
|
|
|
31
36
|
this.hap = this.api.hap
|
|
32
37
|
|
|
33
38
|
this.getDeviceLogSettings(accessory, device)
|
|
39
|
+
this.getDeviceRateSettings(device)
|
|
34
40
|
this.getDeviceConfigSettings(device)
|
|
35
41
|
this.getDeviceContext(accessory, device)
|
|
36
|
-
this.disablePushOnChanges(device)
|
|
37
|
-
this.disablePushOffChanges(device)
|
|
38
42
|
|
|
39
43
|
// Set accessory information
|
|
40
44
|
accessory
|
|
@@ -55,6 +59,38 @@ export abstract class irdeviceBase {
|
|
|
55
59
|
this.debugLog(`Using ${logging} Logging: ${this.deviceLogging}`)
|
|
56
60
|
}
|
|
57
61
|
|
|
62
|
+
async getDeviceRateSettings(device: irdevice & irDevicesConfig): Promise<void> {
|
|
63
|
+
// refreshRate
|
|
64
|
+
this.deviceRefreshRate = device.refreshRate ?? this.platform.platformRefreshRate ?? 300
|
|
65
|
+
const refreshRate = device.refreshRate ? 'Device Config' : this.platform.platformRefreshRate ? 'Platform Config' : 'Default'
|
|
66
|
+
// updateRate
|
|
67
|
+
this.deviceUpdateRate = device.updateRate ?? this.platform.platformUpdateRate ?? 5
|
|
68
|
+
const updateRate = device.updateRate ? 'Device Config' : this.platform.platformUpdateRate ? 'Platform Config' : 'Default'
|
|
69
|
+
// pushRate
|
|
70
|
+
this.devicePushRate = device.pushRate ?? this.platform.platformPushRate ?? 0.1
|
|
71
|
+
const pushRate = device.pushRate ? 'Device Config' : this.platform.platformPushRate ? 'Platform Config' : 'Default'
|
|
72
|
+
this.debugLog(`Using ${refreshRate} refreshRate: ${this.deviceRefreshRate}, ${updateRate} updateRate: ${this.deviceUpdateRate}, ${pushRate} pushRate: ${this.devicePushRate}`)
|
|
73
|
+
// maxRetries
|
|
74
|
+
this.deviceMaxRetries = device.maxRetries ?? this.platform.platformMaxRetries ?? 2
|
|
75
|
+
const maxRetries = device.maxRetries ? 'Device' : this.platform.platformMaxRetries ? 'Platform' : 'Default'
|
|
76
|
+
this.debugLog(`Using ${maxRetries} Max Retries: ${this.deviceMaxRetries}`)
|
|
77
|
+
// delayBetweenRetries
|
|
78
|
+
this.deviceDelayBetweenRetries = device.delayBetweenRetries ? (device.delayBetweenRetries * 1000) : this.platform.platformDelayBetweenRetries ?? 3000
|
|
79
|
+
const delayBetweenRetries = device.delayBetweenRetries ? 'Device' : this.platform.platformDelayBetweenRetries ? 'Platform' : 'Default'
|
|
80
|
+
this.debugLog(`Using ${delayBetweenRetries} Delay Between Retries: ${this.deviceDelayBetweenRetries}`)
|
|
81
|
+
|
|
82
|
+
// disablePushOn
|
|
83
|
+
this.deviceDisablePushOn = device.disablePushOn ?? false
|
|
84
|
+
const disablePushOn = device.disablePushOn ? 'Device Config' : 'Default'
|
|
85
|
+
// disablePushOff
|
|
86
|
+
this.deviceDisablePushOff = device.disablePushOff ?? false
|
|
87
|
+
const disablePushOff = device.disablePushOff ? 'Device Config' : 'Default'
|
|
88
|
+
// disablePushDetail
|
|
89
|
+
this.deviceDisablePushDetail = device.disablePushDetail ?? false
|
|
90
|
+
const disablePushDetail = device.disablePushDetail ? 'Device Config' : 'Default'
|
|
91
|
+
this.debugLog(`Using ${disablePushOn} Disable Push On: ${this.deviceDisablePushOn}, ${disablePushOff} Disable Push Off: ${this.deviceDisablePushOff}, ${disablePushDetail} Disable Push Detail: ${this.deviceDisablePushDetail}`)
|
|
92
|
+
}
|
|
93
|
+
|
|
58
94
|
async getDeviceConfigSettings(device: irdevice & irDevicesConfig): Promise<void> {
|
|
59
95
|
const deviceConfig = Object.assign(
|
|
60
96
|
{},
|
|
@@ -173,30 +209,6 @@ export abstract class irdeviceBase {
|
|
|
173
209
|
this.errorLog(`failed pushChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`)
|
|
174
210
|
}
|
|
175
211
|
|
|
176
|
-
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
177
|
-
if (device.disablePushOn === undefined) {
|
|
178
|
-
this.disablePushOn = false
|
|
179
|
-
} else {
|
|
180
|
-
this.disablePushOn = device.disablePushOn
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
185
|
-
if (device.disablePushOff === undefined) {
|
|
186
|
-
this.disablePushOff = false
|
|
187
|
-
} else {
|
|
188
|
-
this.disablePushOff = device.disablePushOff
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
async disablePushDetailChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
193
|
-
if (device.disablePushDetail === undefined) {
|
|
194
|
-
this.disablePushDetail = false
|
|
195
|
-
} else {
|
|
196
|
-
this.disablePushDetail = device.disablePushDetail
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
212
|
async commandType(): Promise<string> {
|
|
201
213
|
let commandType: string
|
|
202
214
|
if (this.device.commandType && this.device.customize) {
|