Fix cover template entities honoring titlecase True/False (#39803)

This commit is contained in:
J. Nick Koston authored and Paulus Schoutsen committed 2020-09-08 15:35:34 +00:00
1 parent 0d27e10d77
commit fa07787007
3 files changed
+46 -4

No files matched your search

+4 -3
View File
@@ -249,15 +249,16 @@ class CoverTemplate(TemplateEntity, CoverEntity):
self._position = None
return
if result in _VALID_STATES:
if result in ("true", STATE_OPEN):
state = result.lower()
if state in _VALID_STATES:
if state in ("true", STATE_OPEN):
self._position = 100
else:
self._position = 0
else:
_LOGGER.error(
"Received invalid cover is_on state: %s. Expected: %s",
result,
state,
", ".join(_VALID_STATES),
)
self._position = None
+1 -1
View File
@@ -412,7 +412,7 @@ class LightTemplate(TemplateEntity, LightEntity):
self._available = True
return
state = str(result).lower()
state = result.lower()
if state in _VALID_STATES:
self._state = state in ("true", STATE_ON)
else: