Support unknown state, position or tilt for template cover (#91172)

* Support unknown state for template cover

* Remove not related changes
This commit is contained in:
Jan Bouwhuis 2023-04-12 21:23:24 +02:00 committed by GitHub
parent 1ef6391e9c
commit 722b991234
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 117 additions and 16 deletions

View file

@ -52,6 +52,7 @@ _VALID_STATES = [
STATE_CLOSING,
"true",
"false",
"none",
]
CONF_POSITION_TEMPLATE = "position_template"
@ -238,6 +239,10 @@ class CoverTemplate(TemplateEntity, CoverEntity):
@callback
def _update_position(self, result):
if result is None:
self._position = None
return
try:
state = float(result)
except ValueError as err:
@ -256,6 +261,10 @@ class CoverTemplate(TemplateEntity, CoverEntity):
@callback
def _update_tilt(self, result):
if result is None:
self._tilt_value = None
return
try:
state = float(result)
except ValueError as err: