We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG] Aqara plug (lumi.plug.maeu01) generates errors post-2022.2
**Describe the bug**
I use this plug with HA 2022.2.3, where it's been updated to use the quirk for lumi.plug.mmeu01 after [this pull](https://github.com/zigpy/zha-device-handlers/pull/1252/commits).

There are errors popping up in the log after this update.

```
Logger: homeassistant.util.logging
Source: util/logging.py:105
First occurred: 4:34:56 PM (16 occurrences)
Last logged: 4:55:26 PM

Exception in async_state_changed when dispatching 'LUMI lumi.plug.maeu01_54:ef:44:10:00:0e:52:9d_available_entity': () Traceback (most recent call last): 
 File  "/usr/src/homeassistant/homeassistant/components/zha/entity.py", line 107, in async_state_changed self.async_write_ha_state() 
 File  "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 530, in async_write_ha_state self._async_write_ha_state() 
 File  "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 563, in _async_write_ha_state state = self._stringify_state() 
 File  "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 536, in _stringify_state if (state := self.state) is None: 
 File  "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 371, in state value = self.native_value 
 File  "/usr/src/homeassistant/homeassistant/components/zha/sensor.py", line 175, in native_value return self.formatter(raw_state) 
 File  "/usr/src/homeassistant/homeassistant/components/zha/sensor.py", line 472, in formatter return self._channel.summa_formatter(value) 
 File  "/usr/src/homeassistant/homeassistant/components/zha/core/channels/smartenergy.py", line 196, in _formatter_function return self._summa_format.format(value).lstrip() AttributeError: 'NoneType' object has no attribute 'format'
```

**To Reproduce**
Steps to reproduce the behavior: unknown

**Additional context**
```
{
  "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress|RxOnWhenIdle|MainsPowered|FullFunctionDevice: 142>, manufacturer_code=4447, maximum_buffer_size=127, maximum_incoming_transfer_size=100, server_mask=11264, maximum_outgoing_transfer_size=100, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)",
  "endpoints": {
    "1": {
      "profile_id": 260,
      "device_type": "0x0051",
      "in_clusters": [
        "0x0000",
        "0x0002",
        "0x0003",
        "0x0004",
        "0x0005",
        "0x0006",
        "0x0009",
        "0x0702",
        "0x0b04"
      ],
      "out_clusters": [
        "0x000a",
        "0x0019"
      ]
    },
    "21": {
      "profile_id": 260,
      "device_type": "0x0009",
      "in_clusters": [
        "0x000c"
      ],
      "out_clusters": [
        "0x0004",
        "0x000c"
      ]
    },
    "242": {
      "profile_id": 41440,
      "device_type": "0x0061",
      "in_clusters": [],
      "out_clusters": [
        "0x0021"
      ]
    }
  },
  "manufacturer": "LUMI",
  "model": "lumi.plug.maeu01",
  "class": "zhaquirks.xiaomi.aqara.plug_mmeu01.Plug"
}
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `zhaquirks/xiaomi/aqara/plug_mmeu01.py`
Content:
```
1 """Xiaomi lumi.plug.mmeu01 plug."""
2 import logging
3 
4 from zigpy.profiles import zha
5 from zigpy.zcl.clusters.general import (
6     Alarms,
7     AnalogInput,
8     Basic,
9     DeviceTemperature,
10     GreenPowerProxy,
11     Groups,
12     Identify,
13     OnOff,
14     Ota,
15     Scenes,
16     Time,
17 )
18 from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement
19 from zigpy.zcl.clusters.smartenergy import Metering
20 
21 from zhaquirks import Bus
22 from zhaquirks.const import (
23     DEVICE_TYPE,
24     ENDPOINTS,
25     INPUT_CLUSTERS,
26     MODELS_INFO,
27     OUTPUT_CLUSTERS,
28     PROFILE_ID,
29     SKIP_CONFIGURATION,
30 )
31 from zhaquirks.xiaomi import (
32     LUMI,
33     AnalogInputCluster,
34     BasicCluster,
35     ElectricalMeasurementCluster,
36     XiaomiCustomDevice,
37 )
38 
39 _LOGGER = logging.getLogger(__name__)
40 
41 XIAOMI_PROFILE_ID = 0xA1E0
42 XIAOMI_DEVICE_TYPE = 0x61
43 
44 
45 class Plug(XiaomiCustomDevice):
46     """lumi.plug.mmeu01 plug."""
47 
48     def __init__(self, *args, **kwargs):
49         """Init."""
50         self.voltage_bus = Bus()
51         self.consumption_bus = Bus()
52         self.power_bus = Bus()
53         super().__init__(*args, **kwargs)
54 
55     signature = {
56         MODELS_INFO: [
57             (LUMI, "lumi.plug.mmeu01"),
58             (LUMI, "lumi.plug.maeu01"),
59         ],
60         ENDPOINTS: {
61             # <SimpleDescriptor endpoint=1 profile=260 device_type=81
62             # device_version=1
63             # input_clusters=[0, 2, 3, 4, 5, 6, 9, 1794, 2820]
64             # output_clusters=[10, 25]>
65             1: {
66                 PROFILE_ID: zha.PROFILE_ID,
67                 DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
68                 INPUT_CLUSTERS: [
69                     Basic.cluster_id,
70                     DeviceTemperature.cluster_id,
71                     Identify.cluster_id,
72                     Groups.cluster_id,
73                     Scenes.cluster_id,
74                     OnOff.cluster_id,
75                     Alarms.cluster_id,
76                     Metering.cluster_id,
77                     ElectricalMeasurement.cluster_id,
78                 ],
79                 OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
80             },
81             # <SimpleDescriptor endpoint=242 profile=41440 device_type=97
82             # device_version=0
83             # input_clusters=[]
84             # output_clusters=[33]>
85             242: {
86                 PROFILE_ID: XIAOMI_PROFILE_ID,
87                 DEVICE_TYPE: XIAOMI_DEVICE_TYPE,
88                 OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
89             },
90         },
91     }
92     replacement = {
93         SKIP_CONFIGURATION: True,
94         ENDPOINTS: {
95             1: {
96                 PROFILE_ID: zha.PROFILE_ID,
97                 DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
98                 INPUT_CLUSTERS: [
99                     BasicCluster,
100                     DeviceTemperature.cluster_id,
101                     Identify.cluster_id,
102                     Groups.cluster_id,
103                     Scenes.cluster_id,
104                     OnOff.cluster_id,
105                     Alarms.cluster_id,
106                     Metering.cluster_id,
107                     ElectricalMeasurementCluster,
108                 ],
109                 OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
110             },
111             21: {
112                 PROFILE_ID: zha.PROFILE_ID,
113                 DEVICE_TYPE: zha.DeviceType.MAIN_POWER_OUTLET,
114                 INPUT_CLUSTERS: [AnalogInputCluster],
115                 OUTPUT_CLUSTERS: [AnalogInput.cluster_id, Groups.cluster_id],
116             },
117             242: {
118                 PROFILE_ID: XIAOMI_PROFILE_ID,
119                 DEVICE_TYPE: XIAOMI_DEVICE_TYPE,
120                 OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
121             },
122         },
123     }
124
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/zhaquirks/xiaomi/aqara/plug_mmeu01.py b/zhaquirks/xiaomi/aqara/plug_mmeu01.py
--- a/zhaquirks/xiaomi/aqara/plug_mmeu01.py
+++ b/zhaquirks/xiaomi/aqara/plug_mmeu01.py
@@ -2,6 +2,7 @@
 import logging
 
 from zigpy.profiles import zha
+import zigpy.types as types
 from zigpy.zcl.clusters.general import (
     Alarms,
     AnalogInput,
@@ -33,6 +34,7 @@
     AnalogInputCluster,
     BasicCluster,
     ElectricalMeasurementCluster,
+    XiaomiAqaraE1Cluster,
     XiaomiCustomDevice,
 )
 
@@ -40,6 +42,7 @@
 
 XIAOMI_PROFILE_ID = 0xA1E0
 XIAOMI_DEVICE_TYPE = 0x61
+OPPLE_MFG_CODE = 0x115F
 
 
 class Plug(XiaomiCustomDevice):
@@ -55,7 +58,6 @@
     signature = {
         MODELS_INFO: [
             (LUMI, "lumi.plug.mmeu01"),
-            (LUMI, "lumi.plug.maeu01"),
         ],
         ENDPOINTS: {
             # <SimpleDescriptor endpoint=1 profile=260 device_type=81
@@ -121,3 +123,58 @@
             },
         },
     }
+
+
+class OppleCluster(XiaomiAqaraE1Cluster):
+    """Opple cluster."""
+
+    ep_attribute = "opple_cluster"
+    attributes = {
+        0x0009: ("mode", types.uint8_t, True),
+    }
+    attr_config = {0x0009: 0x00}
+
+    async def bind(self):
+        """Bind cluster."""
+        result = await super().bind()
+        await self.write_attributes(self.attr_config, manufacturer=OPPLE_MFG_CODE)
+        return result
+
+
+class PlugMAEU01(Plug):
+    """lumi.plug.maeu01 plug."""
+
+    signature = {
+        MODELS_INFO: [
+            (LUMI, "lumi.plug.maeu01"),
+        ],
+        ENDPOINTS: Plug.signature[ENDPOINTS],
+    }
+
+    replacement = {
+        SKIP_CONFIGURATION: False,
+        ENDPOINTS: {
+            1: {
+                PROFILE_ID: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
+                INPUT_CLUSTERS: [
+                    Basic.cluster_id,
+                    DeviceTemperature.cluster_id,
+                    Identify.cluster_id,
+                    Groups.cluster_id,
+                    Scenes.cluster_id,
+                    OnOff.cluster_id,
+                    Alarms.cluster_id,
+                    Metering.cluster_id,
+                    ElectricalMeasurement.cluster_id,
+                    OppleCluster,
+                ],
+                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
+            },
+            242: {
+                PROFILE_ID: XIAOMI_PROFILE_ID,
+                DEVICE_TYPE: XIAOMI_DEVICE_TYPE,
+                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
+            },
+        },
+    }

{"golden_diff": "diff --git a/zhaquirks/xiaomi/aqara/plug_mmeu01.py b/zhaquirks/xiaomi/aqara/plug_mmeu01.py\n--- a/zhaquirks/xiaomi/aqara/plug_mmeu01.py\n+++ b/zhaquirks/xiaomi/aqara/plug_mmeu01.py\n@@ -2,6 +2,7 @@\n import logging\n \n from zigpy.profiles import zha\n+import zigpy.types as types\n from zigpy.zcl.clusters.general import (\n     Alarms,\n     AnalogInput,\n@@ -33,6 +34,7 @@\n     AnalogInputCluster,\n     BasicCluster,\n     ElectricalMeasurementCluster,\n+    XiaomiAqaraE1Cluster,\n     XiaomiCustomDevice,\n )\n \n@@ -40,6 +42,7 @@\n \n XIAOMI_PROFILE_ID = 0xA1E0\n XIAOMI_DEVICE_TYPE = 0x61\n+OPPLE_MFG_CODE = 0x115F\n \n \n class Plug(XiaomiCustomDevice):\n@@ -55,7 +58,6 @@\n     signature = {\n         MODELS_INFO: [\n             (LUMI, \"lumi.plug.mmeu01\"),\n-            (LUMI, \"lumi.plug.maeu01\"),\n         ],\n         ENDPOINTS: {\n             # <SimpleDescriptor endpoint=1 profile=260 device_type=81\n@@ -121,3 +123,58 @@\n             },\n         },\n     }\n+\n+\n+class OppleCluster(XiaomiAqaraE1Cluster):\n+    \"\"\"Opple cluster.\"\"\"\n+\n+    ep_attribute = \"opple_cluster\"\n+    attributes = {\n+        0x0009: (\"mode\", types.uint8_t, True),\n+    }\n+    attr_config = {0x0009: 0x00}\n+\n+    async def bind(self):\n+        \"\"\"Bind cluster.\"\"\"\n+        result = await super().bind()\n+        await self.write_attributes(self.attr_config, manufacturer=OPPLE_MFG_CODE)\n+        return result\n+\n+\n+class PlugMAEU01(Plug):\n+    \"\"\"lumi.plug.maeu01 plug.\"\"\"\n+\n+    signature = {\n+        MODELS_INFO: [\n+            (LUMI, \"lumi.plug.maeu01\"),\n+        ],\n+        ENDPOINTS: Plug.signature[ENDPOINTS],\n+    }\n+\n+    replacement = {\n+        SKIP_CONFIGURATION: False,\n+        ENDPOINTS: {\n+            1: {\n+                PROFILE_ID: zha.PROFILE_ID,\n+                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,\n+                INPUT_CLUSTERS: [\n+                    Basic.cluster_id,\n+                    DeviceTemperature.cluster_id,\n+                    Identify.cluster_id,\n+                    Groups.cluster_id,\n+                    Scenes.cluster_id,\n+                    OnOff.cluster_id,\n+                    Alarms.cluster_id,\n+                    Metering.cluster_id,\n+                    ElectricalMeasurement.cluster_id,\n+                    OppleCluster,\n+                ],\n+                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],\n+            },\n+            242: {\n+                PROFILE_ID: XIAOMI_PROFILE_ID,\n+                DEVICE_TYPE: XIAOMI_DEVICE_TYPE,\n+                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],\n+            },\n+        },\n+    }\n", "issue": "[BUG] Aqara plug (lumi.plug.maeu01) generates errors post-2022.2\n**Describe the bug**\r\nI use this plug with HA 2022.2.3, where it's been updated to use the quirk for lumi.plug.mmeu01 after [this pull](https://github.com/zigpy/zha-device-handlers/pull/1252/commits).\r\n\r\nThere are errors popping up in the log after this update.\r\n\r\n```\r\nLogger: homeassistant.util.logging\r\nSource: util/logging.py:105\r\nFirst occurred: 4:34:56 PM (16 occurrences)\r\nLast logged: 4:55:26 PM\r\n\r\nException in async_state_changed when dispatching 'LUMI lumi.plug.maeu01_54:ef:44:10:00:0e:52:9d_available_entity': () Traceback (most recent call last): \r\n File  \"/usr/src/homeassistant/homeassistant/components/zha/entity.py\", line 107, in async_state_changed self.async_write_ha_state() \r\n File  \"/usr/src/homeassistant/homeassistant/helpers/entity.py\", line 530, in async_write_ha_state self._async_write_ha_state() \r\n File  \"/usr/src/homeassistant/homeassistant/helpers/entity.py\", line 563, in _async_write_ha_state state = self._stringify_state() \r\n File  \"/usr/src/homeassistant/homeassistant/helpers/entity.py\", line 536, in _stringify_state if (state := self.state) is None: \r\n File  \"/usr/src/homeassistant/homeassistant/components/sensor/__init__.py\", line 371, in state value = self.native_value \r\n File  \"/usr/src/homeassistant/homeassistant/components/zha/sensor.py\", line 175, in native_value return self.formatter(raw_state) \r\n File  \"/usr/src/homeassistant/homeassistant/components/zha/sensor.py\", line 472, in formatter return self._channel.summa_formatter(value) \r\n File  \"/usr/src/homeassistant/homeassistant/components/zha/core/channels/smartenergy.py\", line 196, in _formatter_function return self._summa_format.format(value).lstrip() AttributeError: 'NoneType' object has no attribute 'format'\r\n```\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior: unknown\r\n\r\n**Additional context**\r\n```\r\n{\r\n  \"node_descriptor\": \"NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress|RxOnWhenIdle|MainsPowered|FullFunctionDevice: 142>, manufacturer_code=4447, maximum_buffer_size=127, maximum_incoming_transfer_size=100, server_mask=11264, maximum_outgoing_transfer_size=100, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)\",\r\n  \"endpoints\": {\r\n    \"1\": {\r\n      \"profile_id\": 260,\r\n      \"device_type\": \"0x0051\",\r\n      \"in_clusters\": [\r\n        \"0x0000\",\r\n        \"0x0002\",\r\n        \"0x0003\",\r\n        \"0x0004\",\r\n        \"0x0005\",\r\n        \"0x0006\",\r\n        \"0x0009\",\r\n        \"0x0702\",\r\n        \"0x0b04\"\r\n      ],\r\n      \"out_clusters\": [\r\n        \"0x000a\",\r\n        \"0x0019\"\r\n      ]\r\n    },\r\n    \"21\": {\r\n      \"profile_id\": 260,\r\n      \"device_type\": \"0x0009\",\r\n      \"in_clusters\": [\r\n        \"0x000c\"\r\n      ],\r\n      \"out_clusters\": [\r\n        \"0x0004\",\r\n        \"0x000c\"\r\n      ]\r\n    },\r\n    \"242\": {\r\n      \"profile_id\": 41440,\r\n      \"device_type\": \"0x0061\",\r\n      \"in_clusters\": [],\r\n      \"out_clusters\": [\r\n        \"0x0021\"\r\n      ]\r\n    }\r\n  },\r\n  \"manufacturer\": \"LUMI\",\r\n  \"model\": \"lumi.plug.maeu01\",\r\n  \"class\": \"zhaquirks.xiaomi.aqara.plug_mmeu01.Plug\"\r\n}\r\n```\r\n\n", "before_files": [{"content": "\"\"\"Xiaomi lumi.plug.mmeu01 plug.\"\"\"\nimport logging\n\nfrom zigpy.profiles import zha\nfrom zigpy.zcl.clusters.general import (\n    Alarms,\n    AnalogInput,\n    Basic,\n    DeviceTemperature,\n    GreenPowerProxy,\n    Groups,\n    Identify,\n    OnOff,\n    Ota,\n    Scenes,\n    Time,\n)\nfrom zigpy.zcl.clusters.homeautomation import ElectricalMeasurement\nfrom zigpy.zcl.clusters.smartenergy import Metering\n\nfrom zhaquirks import Bus\nfrom zhaquirks.const import (\n    DEVICE_TYPE,\n    ENDPOINTS,\n    INPUT_CLUSTERS,\n    MODELS_INFO,\n    OUTPUT_CLUSTERS,\n    PROFILE_ID,\n    SKIP_CONFIGURATION,\n)\nfrom zhaquirks.xiaomi import (\n    LUMI,\n    AnalogInputCluster,\n    BasicCluster,\n    ElectricalMeasurementCluster,\n    XiaomiCustomDevice,\n)\n\n_LOGGER = logging.getLogger(__name__)\n\nXIAOMI_PROFILE_ID = 0xA1E0\nXIAOMI_DEVICE_TYPE = 0x61\n\n\nclass Plug(XiaomiCustomDevice):\n    \"\"\"lumi.plug.mmeu01 plug.\"\"\"\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"Init.\"\"\"\n        self.voltage_bus = Bus()\n        self.consumption_bus = Bus()\n        self.power_bus = Bus()\n        super().__init__(*args, **kwargs)\n\n    signature = {\n        MODELS_INFO: [\n            (LUMI, \"lumi.plug.mmeu01\"),\n            (LUMI, \"lumi.plug.maeu01\"),\n        ],\n        ENDPOINTS: {\n            # <SimpleDescriptor endpoint=1 profile=260 device_type=81\n            # device_version=1\n            # input_clusters=[0, 2, 3, 4, 5, 6, 9, 1794, 2820]\n            # output_clusters=[10, 25]>\n            1: {\n                PROFILE_ID: zha.PROFILE_ID,\n                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,\n                INPUT_CLUSTERS: [\n                    Basic.cluster_id,\n                    DeviceTemperature.cluster_id,\n                    Identify.cluster_id,\n                    Groups.cluster_id,\n                    Scenes.cluster_id,\n                    OnOff.cluster_id,\n                    Alarms.cluster_id,\n                    Metering.cluster_id,\n                    ElectricalMeasurement.cluster_id,\n                ],\n                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],\n            },\n            # <SimpleDescriptor endpoint=242 profile=41440 device_type=97\n            # device_version=0\n            # input_clusters=[]\n            # output_clusters=[33]>\n            242: {\n                PROFILE_ID: XIAOMI_PROFILE_ID,\n                DEVICE_TYPE: XIAOMI_DEVICE_TYPE,\n                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],\n            },\n        },\n    }\n    replacement = {\n        SKIP_CONFIGURATION: True,\n        ENDPOINTS: {\n            1: {\n                PROFILE_ID: zha.PROFILE_ID,\n                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,\n                INPUT_CLUSTERS: [\n                    BasicCluster,\n                    DeviceTemperature.cluster_id,\n                    Identify.cluster_id,\n                    Groups.cluster_id,\n                    Scenes.cluster_id,\n                    OnOff.cluster_id,\n                    Alarms.cluster_id,\n                    Metering.cluster_id,\n                    ElectricalMeasurementCluster,\n                ],\n                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],\n            },\n            21: {\n                PROFILE_ID: zha.PROFILE_ID,\n                DEVICE_TYPE: zha.DeviceType.MAIN_POWER_OUTLET,\n                INPUT_CLUSTERS: [AnalogInputCluster],\n                OUTPUT_CLUSTERS: [AnalogInput.cluster_id, Groups.cluster_id],\n            },\n            242: {\n                PROFILE_ID: XIAOMI_PROFILE_ID,\n                DEVICE_TYPE: XIAOMI_DEVICE_TYPE,\n                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],\n            },\n        },\n    }\n", "path": "zhaquirks/xiaomi/aqara/plug_mmeu01.py"}], "after_files": [{"content": "\"\"\"Xiaomi lumi.plug.mmeu01 plug.\"\"\"\nimport logging\n\nfrom zigpy.profiles import zha\nimport zigpy.types as types\nfrom zigpy.zcl.clusters.general import (\n    Alarms,\n    AnalogInput,\n    Basic,\n    DeviceTemperature,\n    GreenPowerProxy,\n    Groups,\n    Identify,\n    OnOff,\n    Ota,\n    Scenes,\n    Time,\n)\nfrom zigpy.zcl.clusters.homeautomation import ElectricalMeasurement\nfrom zigpy.zcl.clusters.smartenergy import Metering\n\nfrom zhaquirks import Bus\nfrom zhaquirks.const import (\n    DEVICE_TYPE,\n    ENDPOINTS,\n    INPUT_CLUSTERS,\n    MODELS_INFO,\n    OUTPUT_CLUSTERS,\n    PROFILE_ID,\n    SKIP_CONFIGURATION,\n)\nfrom zhaquirks.xiaomi import (\n    LUMI,\n    AnalogInputCluster,\n    BasicCluster,\n    ElectricalMeasurementCluster,\n    XiaomiAqaraE1Cluster,\n    XiaomiCustomDevice,\n)\n\n_LOGGER = logging.getLogger(__name__)\n\nXIAOMI_PROFILE_ID = 0xA1E0\nXIAOMI_DEVICE_TYPE = 0x61\nOPPLE_MFG_CODE = 0x115F\n\n\nclass Plug(XiaomiCustomDevice):\n    \"\"\"lumi.plug.mmeu01 plug.\"\"\"\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"Init.\"\"\"\n        self.voltage_bus = Bus()\n        self.consumption_bus = Bus()\n        self.power_bus = Bus()\n        super().__init__(*args, **kwargs)\n\n    signature = {\n        MODELS_INFO: [\n            (LUMI, \"lumi.plug.mmeu01\"),\n        ],\n        ENDPOINTS: {\n            # <SimpleDescriptor endpoint=1 profile=260 device_type=81\n            # device_version=1\n            # input_clusters=[0, 2, 3, 4, 5, 6, 9, 1794, 2820]\n            # output_clusters=[10, 25]>\n            1: {\n                PROFILE_ID: zha.PROFILE_ID,\n                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,\n                INPUT_CLUSTERS: [\n                    Basic.cluster_id,\n                    DeviceTemperature.cluster_id,\n                    Identify.cluster_id,\n                    Groups.cluster_id,\n                    Scenes.cluster_id,\n                    OnOff.cluster_id,\n                    Alarms.cluster_id,\n                    Metering.cluster_id,\n                    ElectricalMeasurement.cluster_id,\n                ],\n                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],\n            },\n            # <SimpleDescriptor endpoint=242 profile=41440 device_type=97\n            # device_version=0\n            # input_clusters=[]\n            # output_clusters=[33]>\n            242: {\n                PROFILE_ID: XIAOMI_PROFILE_ID,\n                DEVICE_TYPE: XIAOMI_DEVICE_TYPE,\n                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],\n            },\n        },\n    }\n    replacement = {\n        SKIP_CONFIGURATION: True,\n        ENDPOINTS: {\n            1: {\n                PROFILE_ID: zha.PROFILE_ID,\n                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,\n                INPUT_CLUSTERS: [\n                    BasicCluster,\n                    DeviceTemperature.cluster_id,\n                    Identify.cluster_id,\n                    Groups.cluster_id,\n                    Scenes.cluster_id,\n                    OnOff.cluster_id,\n                    Alarms.cluster_id,\n                    Metering.cluster_id,\n                    ElectricalMeasurementCluster,\n                ],\n                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],\n            },\n            21: {\n                PROFILE_ID: zha.PROFILE_ID,\n                DEVICE_TYPE: zha.DeviceType.MAIN_POWER_OUTLET,\n                INPUT_CLUSTERS: [AnalogInputCluster],\n                OUTPUT_CLUSTERS: [AnalogInput.cluster_id, Groups.cluster_id],\n            },\n            242: {\n                PROFILE_ID: XIAOMI_PROFILE_ID,\n                DEVICE_TYPE: XIAOMI_DEVICE_TYPE,\n                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],\n            },\n        },\n    }\n\n\nclass OppleCluster(XiaomiAqaraE1Cluster):\n    \"\"\"Opple cluster.\"\"\"\n\n    ep_attribute = \"opple_cluster\"\n    attributes = {\n        0x0009: (\"mode\", types.uint8_t, True),\n    }\n    attr_config = {0x0009: 0x00}\n\n    async def bind(self):\n        \"\"\"Bind cluster.\"\"\"\n        result = await super().bind()\n        await self.write_attributes(self.attr_config, manufacturer=OPPLE_MFG_CODE)\n        return result\n\n\nclass PlugMAEU01(Plug):\n    \"\"\"lumi.plug.maeu01 plug.\"\"\"\n\n    signature = {\n        MODELS_INFO: [\n            (LUMI, \"lumi.plug.maeu01\"),\n        ],\n        ENDPOINTS: Plug.signature[ENDPOINTS],\n    }\n\n    replacement = {\n        SKIP_CONFIGURATION: False,\n        ENDPOINTS: {\n            1: {\n                PROFILE_ID: zha.PROFILE_ID,\n                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,\n                INPUT_CLUSTERS: [\n                    Basic.cluster_id,\n                    DeviceTemperature.cluster_id,\n                    Identify.cluster_id,\n                    Groups.cluster_id,\n                    Scenes.cluster_id,\n                    OnOff.cluster_id,\n                    Alarms.cluster_id,\n                    Metering.cluster_id,\n                    ElectricalMeasurement.cluster_id,\n                    OppleCluster,\n                ],\n                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],\n            },\n            242: {\n                PROFILE_ID: XIAOMI_PROFILE_ID,\n                DEVICE_TYPE: XIAOMI_DEVICE_TYPE,\n                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],\n            },\n        },\n    }\n", "path": "zhaquirks/xiaomi/aqara/plug_mmeu01.py"}]}