Skip to content

Commit e5a25d5

Browse files
committed
Address review
1 parent c427bd9 commit e5a25d5

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

tests/test_tuya_thermostat.py

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,74 @@
1212

1313

1414
@pytest.mark.parametrize(
15-
"msg,attr,value",
15+
"manuf,msg,attr,value",
1616
[
1717
(
18+
"_TZE204_p3lqqy2r",
1819
b"\t\x13\x02\x00\x06\x01\x01\x00\x01\x01",
1920
Thermostat.AttributeDefs.system_mode,
2021
Thermostat.SystemMode.Heat,
2122
), # Set to heat, dp 1
2223
(
24+
"_TZE204_p3lqqy2r",
2325
b"\t\x16\x02\x00\t\x18\x02\x00\x04\x00\x00\x00\x18",
2426
Thermostat.AttributeDefs.local_temperature,
2527
2400,
2628
), # Current temp 24, dp 24
2729
(
30+
"_TZE204_p3lqqy2r",
2831
b"\t\x15\x02\x00\x08\x10\x02\x00\x04\x00\x00\x00\x19",
2932
Thermostat.AttributeDefs.occupied_heating_setpoint,
3033
2500,
3134
), # Setpoint to 25, dp 16
3235
(
36+
"_TZE204_p3lqqy2r",
3337
b"\t\x17\x02\x00\n\x1c\x02\x00\x04\x00\x00\x00\x00",
3438
Thermostat.AttributeDefs.local_temperature_calibration,
3539
0,
3640
), # Local calibration to 0, dp 28
3741
(
42+
"_TZE204_p3lqqy2r",
3843
b"\t\x1c\x02\x00\x0fh\x01\x00\x01\x01",
3944
Thermostat.AttributeDefs.running_state,
4045
Thermostat.RunningState.Heat_State_On,
4146
), # Running state, dp 104
4247
(
48+
"_TZE204_p3lqqy2r",
4349
b"\t\x1d\x02\x00\x10k\x02\x00\x04\x00\x00\x00\x1b",
4450
Thermostat.AttributeDefs.max_heat_setpoint_limit,
4551
2700,
4652
), # Max heat set point, dp 107
53+
(
54+
"_TZE204_lzriup1j",
55+
b"\t\x13\x02\x00\x06\x01\x01\x00\x01\x01",
56+
Thermostat.AttributeDefs.system_mode,
57+
Thermostat.SystemMode.Heat,
58+
), # Set to heat, dp 1
59+
(
60+
"_TZE200_viy9ihs7",
61+
b"\t\x13\x02\x00\x06\x01\x01\x00\x01\x01",
62+
Thermostat.AttributeDefs.system_mode,
63+
Thermostat.SystemMode.Heat,
64+
), # Set to heat, dp 1
65+
(
66+
"_TZE204_xnbkhhdr",
67+
b"\t\x13\x02\x00\x06\x01\x01\x00\x01\x01",
68+
Thermostat.AttributeDefs.system_mode,
69+
Thermostat.SystemMode.Heat,
70+
), # Set to heat, dp 1
71+
(
72+
"_TZE284_xnbkhhdr",
73+
b"\t\x13\x02\x00\x06\x01\x01\x00\x01\x01",
74+
Thermostat.AttributeDefs.system_mode,
75+
Thermostat.SystemMode.Heat,
76+
), # Set to heat, dp 1
4777
],
4878
)
49-
async def test_handle_get_data(zigpy_device_from_v2_quirk, msg, attr, value):
79+
async def test_handle_get_data(zigpy_device_from_v2_quirk, manuf, msg, attr, value):
5080
"""Test handle_get_data for multiple attributes."""
5181

52-
quirked = zigpy_device_from_v2_quirk("_TZE204_p3lqqy2r", "TS0601")
82+
quirked = zigpy_device_from_v2_quirk(manuf, "TS0601")
5383
ep = quirked.endpoints[1]
5484

5585
assert ep.tuya_manufacturer is not None

zhaquirks/tuya/tuya_thermostat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def __init__(self, *args, **kwargs):
120120
class NoManufTimeNoVersionRespTuyaMCUCluster(TuyaMCUCluster):
121121
"""Tuya Manufacturer Cluster with set_time mod."""
122122

123+
# Deepcopy required to override 'set_time', without, it will revert
123124
server_commands = copy.deepcopy(TuyaMCUCluster.server_commands)
124125
server_commands.update(
125126
{
@@ -136,7 +137,6 @@ def handle_mcu_version_response(
136137
self, payload: TuyaMCUCluster.MCUVersion
137138
) -> foundation.Status:
138139
"""Handle MCU version response."""
139-
140140
return foundation.Status.SUCCESS
141141

142142

0 commit comments

Comments
 (0)