zha: Handle both input and output clusters (#8410)

bellows 0.3.0 changes the API to have both, renaming the attribute which used
to be for input clusters in the process.

This is in preparation for remotes.
This commit is contained in:
Russell Cloran 2017-07-10 21:16:44 -07:00 committed by Paulus Schoutsen
parent 7a4cc8e082
commit 2f474a0ed8
6 changed files with 42 additions and 28 deletions

View file

@ -34,10 +34,10 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
from bellows.zigbee.zcl.clusters.security import IasZone
clusters = discovery_info['clusters']
in_clusters = discovery_info['in_clusters']
device_class = None
cluster = [c for c in clusters if isinstance(c, IasZone)][0]
cluster = in_clusters[IasZone.cluster_id]
if discovery_info['new_join']:
yield from cluster.bind()
ieee = cluster.endpoint.device.application.ieee
@ -64,7 +64,7 @@ class BinarySensor(zha.Entity, BinarySensorDevice):
super().__init__(**kwargs)
self._device_class = device_class
from bellows.zigbee.zcl.clusters.security import IasZone
self._ias_zone_cluster = self._clusters[IasZone.cluster_id]
self._ias_zone_cluster = self._in_clusters[IasZone.cluster_id]
@property
def is_on(self) -> bool: