from dataclasses import dataclass import struct @dataclass class ColorRGBW: r: float g: float b: float w: float def repr(self): return f"ColorRGBW({self.r}, {self.g}, {self.b}, {self.w}" def as_bytes(self) -> bytes: assert self.is_valid(), "Trying to send invalid " + repr(self) return struct.pack(" bytes: return struct.pack(" bytes: return self.color.as_bytes() @dataclass class EffectAlexaSwipeConfig: primary_color_width: float = 20 # in degrees transition_width: float = 30 # in degrees swipe_speed: float = 3 * 360 # in degrees per second bell_curve_width_in_leds: float = 3 start_position: float = 180 # in degrees forward: bool = True primary_color: ColorRGBW = ColorRGBW(0, 0, 1, 0) secondary_color: ColorRGBW = ColorRGBW(0, 200 / 255, 1, 0) def as_bytes(self) -> bytes: return struct.pack( " bytes: return struct.pack(" bytes: return struct.pack(" bytes: return self.swipe.as_bytes() + self.change.as_bytes()