mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Save last target temperature in Shelly climate platform (#80561)
Save last target temp
This commit is contained in:
parent
8e9457d808
commit
1b130eb271
@ -132,6 +132,7 @@ class BlockSleepingClimate(
|
|||||||
self.last_state: State | None = None
|
self.last_state: State | None = None
|
||||||
self.last_state_attributes: Mapping[str, Any]
|
self.last_state_attributes: Mapping[str, Any]
|
||||||
self._preset_modes: list[str] = []
|
self._preset_modes: list[str] = []
|
||||||
|
self._last_target_temp = 20.0
|
||||||
|
|
||||||
if self.block is not None and self.device_block is not None:
|
if self.block is not None and self.device_block is not None:
|
||||||
self._unique_id = f"{self.coordinator.mac}-{self.block.description}"
|
self._unique_id = f"{self.coordinator.mac}-{self.block.description}"
|
||||||
@ -260,9 +261,15 @@ class BlockSleepingClimate(
|
|||||||
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
||||||
"""Set hvac mode."""
|
"""Set hvac mode."""
|
||||||
if hvac_mode == HVACMode.OFF:
|
if hvac_mode == HVACMode.OFF:
|
||||||
|
if isinstance(self.target_temperature, float):
|
||||||
|
self._last_target_temp = self.target_temperature
|
||||||
await self.set_state_full_path(
|
await self.set_state_full_path(
|
||||||
target_t_enabled=1, target_t=f"{self._attr_min_temp}"
|
target_t_enabled=1, target_t=f"{self._attr_min_temp}"
|
||||||
)
|
)
|
||||||
|
if hvac_mode == HVACMode.HEAT:
|
||||||
|
await self.set_state_full_path(
|
||||||
|
target_t_enabled=1, target_t=self._last_target_temp
|
||||||
|
)
|
||||||
|
|
||||||
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
||||||
"""Set preset mode."""
|
"""Set preset mode."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user