1 """Intellifire Climate Entities."""
3 from __future__
import annotations
9 ClimateEntityDescription,
18 from .
import IntellifireDataUpdateCoordinator
19 from .const
import DEFAULT_THERMOSTAT_TEMP, DOMAIN, LOGGER
20 from .entity
import IntellifireEntity
22 INTELLIFIRE_CLIMATES: tuple[ClimateEntityDescription, ...] = (
30 async_add_entities: AddEntitiesCallback,
32 """Configure the fan entry.."""
33 coordinator: IntellifireDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
35 if coordinator.data.has_thermostat:
38 coordinator=coordinator,
39 description=description,
41 for description
in INTELLIFIRE_CLIMATES
46 """Intellifire climate entity."""
48 entity_description: ClimateEntityDescription
50 _attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF]
53 _attr_supported_features = (
54 ClimateEntityFeature.TARGET_TEMPERATURE
55 | ClimateEntityFeature.TURN_OFF
56 | ClimateEntityFeature.TURN_ON
58 _attr_target_temperature_step = 1.0
59 _attr_temperature_unit = UnitOfTemperature.CELSIUS
60 last_temp = DEFAULT_THERMOSTAT_TEMP
61 _enable_turn_on_off_backwards_compatibility =
False
65 coordinator: IntellifireDataUpdateCoordinator,
66 description: ClimateEntityDescription,
68 """Configure climate entry - and override last_temp if the thermostat is currently on."""
69 super().
__init__(coordinator, description)
71 if coordinator.data.thermostat_on:
72 self.
last_templast_temp =
int(coordinator.data.thermostat_setpoint_c)
76 """Return current hvac mode."""
77 if self.coordinator.read_api.data.thermostat_on:
82 """Turn on thermostat by setting a target temperature."""
83 raw_target_temp = kwargs[ATTR_TEMPERATURE]
86 "Setting target temp to %sc %sf",
88 (raw_target_temp * 9 / 5) + 32,
90 await self.coordinator.control_api.set_thermostat_c(
96 """Return the current temperature."""
97 return float(self.coordinator.read_api.data.temperature_c)
101 """Return target temperature."""
102 return float(self.coordinator.read_api.data.thermostat_setpoint_c)
105 """Set HVAC mode to normal or thermostat control."""
107 "Setting mode to [%s] - using last temp: %s", hvac_mode, self.
last_templast_temp
110 if hvac_mode == HVACMode.OFF:
111 await self.coordinator.control_api.turn_off_thermostat()
116 await self.coordinator.control_api.set_thermostat_c(
121 if not self.coordinator.read_api.data.is_on:
122 await self.coordinator.control_api.flame_on()
float current_temperature(self)
float target_temperature(self)
None async_set_hvac_mode(self, HVACMode hvac_mode)
None __init__(self, IntellifireDataUpdateCoordinator coordinator, ClimateEntityDescription description)
None async_set_temperature(self, **Any kwargs)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)