Add support for zha custom cluster mappings (#16714)

* Add support for custom cluster mappings

* Refactor sub_component mapping
This commit is contained in:
damarco authored and Paulus Schoutsen committed 2018-10-09 12:53:02 +02:00
1 parent 6bf3f9e748
commit 5167658a1d
3 files changed
+23 -3

No files matched your search

+3 -1
View File
@@ -36,7 +36,9 @@ async def make_sensor(discovery_info):
from zigpy.zcl.clusters.smartenergy import Metering
from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement
in_clusters = discovery_info['in_clusters']
if RelativeHumidity.cluster_id in in_clusters:
if 'sub_component' in discovery_info:
sensor = discovery_info['sub_component'](**discovery_info)
elif RelativeHumidity.cluster_id in in_clusters:
sensor = RelativeHumiditySensor(**discovery_info)
elif TemperatureMeasurement.cluster_id in in_clusters:
sensor = TemperatureSensor(**discovery_info)