Asynchronous library to control Shelly devices.
Project description
Aioshelly
Asynchronous library to control Shelly
This library is under development.
Requires Python 3 and uses asyncio, aiohttp and socket.
import asyncio
from pprint import pprint
import aiohttp
import aioshelly
async def main():
options = aioshelly.ConnectionOptions("192.168.1.165", "username", "password")
async with aiohttp.ClientSession() as aiohttp_session, aioshelly.COAP() as coap_context:
try:
device = await asyncio.wait_for(
aioshelly.Device.create(aiohttp_session, coap_context, options), 5
)
except asyncio.TimeoutError:
print("Timeout connecting to", ip)
return
for block in device.blocks:
print(block)
pprint(block.current_values())
print()
if __name__ == "__main__":
asyncio.run(main())
Included examples
The repository includes two examples to quickly try it out.
Connect to a device and print its status whenever we receive a state change:
python3 example.py -ip <ip> [-u <username>] [-p <password]
Connect to all the devices in devices.json
at once and print their status:
python3 example.py -d -i
Show usage help:
python3 example.py -h
Contribution guidelines
Object hierarchy and property/method names should match the Shelly API.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aioshelly-0.6.4.tar.gz
(12.3 kB
view hashes)
Built Distribution
aioshelly-0.6.4-py3-none-any.whl
(12.4 kB
view hashes)
Close
Hashes for aioshelly-0.6.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45a2169403ab7fc9e2537777656e23d141570483a2543762b55dc9ddcb4e372a |
|
MD5 | e4475050ef77b7dc0972c8c7fe171b2a |
|
BLAKE2b-256 | 492c9f302d268e9758852f6116931e984eafab4fa9894a477118c994498a8fe2 |