node-red-contrib-switchbot-openapi 1.0.3

SwitchBot device control and status nodes for Node-RED

npm install node-red-contrib-switchbot-openapi

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

Node Info

Version: 1.0.3
Updated 4 days ago
License: MIT
Rating: not yet rated

Categories

Actions

Rate:

Downloads

0 in the last week

Nodes

  • switchbot-credentials
  • switchbot-device-status
  • switchbot-device-command

Keywords

  • node-red
  • switchbot
  • smart-home
  • iot
  • home-automation
  • motion-sensor
  • presence-sensor
  • temperature
  • humidity
  • co2
  • curtain
  • plug
  • air-conditioner
  • bot
  • api

Maintainers