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.2.0.tar.gz
(23.4 kB
view hashes)
Built Distribution
Close
Hashes for aionanoleaf-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e80fe6d58c8cb93e0bc3d6de47e5b7f1b0208a1384fdc1250982bd0b68f53707 |
|
MD5 | b1e06b85621533258473a980b2861484 |
|
BLAKE2b-256 | c4c31e7de5b1a34d613e81f0ed07e91e871d7cc9d079b175ad7529170e91ad64 |