1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-30 04:05:01 +01:00
Files
2026-04-30 21:14:48 +02:00

42 lines
1.3 KiB
Python

"""Provides the DataUpdateCoordinator."""
from typing import Any
from homeassistant.helpers.entity import EntityDescription
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .coordinator import GardenaBluetoothCoordinator
class GardenaBluetoothEntity(CoordinatorEntity[GardenaBluetoothCoordinator]):
"""Coordinator entity for Gardena Bluetooth."""
_attr_has_entity_name = True
def __init__(
self, coordinator: GardenaBluetoothCoordinator, context: Any = None
) -> None:
"""Initialize coordinator entity."""
super().__init__(coordinator, context)
self._attr_device_info = coordinator.device_info
@property
def available(self) -> bool:
"""Return if entity is available."""
return self.coordinator.last_update_success and self._attr_available
class GardenaBluetoothDescriptorEntity(GardenaBluetoothEntity):
"""Coordinator entity for entities with entity description."""
def __init__(
self,
coordinator: GardenaBluetoothCoordinator,
description: EntityDescription,
context: set[str],
) -> None:
"""Initialize description entity."""
super().__init__(coordinator, context)
self._attr_unique_id = f"{coordinator.address}-{description.key}"
self.entity_description = description