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.2.tar.gz
(19.7 kB
view hashes)
Built Distribution
Close
Hashes for aionanoleaf-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa70593340ae607c6abc3c3fb81aaccec608c493f1609fbc3f45446a53b1572a |
|
MD5 | 3213682a1f4d58737ea85b7f6f01ca3e |
|
BLAKE2b-256 | 354ebc7394e31ca17c6bc4dbb52279a22a1448f80c854ae4e3dd96d8901c8ac3 |