An async Python wrapper for the Nanoleaf API.
pip install aionanoleaf
from aionanoleaf import Nanoleaf
aiohttp.ClientSession
to make requestsfrom aiohttp import ClientSession
session = ClientSession()
Nanoleaf
instancefrom aionanoleaf import Nanoleaf
light = Nanoleaf(session, "192.168.0.100")
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())