1 """Climate integration microBees."""
16 from .const
import DOMAIN
17 from .coordinator
import MicroBeesUpdateCoordinator
18 from .entity
import MicroBeesActuatorEntity
20 CLIMATE_PRODUCT_IDS = {
24 THERMOSTAT_SENSOR_ID = 762
25 THERMOVALVE_SENSOR_ID = 782
29 hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
31 """Set up the microBees climate platform."""
32 coordinator: MicroBeesUpdateCoordinator = hass.data[DOMAIN][
42 for sensor
in bee.sensors
46 if bee.productID == 76
47 else THERMOVALVE_SENSOR_ID
51 for bee_id, bee
in coordinator.data.bees.items()
52 if bee.productID
in CLIMATE_PRODUCT_IDS
57 """Representation of a microBees climate."""
59 _attr_temperature_unit = UnitOfTemperature.CELSIUS
60 _attr_target_temperature_step = 0.5
61 _attr_supported_features = (
62 ClimateEntityFeature.TARGET_TEMPERATURE
63 | ClimateEntityFeature.TURN_ON
64 | ClimateEntityFeature.TURN_OFF
66 _attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF]
67 _attr_fan_modes =
None
74 coordinator: MicroBeesUpdateCoordinator,
79 """Initialize the microBees climate."""
80 super().
__init__(coordinator, bee_id, actuator_id)
85 """Return the sensor temperature."""
86 return self.coordinator.data.sensors[self.
sensor_idsensor_id].value
90 """Return current hvac operation i.e. heat, cool mode."""
97 """Return the current target temperature."""
98 return self.
beebee.instanceData.targetTemp
101 """Set new target temperature."""
102 temperature = kwargs.get(ATTR_TEMPERATURE)
103 send_command = await self.coordinator.microbees.sendCommand(
110 self.
beebee.instanceData.targetTemp = temperature
114 """Set new target hvac mode."""
115 if hvac_mode == HVACMode.OFF:
120 """Turn on the climate."""
121 temperature = kwargs.get(ATTR_TEMPERATURE)
122 send_command = await self.coordinator.microbees.sendCommand(
123 self.
actuator_idactuator_id, 1, temperature=temperature
134 """Turn off the climate."""
135 temperature = kwargs.get(ATTR_TEMPERATURE)
136 send_command = await self.coordinator.microbees.sendCommand(
137 self.
actuator_idactuator_id, 0, temperature=temperature
None async_turn_off(self)
None __init__(self, MicroBeesUpdateCoordinator coordinator, int bee_id, int actuator_id, int sensor_id)
None async_turn_off(self, **Any kwargs)
float|None current_temperature(self)
None async_set_temperature(self, **Any kwargs)
float|None target_temperature(self)
None async_turn_on(self, **Any kwargs)
None async_set_hvac_mode(self, HVACMode hvac_mode, **Any kwargs)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)