Fix none-check in template light (#62089)

This commit is contained in:
Erik Montnemery 2021-12-16 16:12:43 +01:00 committed by Franck Nijhof
parent e44d50e1b1
commit d92ad76ed9
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -641,9 +641,13 @@ class LightTemplate(TemplateEntity, LightEntity):
@callback @callback
def _update_color(self, render): def _update_color(self, render):
"""Update the hs_color from the template.""" """Update the hs_color from the template."""
if render is None:
self._color = None
return
h_str = s_str = None h_str = s_str = None
if isinstance(render, str): if isinstance(render, str):
if render in (None, "None", ""): if render in ("None", ""):
self._color = None self._color = None
return return
h_str, s_str = map( h_str, s_str = map(