Repository: zigpy/zha-device-handlers

Issue:
Add electrical measurement to lumi.relay.c2acn01
Manufacturer: LUMI
Model: lumi.relay.c2acn01

## Node Descriptor: 
```
<Optional byte1=1 byte2=64 mac_capability_flags=142 manufacturer_code=4151 maximum_buffer_size=127 maximum_incoming_transfer_size=100 server_mask=0 maximum_outgoing_transfer_size=100 descriptor_capability_field=0>
```

## Endpoint information: 
Discovered endpoints: [1, 2]
Discovered endpoint information: 

```
<SimpleDescriptor endpoint=1 profile=260 device_type=257 device_version=2 input_clusters=[0, 3, 4, 5, 1, 2, 10, 6, 16, 2820, 12] output_clusters=[25, 10]>

<SimpleDescriptor endpoint=2 profile=260 device_type=257 device_version=2 input_clusters=[6, 16, 4, 5] output_clusters=[]>
```



Discussion:

Resolving patch:
diff --git a/zhaquirks/xiaomi/__init__.py b/zhaquirks/xiaomi/__init__.py
--- a/zhaquirks/xiaomi/__init__.py
+++ b/zhaquirks/xiaomi/__init__.py
@@ -209,9 +209,10 @@ def _parse_aqara_attributes(self, value):
                     102: PRESSURE_MEASUREMENT,
                 }
             )
-        elif (
-            MODEL in self._attr_cache and self._attr_cache[MODEL] == "lumi.plug.maus01"
-        ):
+        elif MODEL in self._attr_cache and self._attr_cache[MODEL] in [
+            "lumi.plug.maus01",
+            "lumi.relay.c2acn01",
+        ]:
             attribute_names.update({149: CONSUMPTION, 150: VOLTAGE, 152: POWER})
 
         result = {}
diff --git a/zhaquirks/xiaomi/aqara/relay.py b/zhaquirks/xiaomi/aqara/relay.py
new file mode 100644
--- /dev/null
+++ b/zhaquirks/xiaomi/aqara/relay.py
@@ -0,0 +1,140 @@
+"""Xiaomi aqara button sensor."""
+import logging
+
+from zigpy.profiles import zha
+from zigpy.zcl.clusters.general import (
+    AnalogInput,
+    Basic,
+    BinaryOutput,
+    DeviceTemperature,
+    Groups,
+    Identify,
+    OnOff,
+    Ota,
+    PowerConfiguration,
+    Scenes,
+    Time,
+)
+from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement
+
+from ... import Bus, CustomCluster
+from ...const import (
+    DEVICE_TYPE,
+    ENDPOINTS,
+    INPUT_CLUSTERS,
+    MODELS_INFO,
+    OUTPUT_CLUSTERS,
+    PROFILE_ID,
+)
+from .. import (
+    LUMI,
+    POWER_REPORTED,
+    BasicCluster,
+    ElectricalMeasurementCluster,
+    XiaomiCustomDevice,
+)
+
+_LOGGER = logging.getLogger(__name__)
+
+
+class AnalogInputCluster(CustomCluster, AnalogInput):
+    """Analog input cluster."""
+
+    cluster_id = AnalogInput.cluster_id
+
+    def __init__(self, *args, **kwargs):
+        """Init."""
+        self._current_state = {}
+        super().__init__(*args, **kwargs)
+
+    def _update_attribute(self, attrid, value):
+        super()._update_attribute(attrid, value)
+        if value is not None and value >= 0:
+            self.endpoint.device.power_bus.listener_event(POWER_REPORTED, value)
+
+
+class Relay(XiaomiCustomDevice):
+    """lumi.plug.maus01 device."""
+
+    def __init__(self, *args, **kwargs):
+        """Init."""
+        self.voltage_bus = Bus()
+        self.consumption_bus = Bus()
+        self.power_bus = Bus()
+        super().__init__(*args, **kwargs)
+
+    signature = {
+        MODELS_INFO: [(LUMI, "lumi.relay.c2acn01")],
+        ENDPOINTS: {
+            # <SimpleDescriptor endpoint=1 profile=260 device_type=257
+            # device_version=2
+            # input_clusters=[0, 3, 4, 5, 1, 2, 10, 6, 16, 2820, 12]
+            # output_clusters=[25, 10]>
+            1: {
+                PROFILE_ID: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT,
+                INPUT_CLUSTERS: [
+                    Basic.cluster_id,
+                    PowerConfiguration.cluster_id,
+                    DeviceTemperature.cluster_id,
+                    Groups.cluster_id,
+                    Identify.cluster_id,
+                    OnOff.cluster_id,
+                    Scenes.cluster_id,
+                    BinaryOutput.cluster_id,
+                    Time.cluster_id,
+                    ElectricalMeasurement.cluster_id,
+                    AnalogInput.cluster_id,
+                ],
+                OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],
+            },
+            # <SimpleDescriptor endpoint=2 profile=260 device_type=257
+            # device_version=2
+            # input_clusters=[6, 16, 4, 5]
+            # output_clusters=[]>
+            2: {
+                PROFILE_ID: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT,
+                INPUT_CLUSTERS: [
+                    OnOff.cluster_id,
+                    BinaryOutput.cluster_id,
+                    Groups.cluster_id,
+                    Scenes.cluster_id,
+                ],
+                OUTPUT_CLUSTERS: [],
+            },
+        },
+    }
+    replacement = {
+        ENDPOINTS: {
+            1: {
+                PROFILE_ID: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT,
+                INPUT_CLUSTERS: [
+                    BasicCluster,
+                    PowerConfiguration.cluster_id,
+                    DeviceTemperature.cluster_id,
+                    Groups.cluster_id,
+                    Identify.cluster_id,
+                    OnOff.cluster_id,
+                    Scenes.cluster_id,
+                    BinaryOutput.cluster_id,
+                    Time.cluster_id,
+                    ElectricalMeasurementCluster,
+                    AnalogInputCluster,
+                ],
+                OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],
+            },
+            2: {
+                PROFILE_ID: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT,
+                INPUT_CLUSTERS: [
+                    OnOff.cluster_id,
+                    BinaryOutput.cluster_id,
+                    Groups.cluster_id,
+                    Scenes.cluster_id,
+                ],
+                OUTPUT_CLUSTERS: [],
+            },
+        }
+    }


Test patch: