Add multi-partition support for TotalConnect (#55429)
This commit is contained in:
parent
6cd83d1f66
commit
baaaf3d2bc
11 changed files with 463 additions and 256 deletions
|
@ -2,6 +2,8 @@
|
|||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASS_DOOR,
|
||||
DEVICE_CLASS_GAS,
|
||||
DEVICE_CLASS_MOTION,
|
||||
DEVICE_CLASS_SAFETY,
|
||||
DEVICE_CLASS_SMOKE,
|
||||
BinarySensorEntity,
|
||||
)
|
||||
|
@ -13,7 +15,7 @@ async def async_setup_entry(hass, entry, async_add_entities) -> None:
|
|||
"""Set up TotalConnect device sensors based on a config entry."""
|
||||
sensors = []
|
||||
|
||||
client_locations = hass.data[DOMAIN][entry.entry_id].locations
|
||||
client_locations = hass.data[DOMAIN][entry.entry_id].client.locations
|
||||
|
||||
for location_id, location in client_locations.items():
|
||||
for zone_id, zone in location.zones.items():
|
||||
|
@ -70,6 +72,10 @@ class TotalConnectBinarySensor(BinarySensorEntity):
|
|||
return DEVICE_CLASS_SMOKE
|
||||
if self._zone.is_type_carbon_monoxide():
|
||||
return DEVICE_CLASS_GAS
|
||||
if self._zone.is_type_motion():
|
||||
return DEVICE_CLASS_MOTION
|
||||
if self._zone.is_type_medical():
|
||||
return DEVICE_CLASS_SAFETY
|
||||
return None
|
||||
|
||||
@property
|
||||
|
@ -80,5 +86,6 @@ class TotalConnectBinarySensor(BinarySensorEntity):
|
|||
"location_id": self._location_id,
|
||||
"low_battery": self._is_low_battery,
|
||||
"tampered": self._is_tampered,
|
||||
"partition": self._zone.partition,
|
||||
}
|
||||
return attributes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue