Skip to content

Commit

Permalink
Improve DeviceInfo for Total Connect (home-assistant#114509)
Browse files Browse the repository at this point in the history
  • Loading branch information
austinmroczek authored Apr 2, 2024
1 parent f36c37a commit 49fc8a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def device_info(self) -> DeviceInfo:
return DeviceInfo(
identifiers={(DOMAIN, self._device.serial_number)},
name=self._device.name,
serial_number=self._device.serial_number,
)

@property
Expand Down
11 changes: 11 additions & 0 deletions homeassistant/components/totalconnect/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import DOMAIN
Expand Down Expand Up @@ -63,6 +64,16 @@ def __init__(self, location_id, zone):
"partition": self._zone.partition,
}

@property
def device_info(self) -> DeviceInfo:
"""Return device info."""
identifier = self._zone.sensor_serial_number or f"zone_{self._zone.zoneid}"
return DeviceInfo(
name=self._zone.description,
identifiers={(DOMAIN, identifier)},
serial_number=self._zone.sensor_serial_number,
)


class TotalConnectZoneSecurityBinarySensor(TotalConnectZoneBinarySensor):
"""Represent an TotalConnect security zone."""
Expand Down

0 comments on commit 49fc8a1

Please sign in to comment.