1 """Platform to control a Salda Smarty XP/XV ventilation unit."""
3 from __future__
import annotations
14 percentage_to_ranged_value,
15 ranged_value_to_percentage,
19 from .
import SmartyConfigEntry
20 from .coordinator
import SmartyCoordinator
21 from .entity
import SmartyEntity
23 _LOGGER = logging.getLogger(__name__)
25 DEFAULT_ON_PERCENTAGE = 66
31 entry: SmartyConfigEntry,
32 async_add_entities: AddEntitiesCallback,
34 """Set up the Smarty Fan Platform."""
36 coordinator = entry.runtime_data
42 """Representation of a Smarty Fan."""
45 _attr_translation_key =
"fan"
46 _attr_supported_features = (
47 FanEntityFeature.SET_SPEED
48 | FanEntityFeature.TURN_OFF
49 | FanEntityFeature.TURN_ON
51 _enable_turn_on_off_backwards_compatibility =
False
53 def __init__(self, coordinator: SmartyCoordinator) ->
None:
54 """Initialize the entity."""
62 """Return state of the fan."""
67 """Return the number of speeds the fan supports."""
72 """Return speed percentage of the fan."""
78 """Set the speed percentage of the fan."""
79 _LOGGER.debug(
"Set the fan percentage to %s", percentage)
85 if not self.
_smarty_smarty.set_fan_speed(fan_speed):
87 f
"Failed to set the fan speed percentage to {percentage}"
95 percentage: int |
None =
None,
96 preset_mode: str |
None =
None,
99 """Turn on the fan."""
100 _LOGGER.debug(
"Turning on fan. percentage is %s", percentage)
104 """Turn off the fan."""
105 _LOGGER.debug(
"Turning off fan")
114 """Call update method."""
None set_percentage(self, int percentage)
None set_percentage(self, int percentage)
None turn_on(self, int|None percentage=None, str|None preset_mode=None, **Any kwargs)
None __init__(self, SmartyCoordinator coordinator)
None _handle_coordinator_update(self)
None turn_off(self, **Any kwargs)
None schedule_update_ha_state(self, bool force_refresh=False)
None turn_off(self, **Any kwargs)
None async_setup_entry(HomeAssistant hass, SmartyConfigEntry entry, AddEntitiesCallback async_add_entities)
float percentage_to_ranged_value(tuple[float, float] low_high_range, float percentage)
int ranged_value_to_percentage(tuple[float, float] low_high_range, float value)
int int_states_in_range(tuple[float, float] low_high_range)