mirror of
https://github.com/home-assistant/core
synced 2024-08-28 03:36:46 +02:00
Introduce heat area property in moehlenhoff alpha2 (#107488)
This commit is contained in:
parent
8b0c96a212
commit
eaac01bc76
@ -35,7 +35,6 @@ async def async_setup_entry(
|
||||
)
|
||||
|
||||
|
||||
# https://developers.home-assistant.io/docs/core/entity/climate/
|
||||
class Alpha2Climate(CoordinatorEntity[Alpha2BaseCoordinator], ClimateEntity):
|
||||
"""Alpha2 ClimateEntity."""
|
||||
|
||||
@ -53,34 +52,27 @@ class Alpha2Climate(CoordinatorEntity[Alpha2BaseCoordinator], ClimateEntity):
|
||||
super().__init__(coordinator)
|
||||
self.heat_area_id = heat_area_id
|
||||
self._attr_unique_id = heat_area_id
|
||||
self._attr_name = self.coordinator.data["heat_areas"][heat_area_id][
|
||||
"HEATAREA_NAME"
|
||||
]
|
||||
self._attr_name = self.heat_area["HEATAREA_NAME"]
|
||||
|
||||
@property
|
||||
def heat_area(self) -> dict[str, Any]:
|
||||
"""Return the heat area."""
|
||||
return self.coordinator.data["heat_areas"][self.heat_area_id]
|
||||
|
||||
@property
|
||||
def min_temp(self) -> float:
|
||||
"""Return the minimum temperature."""
|
||||
return float(
|
||||
self.coordinator.data["heat_areas"][self.heat_area_id].get(
|
||||
"T_TARGET_MIN", 0.0
|
||||
)
|
||||
)
|
||||
return float(self.heat_area.get("T_TARGET_MIN", 0.0))
|
||||
|
||||
@property
|
||||
def max_temp(self) -> float:
|
||||
"""Return the maximum temperature."""
|
||||
return float(
|
||||
self.coordinator.data["heat_areas"][self.heat_area_id].get(
|
||||
"T_TARGET_MAX", 30.0
|
||||
)
|
||||
)
|
||||
return float(self.heat_area.get("T_TARGET_MAX", 30.0))
|
||||
|
||||
@property
|
||||
def current_temperature(self) -> float:
|
||||
"""Return the current temperature."""
|
||||
return float(
|
||||
self.coordinator.data["heat_areas"][self.heat_area_id].get("T_ACTUAL", 0.0)
|
||||
)
|
||||
return float(self.heat_area.get("T_ACTUAL", 0.0))
|
||||
|
||||
@property
|
||||
def hvac_mode(self) -> HVACMode:
|
||||
@ -96,9 +88,7 @@ class Alpha2Climate(CoordinatorEntity[Alpha2BaseCoordinator], ClimateEntity):
|
||||
@property
|
||||
def hvac_action(self) -> HVACAction:
|
||||
"""Return the current running hvac operation."""
|
||||
if not self.coordinator.data["heat_areas"][self.heat_area_id][
|
||||
"_HEATCTRL_STATE"
|
||||
]:
|
||||
if not self.heat_area["_HEATCTRL_STATE"]:
|
||||
return HVACAction.IDLE
|
||||
if self.coordinator.get_cooling():
|
||||
return HVACAction.COOLING
|
||||
@ -107,9 +97,7 @@ class Alpha2Climate(CoordinatorEntity[Alpha2BaseCoordinator], ClimateEntity):
|
||||
@property
|
||||
def target_temperature(self) -> float:
|
||||
"""Return the temperature we try to reach."""
|
||||
return float(
|
||||
self.coordinator.data["heat_areas"][self.heat_area_id].get("T_TARGET", 0.0)
|
||||
)
|
||||
return float(self.heat_area.get("T_TARGET", 0.0))
|
||||
|
||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set new target temperatures."""
|
||||
@ -123,9 +111,9 @@ class Alpha2Climate(CoordinatorEntity[Alpha2BaseCoordinator], ClimateEntity):
|
||||
@property
|
||||
def preset_mode(self) -> str:
|
||||
"""Return the current preset mode."""
|
||||
if self.coordinator.data["heat_areas"][self.heat_area_id]["HEATAREA_MODE"] == 1:
|
||||
if self.heat_area["HEATAREA_MODE"] == 1:
|
||||
return PRESET_DAY
|
||||
if self.coordinator.data["heat_areas"][self.heat_area_id]["HEATAREA_MODE"] == 2:
|
||||
if self.heat_area["HEATAREA_MODE"] == 2:
|
||||
return PRESET_NIGHT
|
||||
return PRESET_AUTO
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user