Skip to content

Commit

Permalink
Update Zha IAS binary sensor to use async_configure().
Browse files Browse the repository at this point in the history
  • Loading branch information
Adminiuga committed Dec 28, 2018
1 parent 82d6fe5 commit 665ba09
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions homeassistant/components/binary_sensor/zha.py
Expand Up @@ -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']
Expand Down Expand Up @@ -144,6 +140,14 @@ async def async_added_to_hass(self):
else:
self._state = 0

async def async_configure(self):
"""Configure IAS device."""
_LOGGER.debug("%s: is being configured...", self.entity_id)
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
Expand Down

0 comments on commit 665ba09

Please sign in to comment.