diff --git a/src/components/neo_pixels.py b/src/components/neo_pixels.py index 63f89e0..3656826 100644 --- a/src/components/neo_pixels.py +++ b/src/components/neo_pixels.py @@ -51,8 +51,6 @@ class NeoPixels(Component): @Component.reconfig_on_error def _set(self, data=None): - if not self.ready: - raise AssertionError("component not ready") if not isinstance(data, dict): raise ValueError(f"bad call data: {data!r}") pixel = data.get("pixel", None) @@ -61,13 +59,10 @@ class NeoPixels(Component): raise ValueError(f"the pixel parameter must be a int between 0 and {C_UINT32_MAX} (broadcast)") if not isinstance(color, str) or not color.startswith("#") or len(color) != 7: raise ValueError("the color parameter must be in the html hex format: '#RRGGBB'") - try: - self.conn.write(int.to_bytes(pixel, length=4, byteorder="big") + bytes.fromhex(color[1:7]) + b"\n") - response = self.conn.readline() - if response != b"ok\n": - self.log.error(response.strip()) - except serial.serialutil.SerialException: - self.log.exception(traceback.format_exc()) + self.conn.write(int.to_bytes(pixel, length=4, byteorder="big") + bytes.fromhex(color[1:7]) + b"\n") + response = self.conn.readline() + if response != b"ok\n": + self.log.error(response.strip()) def set(self, pixel, color): self.request.emit({"pixel": pixel, "color": color})