Use async_configure for ZHA IAS binary sensor (#19629)

* Update Zha IAS binary sensor to use async_configure().

* Make less debug logging noise.
pull/19656/head
Alexei Chetroi 2018-12-29 19:13:52 -05:00 committed by Martin Hjelmare
parent 25e5864a22
commit e096532cf1
1 changed files with 7 additions and 4 deletions

View File

@ -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