Fix None support_color_modes TypeError (#55497)

* Fix None support_color_modes TypeError 

https://github.com/home-assistant/core/issues/55451

* Update __init__.py
This commit is contained in:
Brian Egge 2021-09-01 02:26:09 -04:00 committed by Bram Kragten
parent 3b9859940f
commit 576cece7a9
No known key found for this signature in database
GPG Key ID: FBE2DFDB363EF55B

View File

@ -445,7 +445,11 @@ async def async_setup(hass, config): # noqa: C901
) )
# If both white and brightness are specified, override white # If both white and brightness are specified, override white
if ATTR_WHITE in params and COLOR_MODE_WHITE in supported_color_modes: if (
supported_color_modes
and ATTR_WHITE in params
and COLOR_MODE_WHITE in supported_color_modes
):
params[ATTR_WHITE] = params.pop(ATTR_BRIGHTNESS, params[ATTR_WHITE]) params[ATTR_WHITE] = params.pop(ATTR_BRIGHTNESS, params[ATTR_WHITE])
# Remove deprecated white value if the light supports color mode # Remove deprecated white value if the light supports color mode