Skip to content

Commit fbee5ba

Browse files
authored
Add quirks for Tuya multigang switches (#1166)
1 parent d2787c7 commit fbee5ba

File tree

2 files changed

+124
-6
lines changed

2 files changed

+124
-6
lines changed

tests/test_tuya.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ async def test_singleswitch_state_report(zigpy_device_from_quirk, quirk):
135135

136136
@pytest.mark.parametrize("quirk", (zhaquirks.tuya.ts0601_switch.TuyaDoubleSwitchTO,))
137137
async def test_doubleswitch_state_report(zigpy_device_from_quirk, quirk):
138-
"""Test tuya single switch."""
138+
"""Test tuya double switch."""
139139

140140
ZCL_TUYA_SWITCH_COMMAND_03 = b"\tQ\x03\x006\x01\x01\x00\x01\x01"
141141
ZCL_TUYA_SWITCH_EP2_ON = b"\tQ\x02\x006\x02\x01\x00\x01\x01"

zhaquirks/tuya/ts0601_switch.py

Lines changed: 123 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,10 @@ class TuyaSingleSwitchTO(TuyaSwitch):
7676
# output_clusters=[0x000a, 0x0019]
7777
# <SimpleDescriptor endpoint=1 profile=260 device_type=51 device_version=1 input_clusters=[0, 4, 5, 61184] output_clusters=[10, 25]>
7878
MODELS_INFO: [
79-
("_TZE200_oisqyl4o", "TS0601"),
80-
("_TZE200_wunufsil", "TS0601"),
81-
("_TZE200_vhy3iakz", "TS0601"),
82-
("_TZ3000_uim07oem", "TS0601"),
83-
("_TZE200_tz32mtza", "TS0601"),
8479
("_TZE200_amp6tsvy", "TS0601"),
80+
("_TZE200_oisqyl4o", "TS0601"),
81+
("_TZE200_vhy3iakz", "TS0601"), # ¿1 or 4 gangs?
82+
("_TZ3000_uim07oem", "TS0601"), # ¿1 or 4 gangs?
8583
],
8684
ENDPOINTS: {
8785
1: {
@@ -128,6 +126,55 @@ class TuyaDoubleSwitchTO(TuyaSwitch):
128126
# <SimpleDescriptor endpoint=1 profile=260 device_type=51 device_version=1 input_clusters=[0, 4, 5, 61184] output_clusters=[10, 25]>
129127
MODELS_INFO: [
130128
("_TZE200_g1ib5ldv", "TS0601"),
129+
("_TZE200_wunufsil", "TS0601"),
130+
],
131+
ENDPOINTS: {
132+
1: {
133+
PROFILE_ID: zha.PROFILE_ID,
134+
DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
135+
INPUT_CLUSTERS: [
136+
Basic.cluster_id,
137+
Groups.cluster_id,
138+
Scenes.cluster_id,
139+
TuyaManufCluster.cluster_id,
140+
],
141+
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
142+
}
143+
},
144+
}
145+
146+
replacement = {
147+
ENDPOINTS: {
148+
1: {
149+
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
150+
INPUT_CLUSTERS: [
151+
Basic.cluster_id,
152+
Groups.cluster_id,
153+
Scenes.cluster_id,
154+
TuyaManufacturerClusterOnOff,
155+
TuyaOnOff,
156+
],
157+
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
158+
},
159+
2: {
160+
PROFILE_ID: zha.PROFILE_ID,
161+
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
162+
INPUT_CLUSTERS: [
163+
TuyaOnOff,
164+
],
165+
OUTPUT_CLUSTERS: [],
166+
},
167+
}
168+
}
169+
170+
171+
class TuyaTripleSwitchTO(TuyaSwitch):
172+
"""Tuya triple channel switch time on out cluster device."""
173+
174+
signature = {
175+
MODELS_INFO: [
176+
# ("_TZE200_kyfqmmyl", "TS0601"), ## candidate reported in #716
177+
("_TZE200_tz32mtza", "TS0601"),
131178
],
132179
ENDPOINTS: {
133180
1: {
@@ -165,5 +212,76 @@ class TuyaDoubleSwitchTO(TuyaSwitch):
165212
],
166213
OUTPUT_CLUSTERS: [],
167214
},
215+
3: {
216+
PROFILE_ID: zha.PROFILE_ID,
217+
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
218+
INPUT_CLUSTERS: [
219+
TuyaOnOff,
220+
],
221+
OUTPUT_CLUSTERS: [],
222+
},
223+
}
224+
}
225+
226+
227+
class TuyaQuadrupleSwitchTO(TuyaSwitch):
228+
"""Tuya quadruple channel switch time on out cluster device."""
229+
230+
signature = {
231+
MODELS_INFO: [
232+
("_TZE200_aqnazj70", "TS0601"),
233+
],
234+
ENDPOINTS: {
235+
1: {
236+
PROFILE_ID: zha.PROFILE_ID,
237+
DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
238+
INPUT_CLUSTERS: [
239+
Basic.cluster_id,
240+
Groups.cluster_id,
241+
Scenes.cluster_id,
242+
TuyaManufCluster.cluster_id,
243+
],
244+
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
245+
}
246+
},
247+
}
248+
249+
replacement = {
250+
ENDPOINTS: {
251+
1: {
252+
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
253+
INPUT_CLUSTERS: [
254+
Basic.cluster_id,
255+
Groups.cluster_id,
256+
Scenes.cluster_id,
257+
TuyaManufacturerClusterOnOff,
258+
TuyaOnOff,
259+
],
260+
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
261+
},
262+
2: {
263+
PROFILE_ID: zha.PROFILE_ID,
264+
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
265+
INPUT_CLUSTERS: [
266+
TuyaOnOff,
267+
],
268+
OUTPUT_CLUSTERS: [],
269+
},
270+
3: {
271+
PROFILE_ID: zha.PROFILE_ID,
272+
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
273+
INPUT_CLUSTERS: [
274+
TuyaOnOff,
275+
],
276+
OUTPUT_CLUSTERS: [],
277+
},
278+
4: {
279+
PROFILE_ID: zha.PROFILE_ID,
280+
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
281+
INPUT_CLUSTERS: [
282+
TuyaOnOff,
283+
],
284+
OUTPUT_CLUSTERS: [],
285+
},
168286
}
169287
}

0 commit comments

Comments
 (0)