Add configure_reporting() method to zha component (#16487)

* Add zha.configure_reporting() method.

Binds a cluster and configures reporting for the specified attribute.

* git add homeassistant/components/binary_sensor/zha.py

* Refactor sensor.zha to use new 'configure_reporting() method.

* Zha configure reporting - switch (#1)

* use configure_reporting for zha switch

* lint fixes

* Rename variables/classes to properly reflect the content
This commit is contained in:
Alexei Chetroi 2018-09-13 03:11:47 -04:00 committed by Paulus Schoutsen
parent 1586d3000c
commit f2203e52ef
4 changed files with 66 additions and 24 deletions

View file

@ -57,9 +57,9 @@ def make_sensor(discovery_info):
if discovery_info['new_join']:
cluster = list(in_clusters.values())[0]
yield from cluster.bind()
yield from cluster.configure_reporting(
sensor.value_attribute, 300, 600, sensor.min_reportable_change,
yield from zha.configure_reporting(
sensor.entity_id, cluster, sensor.value_attribute,
reportable_change=sensor.min_reportable_change
)
return sensor