(self, colors: List[Tuple[float, float, float]])
Sets the colors of the WLED to the given list of triples.
Sets the colors of the WLED to the given list of triples.
Sets the colors of the WLED to the given list of triples .
def set_colors(self, colors: List[Tuple[float, float, float]]) -> None:
        """Sets the colors of the WLED to the given list of triples."""
        if not self.initialized:
            return
        color_bytes = bytes(
            [round(val * self.brightness * 255) for color in colors for val in color]
        )

        packet = self.header + color_bytes

        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)  # UDP
        # allow broadcast to reach multiple WLED
        sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
        sock.sendto(packet, (self.ip, self.port))
def set_colors ( self , colors : List [ Tuple [ float , float , float ] ] ) -> None : if not self . initialized : return color_bytes = bytes ( [ round ( val * self . brightness * 255 ) for color in colors for val in color ] ) packet = self . header + color_bytes sock = socket . socket ( socket . AF_INET , socket . SOCK_DGRAM ) # UDP # allow broadcast to reach multiple WLED sock . setsockopt ( socket . SOL_SOCKET , socket . SO_BROADCAST , 1 ) sock . sendto ( packet , ( self . ip , self . port ) )