Skip to content

Commit 6f5ad0f

Browse files
authored
Remove Aqara MAEU01 plugs from group 0 (#1706)
* Cleanup: renamed Plug to PlugMMEU01 * Remove Aqara MAEU01 plug from group 0
1 parent 1274644 commit 6f5ad0f

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

zhaquirks/xiaomi/aqara/plug_mmeu01.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
"""Xiaomi lumi.plug.mmeu01 plug."""
1+
"""Xiaomi Aqara EU plugs."""
2+
import asyncio
23
import logging
34

5+
import zigpy
46
from zigpy.profiles import zha
57
import zigpy.types as types
68
from zigpy.zcl.clusters.general import (
@@ -45,7 +47,16 @@
4547
OPPLE_MFG_CODE = 0x115F
4648

4749

48-
class Plug(XiaomiCustomDevice):
50+
async def remove_from_ep(dev: zigpy.device.Device) -> None:
51+
"""Remove devices that are in group 0 by default, so IKEA devices don't control them."""
52+
endpoint = dev.endpoints.get(1)
53+
if endpoint is not None:
54+
dev.debug("Removing endpoint 1 from group 0")
55+
await endpoint.remove_from_group(0)
56+
dev.debug("Removed endpoint 1 from group 0")
57+
58+
59+
class PlugMMEU01(XiaomiCustomDevice):
4960
"""lumi.plug.mmeu01 plug."""
5061

5162
def __init__(self, *args, **kwargs):
@@ -141,14 +152,19 @@ async def bind(self):
141152
return result
142153

143154

144-
class PlugMAEU01(Plug):
155+
class PlugMAEU01(PlugMMEU01):
145156
"""lumi.plug.maeu01 plug."""
146157

158+
def __init__(self, *args, **kwargs):
159+
"""Init."""
160+
super().__init__(*args, **kwargs)
161+
asyncio.create_task(remove_from_ep(self))
162+
147163
signature = {
148164
MODELS_INFO: [
149165
(LUMI, "lumi.plug.maeu01"),
150166
],
151-
ENDPOINTS: Plug.signature[ENDPOINTS],
167+
ENDPOINTS: PlugMMEU01.signature[ENDPOINTS],
152168
}
153169

154170
replacement = {

0 commit comments

Comments
 (0)