skillfed

switchbot-api

An asynchronous library to use Switchbot API

switchbot-api v2.13.0 73.4K downloads/30d#14,999 on PyPI6
Permissive license MIT Active released

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-api

uv

uv add switchbot-api

poetry

poetry add switchbot-api

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

switchbot api clientasync switchbot controlswitchbot device automationswitchbot remote controlhome automation switchbotswitchbot python libraryiot device control api
home-automationiotasync-api

More Internet packages