Skip to content

Commit

Permalink
Fix TuyaDPType.VALUE payload (#1984)
Browse files Browse the repository at this point in the history
  • Loading branch information
javicalle authored Dec 4, 2022
1 parent 77c596a commit ad9ad33
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/test_tuya_dimmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def test_command(zigpy_device_from_quirk, quirk):
m1.assert_called_with(
61184,
4,
b"\x01\x04\x00\x00\x03\x02\x02\x00\x04\x00\x00\x03r",
b"\x01\x04\x00\x00\x03\x02\x02\x00\x04r\x03\x00\x00",
expect_reply=True,
command_id=0,
)
Expand Down Expand Up @@ -78,7 +78,7 @@ async def test_write_attr(zigpy_device_from_quirk, quirk):
m1.assert_called_with(
61184,
2,
b"\x01\x02\x00\x00\x01\x03\x02\x00\x04\x00\x00\x00b",
b"\x01\x02\x00\x00\x01\x03\x02\x00\x04b\x00\x00\x00",
expect_reply=False,
command_id=0,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tuya_mcu.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ async def test_tuya_methods(zigpy_device_from_quirk, quirk):
assert len(result_1.datapoints) == 1
assert result_1.datapoints[0].dp == 9
assert result_1.datapoints[0].data.dp_type == TuyaDPType.VALUE
assert result_1.datapoints[0].data.raw == b"\x00\x00\x00b"
assert result_1.datapoints[0].data.raw == b"b\x00\x00\x00"

tcd_2 = TuyaClusterData(
endpoint_id=7, cluster_attr="not_exists_attribute", attr_value=25
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tuya_valve.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def test_write_attr_psbzs(zigpy_device_from_quirk, quirk):
m1.assert_called_with(
61184,
2,
b"\x01\x02\x00\x00\x01\x05\x02\x00\x04\x00\x00\x00\x0f",
b"\x01\x02\x00\x00\x01\x05\x02\x00\x04\x0f\x00\x00\x00",
expect_reply=False,
command_id=0,
)
Expand Down
2 changes: 1 addition & 1 deletion zhaquirks/tuya/mcu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def from_cluster_data(self, data: TuyaClusterData) -> Optional[TuyaCommand]:
tuya_data = TuyaData()
tuya_data.dp_type = datapoint_type
tuya_data.function = 0
tuya_data.raw = t.LVBytes.deserialize(val)[0]
tuya_data.raw = bytes(reversed(val[1:]))
self.debug("raw: %s", tuya_data.raw)
dpd = TuyaDatapointData(dp, tuya_data)
cmd_payload.datapoints = [dpd]
Expand Down

0 comments on commit ad9ad33

Please sign in to comment.