From e096532cf12a1068171cb295c84aa55053bc33f3 Mon Sep 17 00:00:00 2001 From: Alexei Chetroi Date: Sat, 29 Dec 2018 19:13:52 -0500 Subject: [PATCH] Use async_configure for ZHA IAS binary sensor (#19629) * Update Zha IAS binary sensor to use async_configure(). * Make less debug logging noise. --- homeassistant/components/binary_sensor/zha.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/binary_sensor/zha.py b/homeassistant/components/binary_sensor/zha.py index 6bacabf73d8..9314c727bcb 100644 --- a/homeassistant/components/binary_sensor/zha.py +++ b/homeassistant/components/binary_sensor/zha.py @@ -81,10 +81,6 @@ async def _async_setup_iaszone(discovery_info): device_class = None from zigpy.zcl.clusters.security import IasZone 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: zone_type = await cluster['zone_type'] @@ -144,6 +140,13 @@ class IasZoneSensor(RestoreEntity, ZhaEntity, BinarySensorDevice): else: 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): """Retrieve latest state.""" from zigpy.types.basic import uint16_t