mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Use async_configure for ZHA IAS binary sensor (#19629)
* Update Zha IAS binary sensor to use async_configure(). * Make less debug logging noise.
This commit is contained in:
parent
25e5864a22
commit
e096532cf1
@ -81,10 +81,6 @@ async def _async_setup_iaszone(discovery_info):
|
|||||||
device_class = None
|
device_class = None
|
||||||
from zigpy.zcl.clusters.security import IasZone
|
from zigpy.zcl.clusters.security import IasZone
|
||||||
cluster = discovery_info['in_clusters'][IasZone.cluster_id]
|
cluster = discovery_info['in_clusters'][IasZone.cluster_id]
|
||||||
if discovery_info['new_join']:
|
|
||||||
await cluster.bind()
|
|
||||||
ieee = cluster.endpoint.device.application.ieee
|
|
||||||
await cluster.write_attributes({'cie_addr': ieee})
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
zone_type = await cluster['zone_type']
|
zone_type = await cluster['zone_type']
|
||||||
@ -144,6 +140,13 @@ class IasZoneSensor(RestoreEntity, ZhaEntity, BinarySensorDevice):
|
|||||||
else:
|
else:
|
||||||
self._state = 0
|
self._state = 0
|
||||||
|
|
||||||
|
async def async_configure(self):
|
||||||
|
"""Configure IAS device."""
|
||||||
|
await self._ias_zone_cluster.bind()
|
||||||
|
ieee = self._ias_zone_cluster.endpoint.device.application.ieee
|
||||||
|
await self._ias_zone_cluster.write_attributes({'cie_addr': ieee})
|
||||||
|
_LOGGER.debug("%s: finished configuration", self.entity_id)
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Retrieve latest state."""
|
"""Retrieve latest state."""
|
||||||
from zigpy.types.basic import uint16_t
|
from zigpy.types.basic import uint16_t
|
||||||
|
Loading…
x
Reference in New Issue
Block a user