1 """BleBox climate entity."""
3 from datetime
import timedelta
18 from .
import BleBoxConfigEntry
19 from .entity
import BleBoxEntity
23 BLEBOX_TO_HVACMODE = {
30 BLEBOX_TO_HVACACTION = {
32 1: HVACAction.HEATING,
33 2: HVACAction.COOLING,
40 config_entry: BleBoxConfigEntry,
41 async_add_entities: AddEntitiesCallback,
43 """Set up a BleBox climate entity."""
46 for feature
in config_entry.runtime_data.features.get(
"climates", [])
52 """Representation of a BleBox climate feature (saunaBox)."""
54 _attr_supported_features = (
55 ClimateEntityFeature.TARGET_TEMPERATURE
56 | ClimateEntityFeature.TURN_OFF
57 | ClimateEntityFeature.TURN_ON
59 _attr_temperature_unit = UnitOfTemperature.CELSIUS
60 _enable_turn_on_off_backwards_compatibility =
False
64 """Return list of supported HVAC modes."""
65 return [HVACMode.OFF, BLEBOX_TO_HVACMODE[self._feature.mode]]
69 """Return the desired HVAC mode."""
70 if self._feature.is_on
is None:
72 if not self._feature.is_on:
74 if self._feature.mode
is not None:
75 return BLEBOX_TO_HVACMODE[self._feature.mode]
76 return HVACMode.HEAT
if self._feature.is_on
else HVACMode.OFF
80 """Return the actual current HVAC action."""
81 if self._feature.hvac_action
is not None:
82 if not self._feature.is_on:
84 return BLEBOX_TO_HVACACTION[self._feature.hvac_action]
85 if not (is_on := self._feature.is_on):
86 return None if is_on
is None else HVACAction.OFF
89 return HVACAction.HEATING
if self._feature.is_heating
else HVACAction.IDLE
93 """Return the maximum temperature supported."""
94 return self._feature.max_temp
98 """Return the maximum temperature supported."""
99 return self._feature.min_temp
103 """Return the current temperature."""
104 return self._feature.current
108 """Return the desired thermostat temperature."""
109 return self._feature.desired
112 """Set the climate entity mode."""
113 if hvac_mode
in [HVACMode.HEAT, HVACMode.COOL]:
114 await self._feature.async_on()
117 await self._feature.async_off()
120 """Set the thermostat temperature."""
121 value = kwargs[ATTR_TEMPERATURE]
def current_temperature(self)
None async_set_temperature(self, **Any kwargs)
None async_set_hvac_mode(self, HVACMode hvac_mode)
def target_temperature(self)
None async_setup_entry(HomeAssistant hass, BleBoxConfigEntry config_entry, AddEntitiesCallback async_add_entities)