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
1 changed files with 3 additions and 7 deletions
|
@ -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)
|
||||
if not self.device.supports_brightness:
|
||||
return None
|
||||
return self.device.current_brightness
|
||||
|
||||
@property
|
||||
def hs_color(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue