1 """Breeze switch of the Renson ventilation unit."""
3 from __future__
import annotations
8 from renson_endura_delta.field_enum
import CURRENT_LEVEL_FIELD, DataType
9 from renson_endura_delta.renson
import Level, RensonVentilation
16 from .
import RensonCoordinator
17 from .const
import DOMAIN
18 from .entity
import RensonEntity
20 _LOGGER = logging.getLogger(__name__)
24 """Provide the breeze switch."""
26 _attr_device_class = SwitchDeviceClass.SWITCH
27 _attr_has_entity_name =
True
28 _attr_translation_key =
"breeze"
32 api: RensonVentilation,
33 coordinator: RensonCoordinator,
35 """Initialize class."""
36 super().
__init__(
"breeze", api, coordinator)
41 """Turn on the switch."""
42 _LOGGER.debug(
"Enable Breeze")
44 await self.
hasshasshass.async_add_executor_job(self.
apiapiapi.set_manual_level, Level.BREEZE)
48 """Turn off the switch."""
49 _LOGGER.debug(
"Disable Breeze")
51 await self.
hasshasshass.async_add_executor_job(self.
apiapiapi.set_manual_level, Level.OFF)
56 """Handle updated data from the coordinator."""
58 level = self.
apiapiapi.parse_value(
59 self.
apiapiapi.get_field_value(self.coordinator.data, CURRENT_LEVEL_FIELD.name),
63 self.
_attr_is_on_attr_is_on = level == Level.BREEZE.value
70 config_entry: ConfigEntry,
71 async_add_entities: AddEntitiesCallback,
73 """Call the Renson integration to setup."""
75 api: RensonVentilation = hass.data[DOMAIN][config_entry.entry_id].api
76 coordinator: RensonCoordinator = hass.data[DOMAIN][
None __init__(self, RensonVentilation api, RensonCoordinator coordinator)
None _handle_coordinator_update(self)
None async_turn_off(self, **Any kwargs)
None async_turn_on(self, **Any kwargs)
None async_write_ha_state(self)
None async_request_refresh(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)