Fix cover template entities honoring titlecase True/False (#39803)
This commit is contained in:
1 parent
0d27e10d77
commit
fa07787007
3 files changed
+46
-4
No files matched your search
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user