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.2.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.2-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aionanoleaf2-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 66253a21a7db9c8929bb746fa5bb5e06ccc5127b320e471ae5ee16091252b5aa
MD5 8a0adc5c0786c4899866b1cbd701585d
BLAKE2b-256 b3b3491d7eba9e96378109c0b0e6e58cd584effc61cec5d3e6e5c2d8a8760769

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aionanoleaf2-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4bf88a17ebb405301e806b698fc05864dfdc6a9017460895ed3b36908f9adab3
MD5 1ebbbfdf36cdb35f80ec32e5e5405979
BLAKE2b-256 9f08a929b50434feb073f450466b91cda2af5886b08cd398d1bb25de0f3f5740

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