Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add extControl support #5

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

ptxmac
Copy link

@ptxmac ptxmac commented Feb 19, 2022

extControl allows a client to control each panel directly.

This PR is not completely, but it is functional. Sample code for testing it:

async def main():
    async with ClientSession() as session:
        nanoleaf = aionanoleaf.Nanoleaf(session, "<host>", "<token>")
        await nanoleaf.get_info()
        s = await nanoleaf.steam()
        red = Color(255, 0, 0, 0)
        green = Color(0, 255, 0, 0)
        clear = Color(0, 0, 0, 0)
        panels = sorted(list(nanoleaf.panels), key=lambda p: (p.x_coordinate, p.y_coordinate))
        updates = [
            Update(p.id, red, 10 * idx) for idx, p in enumerate(panels)
        ]
        await s.send_updates(updates)
        await asyncio.sleep(len(panels) * 1)
        await s.send_updates([Update(p.id, clear, 0) for p in panels])
        for p in reversed(panels):
            await s.send_updates([Update(p.id, green, 10)])
            await asyncio.sleep(1)
            await s.send_updates([Update(p.id, red, 10)])
            await asyncio.sleep(1)

run(main())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant