Introduce base location entity for totalconnect (#115938)

* Introduce base location entity for totalconnect

* Update homeassistant/components/totalconnect/entity.py

Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>

---------

Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>
This commit is contained in:
Joost Lekkerkerker 2024-04-22 10:41:26 +02:00 committed by GitHub
parent 46941adb51
commit 09ae8b9f52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 45 additions and 42 deletions

View file

@ -19,7 +19,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import TotalConnectDataUpdateCoordinator
from .const import DOMAIN
from .entity import TotalConnectEntity, TotalConnectZoneEntity
from .entity import TotalConnectLocationEntity, TotalConnectZoneEntity
LOW_BATTERY = "low_battery"
TAMPER = "tamper"
@ -181,7 +181,7 @@ class TotalConnectZoneBinarySensor(TotalConnectZoneEntity, BinarySensorEntity):
return super().device_class
class TotalConnectAlarmBinarySensor(TotalConnectEntity, BinarySensorEntity):
class TotalConnectAlarmBinarySensor(TotalConnectLocationEntity, BinarySensorEntity):
"""Represent a TotalConnect alarm device binary sensors."""
entity_description: TotalConnectAlarmBinarySensorEntityDescription
@ -193,10 +193,9 @@ class TotalConnectAlarmBinarySensor(TotalConnectEntity, BinarySensorEntity):
location: TotalConnectLocation,
) -> None:
"""Initialize the TotalConnect alarm device binary sensor."""
super().__init__(coordinator)
super().__init__(coordinator, location)
self.entity_description = entity_description
self._location = location
self._attr_name = f"{location.location_name}{entity_description.name}"
self._attr_name = f"{self.device.name}{entity_description.name}"
self._attr_unique_id = f"{location.location_id}_{entity_description.key}"
self._attr_extra_state_attributes = {
"location_id": location.location_id,