From 032d569cd1ef25675f4cbc912a17d81db4257e47 Mon Sep 17 00:00:00 2001 From: Alexei Chetroi Date: Tue, 1 Dec 2020 14:34:07 -0500 Subject: [PATCH] Add Analog cluster for Lumi plugs (#43817) --- homeassistant/components/zha/sensor.py | 5 +++++ tests/components/zha/zha_devices_list.py | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/homeassistant/components/zha/sensor.py b/homeassistant/components/zha/sensor.py index eff3892630b..b02b3a549be 100644 --- a/homeassistant/components/zha/sensor.py +++ b/homeassistant/components/zha/sensor.py @@ -145,6 +145,11 @@ class Sensor(ZhaEntity): return round(float(value * self._multiplier) / self._divisor) +@STRICT_MATCH( + channel_names=CHANNEL_ANALOG_INPUT, + manufacturers="LUMI", + models={"lumi.plug", "lumi.plug.maus01", "lumi.plug.mmeu01"}, +) @STRICT_MATCH(channel_names=CHANNEL_ANALOG_INPUT, manufacturers="Digi") class AnalogInput(Sensor): """Sensor that displays analog input values.""" diff --git a/tests/components/zha/zha_devices_list.py b/tests/components/zha/zha_devices_list.py index a6287592395..136af1f4be9 100644 --- a/tests/components/zha/zha_devices_list.py +++ b/tests/components/zha/zha_devices_list.py @@ -1372,10 +1372,22 @@ DEVICES = [ }, }, "entities": [ + "sensor.lumi_lumi_plug_maus01_77665544_analog_input", + "sensor.lumi_lumi_plug_maus01_77665544_analog_input_2", "sensor.lumi_lumi_plug_maus01_77665544_electrical_measurement", "switch.lumi_lumi_plug_maus01_77665544_on_off", ], "entity_map": { + ("sensor", "00:11:22:33:44:55:66:77-2-12"): { + "channels": ["analog_input"], + "entity_class": "AnalogInput", + "entity_id": "sensor.lumi_lumi_plug_maus01_77665544_analog_input", + }, + ("sensor", "00:11:22:33:44:55:66:77-3-12"): { + "channels": ["analog_input"], + "entity_class": "AnalogInput", + "entity_id": "sensor.lumi_lumi_plug_maus01_77665544_analog_input_2", + }, ("switch", "00:11:22:33:44:55:66:77-1"): { "channels": ["on_off"], "entity_class": "Switch",