mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Fix Tuya cover open/close commands (#61369)
Co-authored-by: Franck Nijhof <frenck@frenck.nl> Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
f77c4485b6
commit
e0cb7dad31
@ -315,11 +315,18 @@ class TuyaCoverEntity(TuyaEntity, CoverEntity):
|
|||||||
{"code": self.entity_description.key, "value": value}
|
{"code": self.entity_description.key, "value": value}
|
||||||
]
|
]
|
||||||
|
|
||||||
if (self.entity_description.set_position) is not None:
|
if (
|
||||||
|
self.entity_description.set_position is not None
|
||||||
|
and self._set_position_type is not None
|
||||||
|
):
|
||||||
commands.append(
|
commands.append(
|
||||||
{
|
{
|
||||||
"code": self.entity_description.set_position,
|
"code": self.entity_description.set_position,
|
||||||
"value": 0,
|
"value": round(
|
||||||
|
self._set_position_type.remap_value_from(
|
||||||
|
100, 0, 100, reverse=True
|
||||||
|
),
|
||||||
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -327,7 +334,7 @@ class TuyaCoverEntity(TuyaEntity, CoverEntity):
|
|||||||
|
|
||||||
def close_cover(self, **kwargs: Any) -> None:
|
def close_cover(self, **kwargs: Any) -> None:
|
||||||
"""Close cover."""
|
"""Close cover."""
|
||||||
value: bool | str = True
|
value: bool | str = False
|
||||||
if self.device.function[self.entity_description.key].type == "Enum":
|
if self.device.function[self.entity_description.key].type == "Enum":
|
||||||
value = "close"
|
value = "close"
|
||||||
|
|
||||||
@ -335,11 +342,18 @@ class TuyaCoverEntity(TuyaEntity, CoverEntity):
|
|||||||
{"code": self.entity_description.key, "value": value}
|
{"code": self.entity_description.key, "value": value}
|
||||||
]
|
]
|
||||||
|
|
||||||
if (self.entity_description.set_position) is not None:
|
if (
|
||||||
|
self.entity_description.set_position is not None
|
||||||
|
and self._set_position_type is not None
|
||||||
|
):
|
||||||
commands.append(
|
commands.append(
|
||||||
{
|
{
|
||||||
"code": self.entity_description.set_position,
|
"code": self.entity_description.set_position,
|
||||||
"value": 100,
|
"value": round(
|
||||||
|
self._set_position_type.remap_value_from(
|
||||||
|
0, 0, 100, reverse=True
|
||||||
|
),
|
||||||
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user