From eb3cfb22413dd194a671ad23690156485d04eea1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 25 Dec 2021 11:53:36 -1000 Subject: [PATCH] Remove segment support from A1 devices (not actually supported) (#273) --- flux_led/protocol.py | 24 +++++++++--------------- tests_aio.py | 6 +++--- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/flux_led/protocol.py b/flux_led/protocol.py index 82eacb74..0af7e044 100755 --- a/flux_led/protocol.py +++ b/flux_led/protocol.py @@ -39,9 +39,9 @@ class MusicMode(Enum): @dataclass class LEDENETAddressableDeviceConfiguration: pixels_per_segment: int # pixels per segment - segments: int # number of segments - music_pixels_per_segment: int # music pixels per segment - music_segments: int # number of music segments + segments: Optional[int] # number of segments + music_pixels_per_segment: Optional[int] # music pixels per segment + music_segments: Optional[int] # number of music segments wirings: List[str] # available wirings in the current mode wiring: Optional[str] # RGB/BRG/GBR etc wiring_num: Optional[int] # RGB/BRG/GBR number @@ -1144,17 +1144,11 @@ def parse_strip_setting(self, msg: bytes) -> LEDENETAddressableDeviceConfigurati hex(low_byte), pixels_per_segment, ) - segments = msg[5] - _LOGGER.debug( - "Segment count (%s) is: %s", - hex(segments), - segments, - ) return LEDENETAddressableDeviceConfiguration( pixels_per_segment=pixels_per_segment, - segments=segments, - music_pixels_per_segment=0, - music_segments=0, + segments=None, + music_pixels_per_segment=None, + music_segments=None, wirings=list(ADDRESSABLE_RGB_WIRING_TO_NUM), wiring_num=msg[10], wiring=ADDRESSABLE_RGB_NUM_TO_WIRING.get(msg[10]), @@ -1960,9 +1954,9 @@ def parse_strip_setting(self, msg: bytes) -> LEDENETAddressableDeviceConfigurati """Parse a strip settings message.""" return LEDENETAddressableDeviceConfiguration( pixels_per_segment=6, - segments=1, - music_pixels_per_segment=0, - music_segments=0, + segments=None, + music_pixels_per_segment=None, + music_segments=None, wirings=[], wiring_num=None, wiring=None, diff --git a/tests_aio.py b/tests_aio.py index 179b47aa..5fdbd27a 100644 --- a/tests_aio.py +++ b/tests_aio.py @@ -745,9 +745,9 @@ def _updated_callback(*args, **kwargs): await task assert light.pixels_per_segment == 50 - assert light.segments == 0 - assert light.music_pixels_per_segment == 0 - assert light.music_segments == 0 + assert light.segments is None + assert light.music_pixels_per_segment is None + assert light.music_segments is None assert light.ic_types == [ "UCS1903", "SM16703",