|
1 | 1 | """Tests for Tuya quirks."""
|
2 | 2 |
|
3 |
| -import asyncio |
4 | 3 | import base64
|
5 | 4 | import datetime
|
6 | 5 | import struct
|
|
26 | 25 | ON,
|
27 | 26 | OUTPUT_CLUSTERS,
|
28 | 27 | PROFILE_ID,
|
29 |
| - ZONE_STATUS_CHANGE_COMMAND, |
30 | 28 | )
|
31 | 29 | from zhaquirks.tuya import Data, TuyaManufClusterAttributes, TuyaNewManufCluster
|
32 | 30 | import zhaquirks.tuya.sm0202_motion
|
|
54 | 52 | ZCL_TUYA_BUTTON_2_SINGLE_PRESS = b"\tN\x06\x01\x1f\x02\x04\x00\x01\x00"
|
55 | 53 | ZCL_TUYA_BUTTON_2_DOUBLE_PRESS = b"\tj\x06\x03\x10\x02\x04\x00\x01\x01"
|
56 | 54 | ZCL_TUYA_BUTTON_2_LONG_PRESS = b"\tl\x06\x03\x12\x02\x04\x00\x01\x02"
|
57 |
| -ZCL_TUYA_MOTION = b"\tL\x01\x00\x05\x03\x04\x00\x01\x02" |
58 | 55 | ZCL_TUYA_SWITCH_ON = b"\tQ\x02\x006\x01\x01\x00\x01\x01"
|
59 | 56 | ZCL_TUYA_SWITCH_OFF = b"\tQ\x02\x006\x01\x01\x00\x01\x00"
|
60 | 57 | ZCL_TUYA_ATTRIBUTE_617_TO_179 = b"\tp\x02\x00\x02i\x02\x00\x04\x00\x00\x00\xb3"
|
|
100 | 97 | ZCL_TUYA_EHEAT_TARGET_TEMP = b"\t3\x01\x03\x05\x10\x02\x00\x04\x00\x00\x00\x15"
|
101 | 98 |
|
102 | 99 |
|
103 |
| -@pytest.mark.parametrize("quirk", (zhaquirks.tuya.ts0601_motion.TuyaMotion,)) |
104 |
| -async def test_motion(zigpy_device_from_quirk, quirk): |
105 |
| - """Test tuya motion sensor.""" |
106 |
| - |
107 |
| - motion_dev = zigpy_device_from_quirk(quirk) |
108 |
| - |
109 |
| - motion_cluster = motion_dev.endpoints[1].ias_zone |
110 |
| - motion_listener = ClusterListener(motion_cluster) |
111 |
| - |
112 |
| - tuya_cluster = motion_dev.endpoints[1].tuya_manufacturer |
113 |
| - |
114 |
| - # send motion on Tuya manufacturer specific cluster |
115 |
| - hdr, args = tuya_cluster.deserialize(ZCL_TUYA_MOTION) |
116 |
| - with mock.patch.object(motion_cluster, "reset_s", 0): |
117 |
| - tuya_cluster.handle_message(hdr, args) |
118 |
| - |
119 |
| - assert len(motion_listener.cluster_commands) == 1 |
120 |
| - assert motion_listener.cluster_commands[0][1] == ZONE_STATUS_CHANGE_COMMAND |
121 |
| - assert motion_listener.cluster_commands[0][2][0] == ON |
122 |
| - |
123 |
| - await asyncio.gather(asyncio.sleep(0), asyncio.sleep(0), asyncio.sleep(0)) |
124 |
| - |
125 |
| - assert len(motion_listener.cluster_commands) == 2 |
126 |
| - assert motion_listener.cluster_commands[1][1] == ZONE_STATUS_CHANGE_COMMAND |
127 |
| - assert motion_listener.cluster_commands[1][2][0] == OFF |
128 |
| - |
129 |
| - |
130 | 100 | @pytest.mark.parametrize("quirk", (zhaquirks.tuya.ts0601_switch.TuyaSingleSwitchTI,))
|
131 | 101 | async def test_singleswitch_state_report(zigpy_device_from_quirk, quirk):
|
132 | 102 | """Test tuya single switch."""
|
@@ -1628,25 +1598,6 @@ def test_ts0601_valve_signature(assert_signature_matches_quirk):
|
1628 | 1598 | assert_signature_matches_quirk(zhaquirks.tuya.ts0601_valve.TuyaValve, signature)
|
1629 | 1599 |
|
1630 | 1600 |
|
1631 |
| -def test_ts0601_motion_signature(assert_signature_matches_quirk): |
1632 |
| - """Test TS0601 motion by TreatLife remote signature is matched to its quirk.""" |
1633 |
| - signature = { |
1634 |
| - "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)", |
1635 |
| - "endpoints": { |
1636 |
| - "1": { |
1637 |
| - "profile_id": 260, |
1638 |
| - "device_type": "0x0051", |
1639 |
| - "in_clusters": ["0x0000", "0x0004", "0x0005", "0xef00"], |
1640 |
| - "out_clusters": ["0x000a", "0x0019"], |
1641 |
| - } |
1642 |
| - }, |
1643 |
| - "manufacturer": "_TZE200_ppuj1vem", |
1644 |
| - "model": "TS0601", |
1645 |
| - "class": "zigpy.device.Device", |
1646 |
| - } |
1647 |
| - assert_signature_matches_quirk(zhaquirks.tuya.ts0601_motion.NeoMotion, signature) |
1648 |
| - |
1649 |
| - |
1650 | 1601 | def test_multiple_attributes_report():
|
1651 | 1602 | """Test a multi attribute report from Tuya device."""
|
1652 | 1603 |
|
|
0 commit comments