Skip to content

Add Aqara H1 with neutral features #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions zha/application/platforms/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
TUYA_PLUG_ONOFF,
)
from zhaquirks.xiaomi.aqara.magnet_ac01 import OppleCluster as MagnetAC01OppleCluster
from zhaquirks.xiaomi.aqara.opple_switch import OppleOperationMode
from zhaquirks.xiaomi.aqara.switch_acn047 import OppleCluster as T2RelayOppleCluster
from zigpy import types
from zigpy.quirks.v2 import ZCLEnumMetadata
Expand Down Expand Up @@ -512,6 +513,19 @@ class AqaraT2RelayDecoupledMode(ZCLEnumSelectEntity):
_attr_translation_key: str = "decoupled_mode"


@CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names="opple_cluster",
models={"lumi.switch.n1aeu1", "lumi.switch.n2aeu1"},
)
class AqaraH1OperationMode(ZCLEnumSelectEntity):
"""Representation of a ZHA switch operation mode configuration entity."""

_unique_id_suffix = "operation_mode"
_attribute_name = "operation_mode"
_enum = OppleOperationMode
_attr_translation_key: str = "operation_mode"


class InovelliOutputMode(types.enum1):
"""Inovelli output mode."""

Expand Down
36 changes: 36 additions & 0 deletions zha/application/platforms/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,42 @@ class XiaomiPlugPowerOutageMemorySwitch(ConfigurableAttributeSwitch):
_attr_translation_key = "power_outage_memory"


@CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names="opple_cluster",
models={"lumi.switch.n1aeu1", "lumi.switch.n2aeu1"},
)
class AqaraH1OutageMemorySwitch(ConfigurableAttributeSwitch):
"""Representation of a ZHA power outage memory configuration entity."""

_unique_id_suffix = "power_outage_memory"
_attribute_name = "power_outage_memory"
_attr_translation_key = "power_outage_memory"


@CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names="opple_cluster",
models={"lumi.switch.n1aeu1", "lumi.switch.n2aeu1"},
)
class AqaraH1ReverseIndicationLightSwitch(ConfigurableAttributeSwitch):
"""Representation of a ZHA reverse indication light."""

_unique_id_suffix = "reverse_indicator_light"
_attribute_name = "reverse_indicator_light"
_attr_translation_key = "reverse_indicator_light"


@CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names="opple_cluster",
models={"lumi.switch.n1aeu1", "lumi.switch.n2aeu1"},
)
class AqaraH1DoNotDisturbSwitch(ConfigurableAttributeSwitch):
"""Representation of a ZHA do not disturb mode."""

_unique_id_suffix = "do_not_disturb"
_attribute_name = "do_not_disturb"
_attr_translation_key = "do_not_disturb"


@CONFIG_DIAGNOSTIC_MATCH(
cluster_handler_names=CLUSTER_HANDLER_BASIC,
manufacturers={"Philips", "Signify Netherlands B.V."},
Expand Down
10 changes: 10 additions & 0 deletions zha/zigbee/cluster_handlers/manufacturerspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,16 @@
"light_level": True,
"hand_open": True,
}
elif self.cluster.endpoint.model in (
"lumi.switch.n1aeu1",
"lumi.switch.n2aeu1",
):
self.ZCL_INIT_ATTRS = {

Check warning on line 210 in zha/zigbee/cluster_handlers/manufacturerspecific.py

View check run for this annotation

Codecov / codecov/patch

zha/zigbee/cluster_handlers/manufacturerspecific.py#L210

Added line #L210 was not covered by tests
"power_outage_memory": True,
"reverse_indicator_light": True,
"operation_mode": True,
"do_not_disturb": True,
}

async def async_initialize_cluster_handler_specific(self, from_cache: bool) -> None: # pylint: disable=unused-argument
"""Initialize cluster handler specific."""
Expand Down
Loading