1 """The base entity for the A. O. Smith integration."""
3 from py_aosmith
import AOSmithAPIClient
4 from py_aosmith.models
import Device
as AOSmithDevice
9 from .const
import DOMAIN
10 from .coordinator
import AOSmithEnergyCoordinator, AOSmithStatusCoordinator
14 _AOSmithCoordinatorT: AOSmithStatusCoordinator | AOSmithEnergyCoordinator
15 ](CoordinatorEntity[_AOSmithCoordinatorT]):
16 """Base entity for A. O. Smith."""
18 _attr_has_entity_name =
True
20 def __init__(self, coordinator: _AOSmithCoordinatorT, junction_id: str) ->
None:
21 """Initialize the entity."""
23 self.junction_id = junction_id
25 identifiers={(DOMAIN, junction_id)},
29 def client(self) -> AOSmithAPIClient:
30 """Shortcut to get the API client."""
31 return self.coordinator.client
35 """Base entity for entities that use data from the status coordinator."""
39 """Shortcut to get the device from the coordinator data."""
40 return self.coordinator.data[self.junction_id]
44 """Return True if entity is available."""
45 return super().available
and self.
devicedevice.status.is_online
49 """Base entity for entities that use data from the energy coordinator."""
53 """Shortcut to get the energy usage from the coordinator data."""
54 return self.coordinator.data[self.junction_id]
AOSmithDevice device(self)
AOSmithAPIClient client(self)
None __init__(self, _AOSmithCoordinatorT coordinator, str junction_id)