Closed TriWitch closed 1 year ago
i think version 1.0.2 solves your problem
please check it and post results
Thanks
I see you set the property default for brightness to 250, which makes sense in the absence of a "current state retrieval". With that change (using 1.0.2) it works for me. Impressive response time!
In some cases, the function _transform_color_brightness crashes because it is given a None value for brightness by the upstream funnctions.
Error is: unsupported operand type(s) for *: 'int' and 'NoneType'
Relevant part of the trace:
File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 582, in async_handle_light_on_service await light.async_turn_on(*filter_turn_on_params(light, params)) File "/config/custom_components/elkbledom/light.py", line 163, in async_turn_on color = self._transform_color_brightness(color, self.brightness) File "/config/custom_components/elkbledom/light.py", line 130, in _transform_color_brightness res = tuple(color set_brightness // 255 for color in rgb) File "/config/custom_components/elkbledom/light.py", line 130, in
res = tuple(color set_brightness // 255 for color in rgb)
TypeError: unsupported operand type(s) for : 'int' and 'NoneType'
Context: This seems to happen when self.brightness is None from a new/uninitialized/switched-off device, but I cannot say exactly
Workaround: A workaround is a sanity check in _transform_color_brightness, e.g. if set_brightens is None: set_brightness =0
but it would be better to find the root cause and fix the initialization, I guess. Happy to help when I get the time, thanks so much for your great work!