Skip to content

Commit

Permalink
removed hold actions, added right button action events
Browse files Browse the repository at this point in the history
  • Loading branch information
notabene00 committed Dec 18, 2021
1 parent 5228c54 commit ba79e97
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions zhaquirks/xiaomi/aqara/ctrl_neutral.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@
COMMAND,
COMMAND_ATTRIBUTE_UPDATED,
COMMAND_DOUBLE,
COMMAND_HOLD,
COMMAND_RELEASE,
COMMAND_CLICK,
DEVICE_TYPE,
ENDPOINT_ID,
ENDPOINTS,
INPUT_CLUSTERS,
LEFT,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
RIGHT,
SKIP_CONFIGURATION,
VALUE,
)

from zhaquirks.xiaomi import (
LUMI,
BasicCluster,
Expand All @@ -48,10 +50,7 @@
)

ATTRIBUTE_ON_OFF = "on_off"
DOUBLE = "double"
HOLD = "long press"
PRESS_TYPES = {0: "long press", 1: "single", 2: "double"}
SINGLE = "single"
STATUS_TYPE_ATTR = 0x0055 # decimal = 85
XIAOMI_CLUSTER_ID = 0xFFFF
XIAOMI_DEVICE_TYPE = 0x5F01
Expand All @@ -73,7 +72,8 @@ class BasicClusterDecoupled(BasicCluster):

# Known Options for 'decoupled_mode_<button>':
# * 254 (decoupled)
# * 18 (relay controlled)
# * 18 (controls left relay)
# * 34 (controls right relay)
manufacturer_attributes = {
0xFF22: ("decoupled_mode_left", t.uint8_t),
0xFF23: ("decoupled_mode_right", t.uint8_t),
Expand Down Expand Up @@ -223,24 +223,38 @@ class WallSwitchOnOffCluster(EventableCluster, OnOff):
],
OUTPUT_CLUSTERS: [],
},
5: {
DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
INPUT_CLUSTERS: [
MultistateInput.cluster_id,
WallSwitchOnOffCluster,
],
OUTPUT_CLUSTERS: [],
},
},
}

device_automation_triggers = {
(COMMAND_HOLD, BUTTON): {
(LEFT, COMMAND_CLICK): {
ENDPOINT_ID: 4,
CLUSTER_ID: 6,
COMMAND: COMMAND_ATTRIBUTE_UPDATED,
ARGS: {ATTRIBUTE_ID: 0, ATTRIBUTE_NAME: ATTRIBUTE_ON_OFF, VALUE: 0},
ARGS: {ATTRIBUTE_ID: 0, ATTRIBUTE_NAME: ATTRIBUTE_ON_OFF, VALUE: 1},
},
(COMMAND_RELEASE, BUTTON): {
(LEFT, COMMAND_DOUBLE): {
ENDPOINT_ID: 4,
CLUSTER_ID: 6,
COMMAND: COMMAND_ATTRIBUTE_UPDATED,
ARGS: {ATTRIBUTE_ID: 0, ATTRIBUTE_NAME: ATTRIBUTE_ON_OFF, VALUE: 2},
},
(RIGHT, COMMAND_CLICK): {
ENDPOINT_ID: 5,
CLUSTER_ID: 6,
COMMAND: COMMAND_ATTRIBUTE_UPDATED,
ARGS: {ATTRIBUTE_ID: 0, ATTRIBUTE_NAME: ATTRIBUTE_ON_OFF, VALUE: 1},
},
(COMMAND_DOUBLE, BUTTON): {
ENDPOINT_ID: 4,
(RIGHT, COMMAND_DOUBLE): {
ENDPOINT_ID: 5,
CLUSTER_ID: 6,
COMMAND: COMMAND_ATTRIBUTE_UPDATED,
ARGS: {ATTRIBUTE_ID: 0, ATTRIBUTE_NAME: ATTRIBUTE_ON_OFF, VALUE: 2},
Expand Down

0 comments on commit ba79e97

Please sign in to comment.