From 09bd4ef913839396687ff48a3651a8855a9a6ab9 Mon Sep 17 00:00:00 2001 From: Avi Miller Date: Sat, 7 Sep 2024 16:57:50 +1000 Subject: [PATCH] fix: support multizone devices with more than 82 zones Signed-off-by: Avi Miller --- poetry.lock | 9 ++++----- pyproject.toml | 2 +- src/aiolifx_themes/painter.py | 6 +----- tests/__init__.py | 9 +++++++++ tests/test_painter.py | 10 ++++++++-- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/poetry.lock b/poetry.lock index ac69506..0106255 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2,13 +2,13 @@ [[package]] name = "aiolifx" -version = "1.0.9" +version = "1.1.0" description = "API for local communication with LIFX devices over a LAN with asyncio." optional = false python-versions = ">=3.4" files = [ - {file = "aiolifx-1.0.9-py3-none-any.whl", hash = "sha256:c5e459d2417afd64453fc1e37885eabd2fee495a470ba8b868d12359d3c3a878"}, - {file = "aiolifx-1.0.9.tar.gz", hash = "sha256:c76c331577a1c0b656911b01bf9e2461aedaa27d36b1a669048200d49fbd15d7"}, + {file = "aiolifx-1.1.0-py3-none-any.whl", hash = "sha256:1b07e04c1334ca05ff513bb5b2e1a4b2c9b50c84bd8e5f75c8330f14c83fcbe9"}, + {file = "aiolifx-1.1.0.tar.gz", hash = "sha256:3b1c8b0fbe3292f616decd9e2a2634f8e9dc23553150718bfaa1ca846a18d4c6"}, ] [package.dependencies] @@ -949,7 +949,6 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, @@ -1272,4 +1271,4 @@ docs = ["Sphinx", "myst-parser", "sphinx-rtd-theme"] [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "5a0f296d7abf3012dcbdd34f8ca29bbeba3f45cc0e65d7888dfd3745b30c4267" +content-hash = "a9e2b9f18694bccf2e9fc633fcefeeb397b5483e18c0c4cf7f45cd9fe51ca1b4" diff --git a/pyproject.toml b/pyproject.toml index 1be643b..ccf9592 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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} diff --git a/src/aiolifx_themes/painter.py b/src/aiolifx_themes/painter.py index ebf2993..c79540d 100644 --- a/src/aiolifx_themes/painter.py +++ b/src/aiolifx_themes/painter.py @@ -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), ) ) ) diff --git a/tests/__init__.py b/tests/__init__.py index d3154a8..55d4e62 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -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() diff --git a/tests/test_painter.py b/tests/test_painter.py index 2ba3fae..8bbb360 100644 --- a/tests/test_painter.py +++ b/tests/test_painter.py @@ -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")