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() + struct.pack(" bytes: return struct.pack( " bytes: return struct.pack(" bytes: return struct.pack(" bytes: return self.swipe.as_bytes() + self.change.as_bytes()