-
Notifications
You must be signed in to change notification settings - Fork 720
/
lzl4bwhl01remote.py
135 lines (123 loc) · 3.85 KB
/
lzl4bwhl01remote.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
"""Device handler for Lutron LZL4BWHL01 Remote."""
from zigpy.profiles import zll
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import (
Basic,
Groups,
Identify,
LevelControl,
OnOff,
Scenes,
)
from zigpy.zcl.clusters.lightlink import LightLink
from zhaquirks import GroupBoundCluster
from zhaquirks.const import (
CLUSTER_ID,
COMMAND,
COMMAND_MOVE_TO_LEVEL_ON_OFF,
COMMAND_STEP,
COMMAND_STEP_ON_OFF,
DEVICE_TYPE,
DIM_DOWN,
DIM_UP,
ENDPOINT_ID,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PARAMS,
PROFILE_ID,
SHORT_PRESS,
TURN_OFF,
TURN_ON,
)
MANUFACTURER_SPECIFIC_CLUSTER_ID_1 = 0xFF00 # decimal = 65280
MANUFACTURER_SPECIFIC_CLUSTER_ID_2 = 0xFC44 # decimal = 64580
class OnOffGroupCluster(GroupBoundCluster, OnOff):
"""On/Off Cluster which only binds to a group."""
class LevelControlGroupCluster(GroupBoundCluster, LevelControl):
"""Level Control Cluster which only binds to a group."""
class LutronLZL4BWHL01Remote(CustomDevice):
"""Custom device representing Lutron LZL4BWHL01 Remote."""
signature = {
# <SimpleDescriptor endpoint=1 profile=49246 device_type=2080
# device_version=2
# input_clusters=[0, 4096, 65280, 64580]
# output_clusters=[4096, 3, 6, 8, 4, 5, 0, 65280]>
MODELS_INFO: [
("Lutron", "LZL4BWHL01 Remote"),
(" Lutron", "LZL4BWHL01 Remote"),
],
ENDPOINTS: {
1: {
PROFILE_ID: zll.PROFILE_ID,
DEVICE_TYPE: zll.DeviceType.CONTROLLER,
INPUT_CLUSTERS: [
Basic.cluster_id,
LightLink.cluster_id,
MANUFACTURER_SPECIFIC_CLUSTER_ID_1,
MANUFACTURER_SPECIFIC_CLUSTER_ID_2,
],
OUTPUT_CLUSTERS: [
LightLink.cluster_id,
Identify.cluster_id,
OnOff.cluster_id,
LevelControl.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
Basic.cluster_id,
MANUFACTURER_SPECIFIC_CLUSTER_ID_1,
],
}
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zll.PROFILE_ID,
DEVICE_TYPE: zll.DeviceType.CONTROLLER,
INPUT_CLUSTERS: [
Basic.cluster_id,
LightLink.cluster_id,
MANUFACTURER_SPECIFIC_CLUSTER_ID_1,
MANUFACTURER_SPECIFIC_CLUSTER_ID_2,
],
OUTPUT_CLUSTERS: [
LightLink.cluster_id,
Identify.cluster_id,
OnOffGroupCluster,
LevelControlGroupCluster,
Groups.cluster_id,
Scenes.cluster_id,
Basic.cluster_id,
MANUFACTURER_SPECIFIC_CLUSTER_ID_1,
],
}
}
}
device_automation_triggers = {
(SHORT_PRESS, TURN_ON): {
COMMAND: COMMAND_MOVE_TO_LEVEL_ON_OFF,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
PARAMS: {"level": 254, "transition_time": 4},
},
(SHORT_PRESS, TURN_OFF): {
COMMAND: COMMAND_MOVE_TO_LEVEL_ON_OFF,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
PARAMS: {"level": 0, "transition_time": 4},
},
(SHORT_PRESS, DIM_UP): {
COMMAND: COMMAND_STEP_ON_OFF,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
PARAMS: {"step_mode": 0},
},
(SHORT_PRESS, DIM_DOWN): {
COMMAND: COMMAND_STEP,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
PARAMS: {"step_mode": 1},
},
}