diff --git a/custom_components/tech/fan.py b/custom_components/tech/fan.py index 54e93ee..c1d161a 100644 --- a/custom_components/tech/fan.py +++ b/custom_components/tech/fan.py @@ -83,7 +83,11 @@ async def async_setup_entry( if tile[CONF_TYPE] == TYPE_TEMPERATURE_CH: widget1_txt_id = tile[CONF_PARAMS].get("widget1", {}).get("txtId", 0) widget2_txt_id = tile[CONF_PARAMS].get("widget2", {}).get("txtId", 0) - from .const import RECUPERATION_EXHAUST_FLOW, RECUPERATION_SUPPLY_FLOW, RECUPERATION_SUPPLY_FLOW_ALT + from .const import ( + RECUPERATION_EXHAUST_FLOW, + RECUPERATION_SUPPLY_FLOW, + RECUPERATION_SUPPLY_FLOW_ALT, + ) for flow_sensor in [RECUPERATION_EXHAUST_FLOW, RECUPERATION_SUPPLY_FLOW, RECUPERATION_SUPPLY_FLOW_ALT]: if flow_sensor["txt_id"] in [widget1_txt_id, widget2_txt_id]: has_recuperation_flow = True @@ -267,7 +271,6 @@ def _is_party_mode_active(self) -> bool: def _get_party_mode_duration(self) -> int: """Get configured party mode duration from number entity or use default.""" - from .const import PARTY_MODE_MIN_MINUTES default_duration = 60 # Default 1 hour @@ -286,6 +289,11 @@ def _get_party_mode_duration(self) -> int: return default_duration + def get_state(self, device): + """Get device state.""" + gear = device[CONF_PARAMS].get("gear", 0) + return gear > 0 + def update_properties(self, device): """Update the properties of the device.""" self._state = self.is_on @@ -367,7 +375,11 @@ def is_on(self) -> bool: """Return true if the recuperation is on.""" # Check flow values to determine if recuperation is running if self._coordinator.data and "tiles" in self._coordinator.data: - from .const import RECUPERATION_EXHAUST_FLOW, RECUPERATION_SUPPLY_FLOW, RECUPERATION_SUPPLY_FLOW_ALT + from .const import ( + RECUPERATION_EXHAUST_FLOW, + RECUPERATION_SUPPLY_FLOW, + RECUPERATION_SUPPLY_FLOW_ALT, + ) for tile_id, tile_data in self._coordinator.data["tiles"].items(): if tile_data.get("type") == TYPE_TEMPERATURE_CH: @@ -391,7 +403,11 @@ def percentage(self) -> int | None: # Try to determine speed based on flow values if self._coordinator.data and "tiles" in self._coordinator.data: - from .const import RECUPERATION_EXHAUST_FLOW, RECUPERATION_SUPPLY_FLOW, RECUPERATION_SUPPLY_FLOW_ALT, RECUPERATION_SPEED_ENDPOINTS + from .const import ( + RECUPERATION_EXHAUST_FLOW, + RECUPERATION_SUPPLY_FLOW, + RECUPERATION_SUPPLY_FLOW_ALT, + ) for tile_id, tile_data in self._coordinator.data["tiles"].items(): if tile_data.get("type") == TYPE_TEMPERATURE_CH: @@ -484,4 +500,4 @@ def _get_configured_speed_values(self) -> dict: except (ValueError, TypeError): _LOGGER.debug("Could not parse speed %s value: %s", speed_level, state.state) - return configured_values \ No newline at end of file + return configured_values