mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +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
|
@property
|
||||||
def brightness(self):
|
def brightness(self):
|
||||||
"""Return the brightness of this light between 0..255."""
|
"""Return the brightness of this light between 0..255."""
|
||||||
if self.device.supports_brightness:
|
if not self.device.supports_brightness:
|
||||||
return self.device.current_brightness
|
return None
|
||||||
if (
|
return self.device.current_brightness
|
||||||
self.device.supports_color or self.device.supports_rgbw
|
|
||||||
) and self.device.current_color:
|
|
||||||
return max(self.device.current_color)
|
|
||||||
return None
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hs_color(self):
|
def hs_color(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user