mirror of
https://github.com/home-assistant/core.git
synced 2025-08-30 18:01:31 +02:00
Adjust
This commit is contained in:
@@ -372,53 +372,50 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
|
|||||||
|
|
||||||
def set_temperature(self, **kwargs: Any) -> None:
|
def set_temperature(self, **kwargs: Any) -> None:
|
||||||
"""Set new target temperature."""
|
"""Set new target temperature."""
|
||||||
commands = []
|
|
||||||
if ATTR_TEMPERATURE in kwargs:
|
if ATTR_TEMPERATURE in kwargs:
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
# guarded by ClimateEntityFeature.TARGET_TEMPERATURE
|
# guarded by ClimateEntityFeature.TARGET_TEMPERATURE
|
||||||
assert self._set_temperature is not None
|
assert self._set_temperature is not None
|
||||||
commands.append(
|
self._send_command(
|
||||||
{
|
[
|
||||||
"code": self._set_temperature.dpcode,
|
{
|
||||||
"value": round(
|
"code": self._set_temperature.dpcode,
|
||||||
self._set_temperature.scale_value_back(kwargs[ATTR_TEMPERATURE])
|
"value": round(
|
||||||
),
|
self._set_temperature.scale_value_back(
|
||||||
}
|
kwargs[ATTR_TEMPERATURE]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
}
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
return
|
||||||
|
|
||||||
if ATTR_TARGET_TEMP_LOW in kwargs:
|
if ATTR_TARGET_TEMP_LOW in kwargs and ATTR_TARGET_TEMP_HIGH in kwargs:
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
# guarded by ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
# guarded by ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
||||||
assert self._set_temperature_lower is not None
|
assert self._set_temperature_lower is not None
|
||||||
commands.append(
|
|
||||||
{
|
|
||||||
"code": self._set_temperature_lower.dpcode,
|
|
||||||
"value": round(
|
|
||||||
self._set_temperature_lower.scale_value_back(
|
|
||||||
kwargs[ATTR_TARGET_TEMP_LOW]
|
|
||||||
)
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if ATTR_TARGET_TEMP_HIGH in kwargs:
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
# guarded by ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
|
||||||
assert self._set_temperature_upper is not None
|
assert self._set_temperature_upper is not None
|
||||||
commands.append(
|
self._send_command(
|
||||||
{
|
[
|
||||||
"code": self._set_temperature_upper.dpcode,
|
{
|
||||||
"value": round(
|
"code": self._set_temperature_lower.dpcode,
|
||||||
self._set_temperature_upper.scale_value_back(
|
"value": round(
|
||||||
kwargs[ATTR_TARGET_TEMP_HIGH]
|
self._set_temperature_lower.scale_value_back(
|
||||||
)
|
kwargs[ATTR_TARGET_TEMP_LOW]
|
||||||
),
|
)
|
||||||
}
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": self._set_temperature_upper.dpcode,
|
||||||
|
"value": round(
|
||||||
|
self._set_temperature_upper.scale_value_back(
|
||||||
|
kwargs[ATTR_TARGET_TEMP_HIGH]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
if commands:
|
|
||||||
self._send_command(commands)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_temperature(self) -> float | None:
|
def current_temperature(self) -> float | None:
|
||||||
"""Return the current temperature."""
|
"""Return the current temperature."""
|
||||||
|
Reference in New Issue
Block a user