1 """Initialization of ATAG One climate platform."""
3 from __future__
import annotations
20 from .coordinator
import AtagConfigEntry, AtagDataUpdateCoordinator
21 from .entity
import AtagEntity
27 PRESET_AWAY:
"vacation",
28 PRESET_BOOST:
"fireplace",
30 PRESET_INVERTED = {v: k
for k, v
in PRESET_MAP.items()}
31 HVAC_MODES = [HVACMode.AUTO, HVACMode.HEAT]
35 hass: HomeAssistant, entry: AtagConfigEntry, async_add_entities: AddEntitiesCallback
37 """Load a config entry."""
42 """Atag climate device."""
44 _attr_hvac_modes = HVAC_MODES
45 _attr_preset_modes =
list(PRESET_MAP.keys())
46 _attr_supported_features = (
47 ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
49 _enable_turn_on_off_backwards_compatibility =
False
51 def __init__(self, coordinator: AtagDataUpdateCoordinator, atag_id: str) ->
None:
52 """Initialize an Atag climate device."""
53 super().
__init__(coordinator, atag_id)
58 """Return hvac operation ie. heat, cool mode."""
59 return try_parse_enum(HVACMode, self.coordinator.atag.climate.hvac_mode)
63 """Return the current running hvac operation."""
64 is_active = self.coordinator.atag.climate.status
65 return HVACAction.HEATING
if is_active
else HVACAction.IDLE
69 """Return the current temperature."""
70 return self.coordinator.atag.climate.temperature
74 """Return the temperature we try to reach."""
75 return self.coordinator.atag.climate.target_temperature
79 """Return the current preset mode, e.g., auto, manual, fireplace, extend, etc."""
80 preset = self.coordinator.atag.climate.preset_mode
81 return PRESET_INVERTED.get(preset)
84 """Set new target temperature."""
85 await self.coordinator.atag.climate.set_temp(kwargs.get(ATTR_TEMPERATURE))
89 """Set new target hvac mode."""
90 await self.coordinator.atag.climate.set_hvac_mode(hvac_mode)
94 """Set new preset mode."""
95 await self.coordinator.atag.climate.set_preset_mode(PRESET_MAP[preset_mode])
HVACAction|None hvac_action(self)
float|None current_temperature(self)
str|None preset_mode(self)
float|None target_temperature(self)
None async_set_temperature(self, **Any kwargs)
None __init__(self, AtagDataUpdateCoordinator coordinator, str atag_id)
None async_set_preset_mode(self, str preset_mode)
None async_set_hvac_mode(self, HVACMode hvac_mode)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, AtagConfigEntry entry, AddEntitiesCallback async_add_entities)