Async Python package for the Nanoleaf API
Project description
aioNanoleaf package
An async Python wrapper for the Nanoleaf API.
Installation
pip install aionanoleaf
Usage
Import
from aionanoleaf import Nanoleaf
Create a aiohttp.ClientSession
to make requests
from aiohttp import ClientSession
session = ClientSession()
Create a Nanoleaf
instance
from aionanoleaf import Nanoleaf
light = Nanoleaf(session, "192.168.0.100")
Example
from aiohttp import ClientSession
from asyncio import run
import aionanoleaf
async def main():
async with ClientSession() as session:
nanoleaf = aionanoleaf.Nanoleaf(session, "192.168.0.73")
try:
await nanoleaf.authorize()
except aionanoleaf.Unauthorized as ex:
print("Not authorizing new tokens:", ex)
return
await nanoleaf.turn_on()
await nanoleaf.get_info()
print("Brightness:", nanoleaf.brightness)
await nanoleaf.deauthorize()
run(main())
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aionanoleaf-0.0.3.tar.gz
(19.7 kB
view hashes)
Built Distribution
Close
Hashes for aionanoleaf-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a3136b55af4c52d7ccff4c1bf765a41b19bae90c2d34b2377e2a32739e0c7f2 |
|
MD5 | 0d3a7d717a34105a298a7f675e84a102 |
|
BLAKE2b-256 | 762ad08565d75055e42f4df14cc03bd54ea87f98e502549e67fecd5702ef28d7 |