Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions custom_components/tech/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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
return configured_values