1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-29 19:57:40 +01:00
Files
Franck Nijhof b9575ee881 Fix line length violations in components i-l (#170704)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2026-05-14 23:24:13 +02:00

54 lines
1.8 KiB
Python

"""Base entity for IronOS integration."""
from typing import TYPE_CHECKING
from homeassistant.helpers.device_registry import CONNECTION_BLUETOOTH, DeviceInfo
from homeassistant.helpers.entity import EntityDescription
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import MANUFACTURER, MODEL
from .coordinator import IronOSLiveDataCoordinator
class IronOSBaseEntity(CoordinatorEntity[IronOSLiveDataCoordinator]):
"""Base IronOS entity."""
_attr_has_entity_name = True
def __init__(
self,
coordinator: IronOSLiveDataCoordinator,
entity_description: EntityDescription,
) -> None:
"""Initialize the sensor."""
super().__init__(coordinator)
self.entity_description = entity_description
self._attr_unique_id = (
f"{coordinator.config_entry.unique_id}_{entity_description.key}"
)
if TYPE_CHECKING:
assert coordinator.config_entry.unique_id
self._attr_device_info = DeviceInfo(
connections={(CONNECTION_BLUETOOTH, coordinator.config_entry.unique_id)},
manufacturer=MANUFACTURER,
model=MODEL,
name="Pinecil",
)
if coordinator.device_info.is_synced:
self._attr_device_info.update(
DeviceInfo(
sw_version=coordinator.device_info.build,
serial_number=(
f"{coordinator.device_info.device_sn}"
f" (ID:{coordinator.device_info.device_id})"
),
)
)
@property
def available(self) -> bool:
"""Return if entity is available."""
return super().available and self.coordinator.device.is_connected