Add entity translations to Big Ass Fans (#95136)

This commit is contained in:
Joost Lekkerkerker 2023-06-25 02:00:20 +02:00 committed by GitHub
parent c8430e4557
commit fa334cf2bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 111 additions and 36 deletions

View file

@ -39,7 +39,6 @@ class BAFBinarySensorDescription(
OCCUPANCY_SENSORS = (
BAFBinarySensorDescription(
key="occupancy",
name="Occupancy",
device_class=BinarySensorDeviceClass.OCCUPANCY,
value_fn=lambda device: cast(bool | None, device.fan_occupancy_detected),
),
@ -70,7 +69,7 @@ class BAFBinarySensor(BAFEntity, BinarySensorEntity):
def __init__(self, device: Device, description: BAFBinarySensorDescription) -> None:
"""Initialize the entity."""
self.entity_description = description
super().__init__(device, f"{device.name} {description.name}")
super().__init__(device)
self._attr_unique_id = f"{self._device.mac_address}-{description.key}"
@callback