Skip to content

Commit 4c30303

Browse files
committed
test no mcu version
1 parent e8085c4 commit 4c30303

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_tuya_thermostat.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66

77
from tests.common import ClusterListener
88
import zhaquirks
9+
from zhaquirks.tuya import TUYA_MCU_VERSION_RSP
910
from zhaquirks.tuya.mcu import TuyaMCUCluster
1011

1112
zhaquirks.setup()
1213

14+
ZCL_TUYA_VERSION_RSP = b"\x09\x06\x11\x01\x6d\x82"
15+
ZCL_TUYA_SET_TIME = b"\x09\x12\x24\x0d\x00"
16+
1317

1418
@pytest.mark.parametrize(
1519
"manuf,msg,attr,value",
@@ -99,3 +103,21 @@ async def test_handle_get_data(zigpy_device_from_v2_quirk, manuf, msg, attr, val
99103
assert thermostat_listener.attribute_updates[0][1] == value
100104

101105
assert ep.thermostat.get(attr.id) == value
106+
107+
108+
async def test_tuya_no_mcu_version(zigpy_device_from_v2_quirk):
109+
"""Test lack of TUYA_MCU_VERSION_RSP messages."""
110+
111+
tuya_device = zigpy_device_from_v2_quirk("_TZE284_xnbkhhdr", "TS0601")
112+
113+
tuya_cluster = tuya_device.endpoints[1].tuya_manufacturer
114+
cluster_listener = ClusterListener(tuya_cluster)
115+
116+
assert len(cluster_listener.attribute_updates) == 0
117+
118+
# simulate a TUYA_MCU_VERSION_RSP message
119+
hdr, args = tuya_cluster.deserialize(ZCL_TUYA_VERSION_RSP)
120+
assert hdr.command_id == TUYA_MCU_VERSION_RSP
121+
122+
tuya_cluster.handle_message(hdr, args)
123+
assert len(cluster_listener.attribute_updates) == 0

0 commit comments

Comments
 (0)