Skip to main content

Async Python package for the Nanoleaf API and adds basic support for Nanoleaf 4D

Project description

aioNanoleaf package

PyPI PyPI - Downloads PyPI - License

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

aionanoleaf4d-0.2.4.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

aionanoleaf4d-0.2.4-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file aionanoleaf4d-0.2.4.tar.gz.

File metadata

  • Download URL: aionanoleaf4d-0.2.4.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.0

File hashes

Hashes for aionanoleaf4d-0.2.4.tar.gz
Algorithm Hash digest
SHA256 38c0c98a927a0ce051f9417c1642f3ad729b0fbfb43ec1673fc45a0ed8b8b2ae
MD5 607deeaa5f3d73ce51cdf85cb4fb87ea
BLAKE2b-256 bc0d57aa44999ff7f8f62cd02132aa9a6ca4c2ef7d27985e747d7723fcf67b93

See more details on using hashes here.

File details

Details for the file aionanoleaf4d-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for aionanoleaf4d-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f5f60576f9bed0efa44b98662c602291c3a5bb713ab1b9c86468078bbe6daf3b
MD5 e7435030a5b4c2dec7b6d4df9444ca02
BLAKE2b-256 eedced1b79a08592990cca763eb9f32959ddc92c9b65364744419a086ed7e7af

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page