1 """Allows to configuration ecoal (esterownik.pl) pumps as switches."""
3 from __future__
import annotations
12 from .
import AVAILABLE_PUMPS, DATA_ECOAL_BOILER
18 add_entities: AddEntitiesCallback,
19 discovery_info: DiscoveryInfoType |
None =
None,
21 """Set up switches based on ecoal interface."""
22 if discovery_info
is None:
24 ecoal_contr = hass.data[DATA_ECOAL_BOILER]
26 for pump_id
in discovery_info:
27 name = AVAILABLE_PUMPS[pump_id]
28 switches.append(
EcoalSwitch(ecoal_contr, name, pump_id))
33 """Representation of Ecoal switch."""
35 def __init__(self, ecoal_contr, name, state_attr):
38 Sets HA switch to state as read from controller.
51 """Fetch new state data for the sensor.
53 This is the only method that should fetch new data for Home Assistant.
55 status = self.
_ecoal_contr_ecoal_contr.get_cached_status()
59 """Invalidate ecoal interface cache.
61 Forces that next read from ecaol interface to not use cache.
66 """Turn the device on."""
71 """Turn the device off."""
None turn_off(self, **Any kwargs)
def invalidate_ecoal_cache(self)
None turn_on(self, **Any kwargs)
def __init__(self, ecoal_contr, name, state_attr)
None add_entities(AsusWrtRouter router, AddEntitiesCallback async_add_entities, set[str] tracked)
None setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)