--- id: aioshelly version: "13.29.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # aioshelly — Asynchronous library to control Shelly devices. License: permissive · Maintenance: active · Downloads: 95.2K/mo ## 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 above — 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 pip install aioshelly uv add aioshelly 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_current - Install friction: low - Maintenance: active - Downloads: 95.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags shelly device control library, async shelly api, smart home device automation, shelly gen1 gen2 integration, coap websocket device control, home automation python, shelly rpc client, smart-home, async-io, iot-devices [View on SkillFed](https://skillfed.io/packages/aioshelly) · [View on PyPI](https://pypi.org/project/aioshelly/)