Skip to content

Commit

Permalink
Remove Aqara MAEU01 plugs from group 0 (#1706)
Browse files Browse the repository at this point in the history
* Cleanup: renamed Plug to PlugMMEU01

* Remove Aqara MAEU01 plug from group 0
  • Loading branch information
TheJulianJES committed Aug 30, 2022
1 parent 1274644 commit 6f5ad0f
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions zhaquirks/xiaomi/aqara/plug_mmeu01.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Xiaomi lumi.plug.mmeu01 plug."""
"""Xiaomi Aqara EU plugs."""
import asyncio
import logging

import zigpy
from zigpy.profiles import zha
import zigpy.types as types
from zigpy.zcl.clusters.general import (
Expand Down Expand Up @@ -45,7 +47,16 @@
OPPLE_MFG_CODE = 0x115F


class Plug(XiaomiCustomDevice):
async def remove_from_ep(dev: zigpy.device.Device) -> None:
"""Remove devices that are in group 0 by default, so IKEA devices don't control them."""
endpoint = dev.endpoints.get(1)
if endpoint is not None:
dev.debug("Removing endpoint 1 from group 0")
await endpoint.remove_from_group(0)
dev.debug("Removed endpoint 1 from group 0")


class PlugMMEU01(XiaomiCustomDevice):
"""lumi.plug.mmeu01 plug."""

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -141,14 +152,19 @@ async def bind(self):
return result


class PlugMAEU01(Plug):
class PlugMAEU01(PlugMMEU01):
"""lumi.plug.maeu01 plug."""

def __init__(self, *args, **kwargs):
"""Init."""
super().__init__(*args, **kwargs)
asyncio.create_task(remove_from_ep(self))

signature = {
MODELS_INFO: [
(LUMI, "lumi.plug.maeu01"),
],
ENDPOINTS: Plug.signature[ENDPOINTS],
ENDPOINTS: PlugMMEU01.signature[ENDPOINTS],
}

replacement = {
Expand Down

0 comments on commit 6f5ad0f

Please sign in to comment.