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:
1 parent
7a4cc8e082
commit
2f474a0ed8
6 files changed
+42
-28
No files matched your search
@@ -31,17 +31,16 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||
@asyncio.coroutine
|
||||
def make_sensor(discovery_info):
|
||||
"""Create ZHA sensors factory."""
|
||||
from bellows.zigbee import zcl
|
||||
if isinstance(discovery_info['clusters'][0],
|
||||
zcl.clusters.measurement.TemperatureMeasurement):
|
||||
from bellows.zigbee.zcl.clusters.measurement import TemperatureMeasurement
|
||||
in_clusters = discovery_info['in_clusters']
|
||||
if TemperatureMeasurement.cluster_id in in_clusters:
|
||||
sensor = TemperatureSensor(**discovery_info)
|
||||
else:
|
||||
sensor = Sensor(**discovery_info)
|
||||
|
||||
clusters = discovery_info['clusters']
|
||||
attr = sensor.value_attribute
|
||||
if discovery_info['new_join']:
|
||||
cluster = clusters[0]
|
||||
cluster = list(in_clusters.values())[0]
|
||||
yield from cluster.bind()
|
||||
yield from cluster.configure_reporting(
|
||||
attr, 300, 600, sensor.min_reportable_change,
|
||||
|
||||
Reference in new issue
Block a user