Skip to main content

Async Python package for the Nanoleaf API that replaces aioNanoleaf.

Project description

aioNanoleaf2 package

PyPI PyPI - Downloads PyPI - License

This async Python wrapper for the Nanoleaf API replaces the no longer maintained aioNanoleaf package.

The original aioNanoleaf has been modified to:

  • add support for Nanoleaf Essentials devices.
  • add support for Screen Mirroring emersion modes (1D, 2D, 3D, 4D).
  • add support for IPv6 hosts.

Installation

pip install aionanoleaf2

Example

from aiohttp import ClientSession
from asyncio import run

import aionanoleaf2

async def test():
    async with ClientSession() as session:
        nanoleaf = aionanoleaf2.Nanoleaf(session, "192.168.1.28")
        try:
            await nanoleaf.authorize()
        except aionanoleaf2.Unauthorized as ex:
            print("Not authorized:", ex)
            return
        await nanoleaf.turn_on()
        await nanoleaf.get_info()
        print("IT'S WORKING!");
        print("Host:", nanoleaf.host)
        print("Port:", nanoleaf.port)
        print("API URL:", nanoleaf._api_url)
        print("Name:", nanoleaf.name)
        print("Manufacturer:", nanoleaf.manufacturer)
        print("Model:", nanoleaf.model)
        print("Serial number:", nanoleaf.serial_no)
        print("Hardware version:", nanoleaf.hardware_version)
        print("Firmware version:", nanoleaf.firmware_version)
        print("On:", nanoleaf.is_on);
        print("Brightness:", f"{nanoleaf.brightness} [{nanoleaf.brightness_min} - {nanoleaf.brightness_max}]")
        print("Hue:", f"{nanoleaf.hue} [{nanoleaf.hue_min} - {nanoleaf.hue_max}]")
        print("Saturation:", f"{nanoleaf.saturation} [{nanoleaf.saturation_min} - {nanoleaf.saturation_max}]")
        print("Color temperature:", f"{nanoleaf.color_temperature} [{nanoleaf.color_temperature_min} - {nanoleaf.color_temperature_max}]")
        print("Color mode:", nanoleaf.color_mode)
        print("Effects:", nanoleaf.effects_list)
        print("Selected effect:", nanoleaf.selected_effect)
        print("Emersions:", nanoleaf.emersion_list)
        print("Selected emersion:", nanoleaf.selected_emersion)
        print("Panels:", len(nanoleaf.panels))
        await nanoleaf.identify()
        await nanoleaf.turn_off()
        await nanoleaf.deauthorize()

run(test())

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

aionanoleaf2-1.0.1.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aionanoleaf2-1.0.1-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file aionanoleaf2-1.0.1.tar.gz.

File metadata

  • Download URL: aionanoleaf2-1.0.1.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for aionanoleaf2-1.0.1.tar.gz
Algorithm Hash digest
SHA256 bdd7ce28ea7ad95aad267bc47a410b8742b81019d2e46b2fbd35e81349834257
MD5 944caaced9e27e7b704e3901de689ad2
BLAKE2b-256 522517736f993f294470b481d193fedef862177bed1c0174390cbc67fe6f13fb

See more details on using hashes here.

File details

Details for the file aionanoleaf2-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: aionanoleaf2-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 28.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for aionanoleaf2-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 533cda65d00ed28ac62b4e67924cf1e9a23bb59c5eabb4d75db3aa235615c918
MD5 888761f0ee13ba55ea22ddab47f9490e
BLAKE2b-256 5551f71ffb60ac11e3e5c835afa3e788088002b147d0e940771b98b7d84d8264

See more details on using hashes here.

Supported by

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