switchbot-api
An asynchronous library to use Switchbot API
What it is and what it does
switchbot-api is an async Python client for the official SwitchBot API, letting you query, monitor, and control SwitchBot devices and remotes from Python code. It wraps the REST API with async/await patterns, handling the cryptographic signing required by SwitchBot's authentication scheme through pycryptodome and managing HTTP requests via aiohttp.
The library is designed for home automation and IoT integration scenarios where you need to programmatically list devices, check their status, or send commands. It's actively maintained, supports modern Python versions (3.10–3.14), and has no known security vulnerabilities. Installation is straightforward with a pure-Python wheel and only two runtime dependencies.
Use it for:
- Build a home automation dashboard that queries SwitchBot device status and sends control commands asynchronously.
- Integrate SwitchBot devices into a larger smart-home orchestration system via REST API calls.
- Create scheduled or event-driven automation workflows that toggle SwitchBot remotes or devices based on external triggers.
- Monitor SwitchBot device state in real-time for logging, alerting, or analytics purposes.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
An async Python library for controlling SwitchBot devices and remotes through the official SwitchBot API, handling authentication and command execution.
Yes. The library is actively maintained, has low install friction, carries a permissive MIT license, and has no known vulnerabilities. It fills a clear niche for Python developers integrating SwitchBot devices into automation workflows. The async design aligns with modern Python practices. Install it if you're building SwitchBot automation.
Install
switchbot-api on PyPI
pip
pip install switchbot-apiuv
uv add switchbot-apipoetry
poetry add switchbot-apiInstalling switchbot-api
Before you install
Low install friction with a pure-Python wheel. Actively maintained as of 2026-08-10 with recent releases. Supports current Python versions (3.10–3.14).
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both personal and commercial projects.
Quickstart
pip install switchbot-api
from switchbot_api import SwitchBotAPI
client = SwitchBotAPI(token="xxx", secret="yyy")
devices = await client.list_devices()
status = await client.get_status('some-id')
await client.send_command('some-id', {COMMAND})
Requires Python 3.10 or later. Caller must provide valid SwitchBot API token and secret, and must use async/await context.
Verify before relying
- Whether the library handles token/secret rotation or refresh automatically, or if caller must manage credentials.
- Rate limiting behavior and retry logic when calling the SwitchBot API.
- Whether error handling distinguishes between network failures, authentication failures, and device-specific errors.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — aiohttp, pycryptodome |
| Maintenance | actively maintained — 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 73,438/month — #14,999 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: switchbot_api-2.13.0-py3-none-any.whl
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
elmax-apiAn async Python client for the Elmax Cloud API…
permissive · top 15,000 on PyPI
factorio-rcon-pyA Python client library for connecting to and…
copyleft · top 15,000 on PyPI
pyControl4An async library for controlling Control4 smart…
permissive · top 15,000 on PyPI
PySwitchbotAsync Python library to discover and control…
permissive · top 15,000 on PyPI
pylitterbotControl Whisker Litter-Robot and Feeder-Robot…
permissive · top 15,000 on PyPI
aioruckusAsync Python client library for querying and…
permissive · top 15,000 on PyPI
seamOfficial Python SDK for the Seam API that…
permissive · top 15,000 on PyPI
meross-iotA Python library for controlling Meross IoT…
permissive · top 15,000 on PyPI
deebot-clientA Python client library for controlling Ecovacs…
copyleft · top 15,000 on PyPI
wledAn asynchronous Python client library for…
permissive · top 15,000 on PyPI