Skip to content

Add Aqara T1 wireless mini switch lumi.remote.b1acn02 #2871

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

Merged
merged 15 commits into from
Aug 11, 2024
Merged
Changes from 13 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
63 changes: 62 additions & 1 deletion zhaquirks/xiaomi/aqara/sensor_switch_aq3.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Xiaomi aqara button sensor."""

from zigpy.profiles import zha
from zigpy.zcl.clusters.general import Basic, Identify, MultistateInput, OnOff
from zigpy.zcl.clusters.general import Basic, Identify, MultistateInput, OnOff, Ota

from zhaquirks import CustomCluster
from zhaquirks.const import (
Expand Down Expand Up @@ -30,6 +30,7 @@
LUMI,
BasicCluster,
DeviceTemperatureCluster,
XiaomiAqaraE1Cluster,
XiaomiCustomDevice,
XiaomiPowerConfiguration,
)
Expand All @@ -56,6 +57,12 @@
}


class OppleCluster(XiaomiAqaraE1Cluster):
"""Opple cluster."""




class MultistateInputCluster(CustomCluster, MultistateInput):
"""Multistate input cluster."""

Expand Down Expand Up @@ -167,3 +174,57 @@ class SwitchAQ3B(XiaomiCustomDevice):
(LONG_PRESS, LONG_PRESS): {COMMAND: COMMAND_HOLD},
(LONG_RELEASE, LONG_RELEASE): {COMMAND: COMMAND_RELEASE},
}


class SwitchAQ3B2(XiaomiCustomDevice):
"""Aqara button device - alternate version."""

signature = {
# <SimpleDescriptor endpoint=1 profile=260 device_type=259
# device_version=1
# input_clusters=[0, 1, 3]
# output_clusters=[3, 6, 19]>
MODELS_INFO: [(LUMI, "lumi.remote.b1acn02")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: BUTTON_DEVICE_TYPE_B,
INPUT_CLUSTERS: [
Basic.cluster_id,
XiaomiPowerConfiguration.cluster_id,
Identify.cluster_id,
],
OUTPUT_CLUSTERS: [
Identify.cluster_id,
OnOff.cluster_id,
Ota.cluster_id,
],
}
},
}
replacement = {
ENDPOINTS: {
1: {
DEVICE_TYPE: zha.DeviceType.REMOTE_CONTROL,
INPUT_CLUSTERS: [
BasicCluster,
XiaomiPowerConfiguration,
Identify.cluster_id,
MultistateInputCluster,
],
OUTPUT_CLUSTERS: [
Identify.cluster_id,
OnOff.cluster_id,
Ota.cluster_id,
OppleCluster,
],
}
},
}

device_automation_triggers = {
(DOUBLE_PRESS, DOUBLE_PRESS): {COMMAND: COMMAND_DOUBLE},
(SHORT_PRESS, SHORT_PRESS): {COMMAND: COMMAND_SINGLE},
(LONG_PRESS, LONG_PRESS): {COMMAND: COMMAND_HOLD},
(LONG_RELEASE, LONG_RELEASE): {COMMAND: COMMAND_RELEASE},
}
Loading