mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Prevent TypeError when KNX RGB(W) light value contains None (#28358)
* Prevent TypeError when KNX RGB(W) light value contains None. * Pylint doesn't like 'w' as variable name, therefore using 'white' instead. * Simplified code as suggested by pvizeli.
This commit is contained in:
parent
44879b323e
commit
f8d779e840
@ -180,13 +180,9 @@ class KNXLight(Light):
|
||||
@property
|
||||
def brightness(self):
|
||||
"""Return the brightness of this light between 0..255."""
|
||||
if self.device.supports_brightness:
|
||||
return self.device.current_brightness
|
||||
if (
|
||||
self.device.supports_color or self.device.supports_rgbw
|
||||
) and self.device.current_color:
|
||||
return max(self.device.current_color)
|
||||
return None
|
||||
if not self.device.supports_brightness:
|
||||
return None
|
||||
return self.device.current_brightness
|
||||
|
||||
@property
|
||||
def hs_color(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user