Files
core/homeassistant/components/weheat/entity.py
SteveDiks 2a11c413c7 Split the energy and data retrieval in WeHeat (#139211)
* Split the energy and data logs

* Make sure that pump_info name is set to device name, bump weheat

* Adding config entry

* Fixed circular import

* parallelisation of awaits

* Update homeassistant/components/weheat/binary_sensor.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Fix undefined weheatdata

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2025-03-05 10:11:59 +01:00

33 lines
1.0 KiB
Python

"""Base entity for Weheat."""
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from . import HeatPumpInfo
from .const import DOMAIN, MANUFACTURER
from .coordinator import WeheatDataUpdateCoordinator, WeheatEnergyUpdateCoordinator
class WeheatEntity[
_WeheatEntityT: WeheatDataUpdateCoordinator | WeheatEnergyUpdateCoordinator
](CoordinatorEntity[_WeheatEntityT]):
"""Defines a base Weheat entity."""
_attr_has_entity_name = True
def __init__(
self,
heat_pump_info: HeatPumpInfo,
coordinator: _WeheatEntityT,
) -> None:
"""Initialize the Weheat entity."""
super().__init__(coordinator)
self.heat_pump_info = heat_pump_info
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, heat_pump_info.heatpump_id)},
name=heat_pump_info.readable_name,
manufacturer=MANUFACTURER,
model=heat_pump_info.model,
)