npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-red-contrib-switchbot-openapi

v1.0.3

Published

SwitchBot device control and status nodes for Node-RED

Downloads

322

Readme

node-red-contrib-switchbot-openapi

npm version License: MIT

SwitchBot device control and status nodes for Node-RED.

Features

  • 📊 SwitchBot Status - Get device status (temperature, humidity, CO2, motion detection, etc.)
  • 🎮 SwitchBot Command - Send commands to devices (turn on/off, set temperature, etc.)
  • 🔐 Shared Credentials - Configure API credentials once, use across all nodes
  • 📋 Device Picker - Select devices from a dropdown list (no manual ID entry needed)
  • 🔄 Dynamic Commands - Command options change based on selected device type

Supported Devices

Status (SwitchBot Status node)

| Device Type | Available Data | |-------------|----------------| | Presence Sensor / Motion Sensor | Motion detection, light level | | Meter / Meter Plus / Outdoor Meter | Temperature, humidity, battery | | CO2 Sensor (Hub 2) | CO2, temperature, humidity | | Curtain / Curtain 3 | Position, calibration status | | Robot Vacuum | Working status, online status | | Plug / Plug Mini | Power, voltage, current |

Commands (SwitchBot Command node)

| Device Type | Available Commands | |-------------|-------------------| | Bot | turnOn, turnOff, press | | Curtain / Curtain 3 | setPosition, turnOn, turnOff | | Plug / Plug Mini | turnOn, turnOff, toggle | | Color Bulb | turnOn, turnOff, setBrightness, setColor | | Strip Light | turnOn, turnOff, setBrightness, setColor | | Air Conditioner (IR) | setAll (temperature, mode, fan speed, power) | | Humidifier | turnOn, turnOff, setMode | | Lock / Lock Pro | lock, unlock | | Blind Tilt | setPosition, fullyOpen, closeUp, closeDown | | And more... | See SwitchBot API documentation |

Installation

Via Node-RED Palette Manager (Recommended)

  1. Open Node-RED
  2. Go to Menu → Manage palette → Install
  3. Search for node-red-contrib-switchbot-openapi
  4. Click Install

Via npm

cd ~/.node-red
npm install node-red-contrib-switchbot-openapi

Then restart Node-RED.

Setup

1. Get SwitchBot API Credentials

  1. Open SwitchBot app on your phone
  2. Go to Profile → Preferences
  3. Tap App Version 10 times to enable Developer Options
  4. Go to Developer Options
  5. Copy your Token and Secret Key

2. Configure Credentials in Node-RED

  1. Drag any SwitchBot node to your flow
  2. Double-click to open settings
  3. Click the pencil icon next to "認証" (Authentication)
  4. Enter your Token and Secret
  5. Click Add then Deploy

3. Select Your Device

  1. Click the 🔄 button to fetch your device list
  2. Select a device from the dropdown
  3. For SwitchBot Command: available commands will appear based on device type

Usage Examples

Get Sensor Data Every 5 Minutes

[Inject (5min interval)] → [SwitchBot Status] → [Debug]

Turn On Air Conditioner

[Inject] → [SwitchBot Command (setAll)] → [Debug]

Motion-Triggered Automation

[Inject (30s interval)] → [SwitchBot Status] → [Switch (msg.payload.detected)] → [Your Action]

API Rate Limits

SwitchBot API has a limit of 10,000 requests per day. Plan your polling intervals accordingly:

| Interval | Requests/Day (1 device) | |----------|------------------------| | 1 min | 1,440 | | 5 min | 288 | | 15 min | 96 |

Troubleshooting

"Token/Secret not configured"

Make sure you've added and deployed the credentials config node before fetching devices.

"Device not found"

Ensure the device is registered in your SwitchBot account and the API credentials are correct.

"API error: 401"

Your Token or Secret is invalid or expired. Regenerate them in the SwitchBot app.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE for details.

Links