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.1.tar.gz
(23.8 kB
view details)
Built Distribution
File details
Details for the file aionanoleaf-0.2.1.tar.gz
.
File metadata
- Download URL: aionanoleaf-0.2.1.tar.gz
- Upload date:
- Size: 23.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e00ef56546ab7ed4a6e0897e8b9c7b290da44406d477361bbf5d31d04c454265 |
|
MD5 | 0abb696268c0993197be34ce3c6f42ef |
|
BLAKE2b-256 | 7eb15bc4116e8fdbd7aa8d1660f9a9dbe3a794f7acb50dbdb5588660345cc52e |
File details
Details for the file aionanoleaf-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: aionanoleaf-0.2.1-py3-none-any.whl
- Upload date:
- Size: 27.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34061b35d9b50b528cc135455b0897538a6e5bd69b0775b0393b043cbca87853 |
|
MD5 | 79883c3f56586c3f45fd9066d6b18b5d |
|
BLAKE2b-256 | 56d8971cb2ff9163bcf9d0100ec383944db2f0168673e8eead2a069ef1be82e6 |