skillfed

aioshelly

Asynchronous library to control Shelly devices.

aioshelly v13.29.0 95.2K downloads/30d#13,285 on PyPI81
Permissive license Apache-2.0 Active released

What it is and what it does

Aioshelly is an async Python client for Shelly smart home devices, supporting both legacy Gen1 devices (CoAP/Block protocol) and modern Gen2+ devices (RPC/WebSocket). It abstracts the underlying protocol differences so you can query device status, receive state change notifications, and issue commands through a unified interface. The library depends on aiohttp for HTTP communication, orjson for fast JSON parsing, zeroconf for device discovery, and Bluetooth-related packages for wireless connectivity.

You instantiate either a BlockDevice (Gen1) or RpcDevice (Gen2+) with connection credentials, then interact with device blocks or status objects to read values and trigger actions. The library is under active development and designed to track the official Shelly API specification.

Use it for:

  • Build a home automation dashboard that polls and displays real-time status from multiple Shelly devices.
  • Create event-driven automations that react to Shelly device state changes via WebSocket subscriptions.
  • Integrate Shelly devices into a larger Home Assistant or custom IoT platform.
  • Control Shelly relays, dimmers, and switches programmatically from a Python application.
  • Monitor Shelly power meters and environmental sensors for logging or alerting.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Asynchronous Python library for controlling Shelly smart home devices over CoAP (Gen1) and WebSocket/RPC (Gen2+) protocols.

Yes, if you need to control Shelly devices from Python. The library is actively maintained, has low install friction, carries no known vulnerabilities, and uses a permissive license. The requirement for Python 3.11+ and the 'under development' status mean you should expect occasional API changes and test thoroughly in production environments.

Install

aioshelly on PyPI

pip

pip install aioshelly

uv

uv add aioshelly

poetry

poetry add aioshelly

Installing aioshelly

Before you install

Low install friction with a pure-Python wheel and seven runtime dependencies. Actively maintained with a recent release (18 days old) and steady commit history. Requires Python 3.11 or later.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions.

Quickstart

import asyncio
import aiohttp
from aioshelly.rpc_device import RpcDevice, WsServer
from aioshelly.common import ConnectionOptions

async def main():
    options = ConnectionOptions("192.168.1.188", "user", "pass")
    ws_context = WsServer()
    await ws_context.initialize(8123)
    async with aiohttp.ClientSession() as session:
        device = await RpcDevice.create(session, ws_context, options)
        print(device.status)

asyncio.run(main())

Requires Python 3.11 or later. For Gen2+ devices, you must initialize a WsServer and provide a port for WebSocket callbacks.

Verify before relying

  • Whether the library handles reconnection and error recovery automatically or requires application-level retry logic.
  • Performance characteristics when controlling multiple devices concurrently.
  • Whether Bluetooth connectivity (via bleak-retry-connector and habluetooth dependencies) is required or optional.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 7 — aiohttp, bleak-retry-connector, bluetooth-data-tools, habluetooth, orjson, yarl, zeroconf
Maintenance actively maintained — 18 days since the last release
Last repo commit
First released
Downloads 95,184/month — #13,285 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: aioshelly-13.29.0-py3-none-any.whl

Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python Modules

Tags

shelly device control libraryasync shelly apismart home device automationshelly gen1 gen2 integrationcoap websocket device controlhome automation pythonshelly rpc client
smart-homeasync-ioiot-devices

More Python Modules packages