Skip to content

Async typed Python package for the Nanoleaf OpenAPI

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
Notifications You must be signed in to change notification settings

milanmeu/aionanoleaf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Async typed Python package for the Nanoleaf OpenAPI

Resources

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING

Stars

Watchers

Forks

Packages

No packages published

Languages