node-switchbot
Version:
The node-switchbot is a Node.js module which allows you to control your Switchbot Devices through Bluetooth (BLE).
22 lines (20 loc) • 8.53 kB
HTML
<html class="default" lang="en" data-base="."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>node-switchbot</title><meta name="description" content="Documentation for node-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><script async src="assets/hierarchy.js" id="tsd-hierarchy-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" aria-hidden="true"><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">node-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" aria-hidden="true"><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>node-switchbot</h1></div><div class="tsd-panel tsd-typography"><div align="center">
<p><img src="https://raw.githubusercontent.com/OpenWonderLabs/node-switchbot/latest/branding/Node_x_SwitchBot.svg?sanitize=true" alt="node-switchbot"></p>
<a id="node-switchbot" class="tsd-anchor"></a><h1 class="tsd-anchor-link">Node-SwitchBot<a href="#node-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><p><a href="https://www.npmjs.com/package/node-switchbot"><img src="https://badgen.net/npm/v/node-switchbot" alt="npm version"></a>
<a href="https://www.npmjs.com/package/node-switchbot"><img src="https://badgen.net/npm/dt/node-switchbot" alt="npm downloads"></a></p>
</div>
<p>The <code>node-switchbot</code> is a Node.js module that allows you to interact with various SwitchBot devices. You can control your <a href="https://www.switch-bot.com/bot">SwitchBot (Bot)'s</a> arm, operate your <a href="https://www.switch-bot.com/products/switchbot-curtain">SwitchBot Curtain</a>, and manage your <a href="https://www.switch-bot.com/products/switchbot-lock">SwitchBot Lock</a>. Additionally, you can monitor temperature and humidity using the <a href="https://www.switch-bot.com/meter">SwitchBot Thermometer & Hygrometer (Meter)</a>, and check the status of the <a href="https://www.switch-bot.com/products/motion-sensor">SwitchBot Motion Sensor</a> and <a href="https://www.switch-bot.com/products/contact-sensor">SwitchBot Contact Sensor</a>.</p>
<p>This module now supports both Bluetooth Low Energy (BLE) and the SwitchBot OpenAPI, providing more flexibility and options for interacting with your devices.</p>
<p>Please note that most of this module was developed by referencing the official <a href="https://github.com/OpenWonderLabs/SwitchBotAPI-BLE">BLE API</a> and <a href="https://github.com/OpenWonderLabs/SwitchBotAPI">OpenAPI</a> documentation. However, some functionalities were developed through trial and error, so there might be inaccuracies in the information obtained from this module.</p>
<hr>
<a id="installation" class="tsd-anchor"></a><h2 class="tsd-anchor-link"><a href="https://npmjs.org/node-switchbot">Installation</a><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><p>To install the <code>node-switchbot</code> module within your project, use the following command:</p>
<pre><code class="sh"><span class="hl-0">$</span><span class="hl-1"> </span><span class="hl-2">npm</span><span class="hl-1"> </span><span class="hl-2">install</span><span class="hl-1"> </span><span class="hl-3">--save</span><span class="hl-1"> </span><span class="hl-2">node-switchbot</span>
</code><button type="button">Copy</button></pre>
<a id="ble-bluetooth-low-energy" class="tsd-anchor"></a><h2 class="tsd-anchor-link"><a href="media/BLE.md">BLE (Bluetooth Low Energy)</a><a href="#ble-bluetooth-low-energy" 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><p>To see a breakdown of how to use the BLE functionality of this project, visit the <a href="media/BLE.md">BLE (Bluetooth Low Energy)</a> documentation.</p>
<a id="openapi" class="tsd-anchor"></a><h2 class="tsd-anchor-link"><a href="media/OpenAPI.md">OpenAPI</a><a href="#openapi" 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><p>To see a breakdown of how to use the OpenAPI functionality of this project, visit the <a href="media/OpenAPI.md">OpenAPI</a> documentation.</p>
<a id="references" class="tsd-anchor"></a><h2 class="tsd-anchor-link">References<a href="#references" 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><ul>
<li><a href="https://www.switch-bot.com/">SwitchBot (Official website)</a></li>
<li><a href="https://www.facebook.com/SwitchBotRobot/">Facebook @SwitchBotRobot</a></li>
<li><a href="https://twitter.com/switchbot">Twitter @SwitchBot</a></li>
</ul>
</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" aria-hidden="true"><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" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#node-switchbot"><span>Node-<wbr/>Switch<wbr/>Bot</span></a><ul><li><a href="#installation"><span>Installation</span></a></li><li><a href="#ble-bluetooth-low-energy"><span>BLE (<wbr/>Bluetooth <wbr/>Low <wbr/>Energy)</span></a></li><li><a href="#openapi"><span>OpenAPI</span></a></li><li><a href="#references"><span>References</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">node-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>