1 """Support for Nexia / Trane XL Thermostats."""
3 from __future__
import annotations
5 from nexia.thermostat
import NexiaThermostat
12 from .coordinator
import NexiaDataUpdateCoordinator
13 from .entity
import NexiaThermostatEntity
14 from .types
import NexiaConfigEntry
15 from .util
import percent_conv
20 config_entry: NexiaConfigEntry,
21 async_add_entities: AddEntitiesCallback,
23 """Set up sensors for a Nexia device."""
24 coordinator = config_entry.runtime_data
25 nexia_home = coordinator.nexia_home
27 entities: list[NexiaThermostatEntity] = []
28 for thermostat_id
in nexia_home.get_thermostat_ids():
29 thermostat = nexia_home.get_thermostat_by_id(thermostat_id)
30 if thermostat.has_variable_fan_speed():
33 coordinator, thermostat, thermostat.get_variable_fan_speed_limits()
40 """Provides Nexia Fan Speed support."""
42 _attr_native_unit_of_measurement = PERCENTAGE
43 _attr_translation_key =
"fan_speed"
47 coordinator: NexiaDataUpdateCoordinator,
48 thermostat: NexiaThermostat,
49 valid_range: tuple[float, float],
51 """Initialize the entity."""
55 unique_id=f
"{thermostat.thermostat_id}_fan_speed_setpoint",
57 min_value, max_value = valid_range
63 """Return the current value."""
64 fan_speed = self.
_thermostat_thermostat.get_fan_speed_setpoint()
68 """Set a new value."""
69 await self.
_thermostat_thermostat.set_fan_setpoint(value / 100)
None _signal_thermostat_update(self)
None async_set_native_value(self, float value)
None __init__(self, NexiaDataUpdateCoordinator coordinator, NexiaThermostat thermostat, tuple[float, float] valid_range)
None async_setup_entry(HomeAssistant hass, NexiaConfigEntry config_entry, AddEntitiesCallback async_add_entities)