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).

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.0.tar.gz (24.9 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.0-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aionanoleaf2-1.0.0.tar.gz
  • Upload date:
  • Size: 24.9 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.0.tar.gz
Algorithm Hash digest
SHA256 a4cb732ae1363c242e5cc973543ade0d1b63efea68ad58a27c84d052309317e2
MD5 ec120b11306027a2ea772a03e7c37856
BLAKE2b-256 062b33600c0c77a11cbdc72297ef848513f0d7cc3db3cd4c5e352c00928c79f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aionanoleaf2-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 27.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0089ab5476ea74bb7be85fc74ceb354256d700f5b293b56ccec676aec785a385
MD5 d63ca57eb3edff7bfa95421f95a0cc20
BLAKE2b-256 5716cb2bc921c434c32844e7b59628138979d166d8dbf4e08fd1b12e745ed58a

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