1 """Support for Velbus thermostat."""
3 from __future__
import annotations
7 from velbusaio.channels
import Temperature
as VelbusTemp
20 from .const
import DOMAIN, PRESET_MODES
21 from .entity
import VelbusEntity, api_call
27 async_add_entities: AddEntitiesCallback,
29 """Set up Velbus switch based on config_entry."""
30 await hass.data[DOMAIN][entry.entry_id][
"tsk"]
31 cntrl = hass.data[DOMAIN][entry.entry_id][
"cntrl"]
36 """Representation of a Velbus thermostat."""
39 _attr_supported_features = (
40 ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
42 _attr_temperature_unit = UnitOfTemperature.CELSIUS
43 _attr_hvac_modes = [HVACMode.HEAT, HVACMode.COOL]
44 _attr_preset_modes =
list(PRESET_MODES)
45 _enable_turn_on_off_backwards_compatibility =
False
49 """Return the temperature we try to reach."""
50 return self.
_channel_channel.get_climate_target()
54 """Return the current Preset for this channel."""
58 for key, val
in PRESET_MODES.items()
59 if val == self.
_channel_channel.get_climate_preset()
66 """Return the current temperature."""
71 """Return the current hvac mode based on cool_mode message."""
72 return HVACMode.COOL
if self.
_channel_channel.get_cool_mode()
else HVACMode.HEAT
76 """Set new target temperatures."""
77 if (temp := kwargs.get(ATTR_TEMPERATURE))
is None:
79 await self.
_channel_channel.set_temp(temp)
84 """Set the new preset mode."""
85 await self.
_channel_channel.set_preset(PRESET_MODES[preset_mode])
90 """Set the new hvac mode."""
93 translation_domain=DOMAIN,
94 translation_key=
"invalid_hvac_mode",
95 translation_placeholders={
"hvac_mode":
str(hvac_mode)},
97 await self.
_channel_channel.set_mode(hvac_mode)
float|None target_temperature(self)
None async_set_preset_mode(self, str preset_mode)
str|None preset_mode(self)
None async_set_hvac_mode(self, HVACMode hvac_mode)
None async_set_temperature(self, **Any kwargs)
int|None current_temperature(self)
None async_write_ha_state(self)
str|float get_state(dict[str, float] data, str key)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)