Skip to content

Commit

Permalink
fix: support multizone devices with more than 82 zones
Browse files Browse the repository at this point in the history
Signed-off-by: Avi Miller <[email protected]>
  • Loading branch information
Djelibeybi committed Sep 7, 2024
1 parent 6178eba commit 09bd4ef
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
9 changes: 4 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ packages = [

[tool.poetry.dependencies]
python = "^3.12"
aiolifx = "^1.0.5"
aiolifx = "^1.1.0"

# Documentation Dependencies
Sphinx = {version = "^7.0.0", optional = true}
Expand Down
6 changes: 1 addition & 5 deletions src/aiolifx_themes/painter.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,13 @@ async def paint(
colors = MultiZoneGenerator().get_theme_colors(theme, light.zones_count)

if supports_extended_multizone(light) is True:
# Pad to 82 zones and send a single message
for _ in range(len(colors), 82):
colors.append((0, 0, 0, 3500))

tasks.append(
AwaitAioLIFX().wait(
partial(
light.set_extended_color_zones,
colors,
light.zones_count,
duration=duration,
duration=int(duration * 1000),
)
)
)
Expand Down
9 changes: 9 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ def _mocked_beam() -> Light:
return light


def _mocked_neon() -> Light:
"""Mock longer extended multizone light."""
light = _mocked_light()
light.label = "LIFX Outdoor Neon Intl"
light.product = 162
light.zones_count = 120
return light


def _mocked_tile() -> Light:
"""Mock matrix light."""
light = _mocked_light()
Expand Down
10 changes: 8 additions & 2 deletions tests/test_painter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@

from aiolifx_themes.themes import ThemeLibrary, ThemePainter

from . import _mocked_beam, _mocked_light, _mocked_tile, _mocked_z_strip
from . import _mocked_beam, _mocked_light, _mocked_neon, _mocked_tile, _mocked_z_strip


@pytest.mark.asyncio
async def test_theme_painter() -> None:
"""Test the theme painter."""
lights = [_mocked_light(), _mocked_z_strip(), _mocked_beam(), _mocked_tile()]
lights = [
_mocked_light(),
_mocked_z_strip(),
_mocked_beam(),
_mocked_neon(),
_mocked_tile(),
]
library = ThemeLibrary()
theme = library.get_theme("dream")

Expand Down

0 comments on commit 09bd4ef

Please sign in to comment.