Project skeleton
Some checks failed
HACS Validation / validate (push) Failing after 38s
Validate with hassfest / validate (push) Failing after 41s

This commit is contained in:
Adrian Rumpold
2025-04-07 10:17:40 +02:00
commit 5180992e98
23 changed files with 3302 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
"""Base entity for PV Microinverter integration."""
from homeassistant.helpers.device_registry import DeviceEntryType
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN, MANUFACTURER
from .coordinator import PVMicroinverterDataUpdateCoordinator
class PVMicroinverterEntity(CoordinatorEntity[PVMicroinverterDataUpdateCoordinator]):
"""Base entity for PV Microinverter integration."""
def __init__(
self,
coordinator: PVMicroinverterDataUpdateCoordinator,
station_id: str,
sensor_type: str,
) -> None:
"""Initialize the entity.
Args:
coordinator: The data update coordinator
system_id: The system identifier
sensor_type: The sensor type
"""
super().__init__(coordinator)
self._station_id = station_id
self._sensor_type = sensor_type
self._attr_unique_id = f"{station_id}_{sensor_type}"
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, station_id)},
name=f"PV Microinverter {station_id}",
manufacturer=MANUFACTURER,
model="Microinverter",
entry_type=DeviceEntryType.SERVICE,
)
@property
def available(self) -> bool:
"""Return if entity is available."""
return self.coordinator.last_update_success and super().available