ha-hunterbtt

Home Assistant integration for Hunter BTT
git clone https://git.stephank.nl/ha-hunterbtt
Log | Files | Refs | README | LICENSE | ZIP

entity.py (724B)


      1 """Shared entity helpers for Hunter BTT."""
      2 
      3 from homeassistant.const import CONF_ADDRESS
      4 from homeassistant.helpers.update_coordinator import CoordinatorEntity
      5 
      6 from .coordinator import HunterBTTCoordinator
      7 
      8 
      9 class HunterBTTEntity(CoordinatorEntity[HunterBTTCoordinator]):
     10     """Base entity associated with one Hunter BTT device."""
     11 
     12     _attr_has_entity_name = True
     13 
     14     def __init__(self, coordinator: HunterBTTCoordinator, key: str) -> None:
     15         """Initialize an entity with an address-stable identifier."""
     16         super().__init__(coordinator)
     17         address = coordinator.config_entry.data[CONF_ADDRESS]
     18         self._attr_unique_id = f"{address}_{key}"
     19         self._attr_device_info = coordinator.device_info