Skip to content
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

Add more Aqara H1 wireless double rocker variants #3169

Merged
Merged
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
148 changes: 125 additions & 23 deletions zhaquirks/xiaomi/aqara/remote_h1.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
"""Aqara H1-series wireless remote."""
from zigpy.profiles import zha
import zigpy.types as t
from zigpy.zcl.clusters.general import Basic, Identify, OnOff, PowerConfiguration
from zigpy.zcl.clusters.general import (
Basic,
Identify,
LevelControl,
MultistateInput,
OnOff,
PowerConfiguration,
)
from zigpy.zcl.clusters.lighting import Color

from zhaquirks import PowerConfigurationCluster
from zhaquirks.const import (
Expand Down Expand Up @@ -147,9 +155,6 @@ class RemoteH1DoubleRocker1(XiaomiCustomDevice):
MODELS_INFO: [(LUMI, "lumi.remote.b28ac1")],
ENDPOINTS: {
1: {
# SizePrefixedSimpleDescriptor(
# endpoint=1, profile=260, device_type=259, device_version=1,
# input_clusters=[0, 3, 1], output_clusters=[3, 6])
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH,
INPUT_CLUSTERS: [
Expand All @@ -163,9 +168,6 @@ class RemoteH1DoubleRocker1(XiaomiCustomDevice):
],
},
3: {
# SizePrefixedSimpleDescriptor(
# endpoint=3, profile=260, device_type=259, device_version=1,
# input_clusters=[3], output_clusters=[6])
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH,
INPUT_CLUSTERS: [Identify.cluster_id],
Expand Down Expand Up @@ -218,7 +220,7 @@ class RemoteH1DoubleRocker1(XiaomiCustomDevice):
}
device_automation_triggers = {
# triggers when operation_mode == event
# the button doesn't send an release event after hold
# the button doesn't send a release event after hold
(SHORT_PRESS, LEFT): {COMMAND: COMMAND_1_SINGLE},
(DOUBLE_PRESS, LEFT): {COMMAND: COMMAND_1_DOUBLE},
(TRIPLE_PRESS, LEFT): {COMMAND: COMMAND_1_TRIPLE},
Expand All @@ -238,17 +240,13 @@ class RemoteH1DoubleRocker1(XiaomiCustomDevice):
}


class RemoteH1DoubleRocker2(XiaomiCustomDevice):
class RemoteH1DoubleRocker2(RemoteH1DoubleRocker1):
"""Aqara H1 Wireless Remote Double Rocker Version WRS-R02, variant 2."""

signature = {
MODELS_INFO: [(LUMI, "lumi.remote.b28ac1")],
ENDPOINTS: {
1: {
# "1": {
# "profile_id": 260, "device_type": "0x0103",
# "in_clusters": [ "0x0000", "0x0001", "0x0003" ],
# "out_clusters": [ "0x0003", "0x0006" ] }
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH,
INPUT_CLUSTERS: [
Expand All @@ -262,10 +260,6 @@ class RemoteH1DoubleRocker2(XiaomiCustomDevice):
],
},
2: {
# "2": {
# "profile_id": 260, "device_type": "0x0103",
# "in_clusters": [ "0x0003" ],
# "out_clusters": [ "0x0003", "0x0006" ] }
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH,
INPUT_CLUSTERS: [
Expand All @@ -277,16 +271,124 @@ class RemoteH1DoubleRocker2(XiaomiCustomDevice):
],
},
3: {
# "3": {
# "profile_id": 260, "device_type": "0x0103",
# "in_clusters": [ "0x0003" ],
# "out_clusters": [ "0x0006" ] }
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH,
INPUT_CLUSTERS: [Identify.cluster_id],
OUTPUT_CLUSTERS: [OnOff.cluster_id],
},
},
}
replacement = RemoteH1DoubleRocker1.replacement
device_automation_triggers = RemoteH1DoubleRocker1.device_automation_triggers


class RemoteH1DoubleRocker3(RemoteH1DoubleRocker1):
"""Aqara H1 Wireless Remote Double Rocker Version WRS-R02, variant 3."""

signature = {
MODELS_INFO: [(LUMI, "lumi.remote.b28ac1")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COLOR_DIMMER_SWITCH,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
],
OUTPUT_CLUSTERS: [
Identify.cluster_id,
OnOff.cluster_id,
LevelControl.cluster_id,
Color.cluster_id,
],
},
2: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH,
INPUT_CLUSTERS: [
Identify.cluster_id,
],
OUTPUT_CLUSTERS: [
Identify.cluster_id,
OnOff.cluster_id,
],
},
3: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH,
INPUT_CLUSTERS: [Identify.cluster_id],
OUTPUT_CLUSTERS: [OnOff.cluster_id],
},
4: {},
5: {},
6: {},
},
}


class RemoteH1DoubleRocker4(RemoteH1DoubleRocker1):
"""Aqara H1 Wireless Remote Double Rocker Version WRS-R02, variant 4."""

signature = {
MODELS_INFO: [(LUMI, "lumi.remote.b28ac1")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COLOR_DIMMER_SWITCH,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
],
OUTPUT_CLUSTERS: [
Identify.cluster_id,
OnOff.cluster_id,
LevelControl.cluster_id,
Color.cluster_id,
],
},
2: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH,
INPUT_CLUSTERS: [
Identify.cluster_id,
],
OUTPUT_CLUSTERS: [
Identify.cluster_id,
OnOff.cluster_id,
],
},
3: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH,
INPUT_CLUSTERS: [Identify.cluster_id],
OUTPUT_CLUSTERS: [OnOff.cluster_id],
},
4: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH,
INPUT_CLUSTERS: [
Identify.cluster_id,
MultistateInput.cluster_id,
],
OUTPUT_CLUSTERS: [OnOff.cluster_id],
},
5: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH,
INPUT_CLUSTERS: [
Identify.cluster_id,
MultistateInput.cluster_id,
],
OUTPUT_CLUSTERS: [OnOff.cluster_id],
},
6: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH,
INPUT_CLUSTERS: [
Identify.cluster_id,
MultistateInput.cluster_id,
],
OUTPUT_CLUSTERS: [OnOff.cluster_id],
},
},
}
Loading