From 9c1a15465db2708b546d79c412b6210f8fa11dd5 Mon Sep 17 00:00:00 2001 From: Pavel Sokolov Date: Thu, 9 Dec 2021 21:54:06 +0300 Subject: [PATCH] Tuya zcl refactor (#10112) * Rename Tuya command setData->dataRequest https://github.com/Koenkk/zigbee-herdsman/issues/466 * Fix Tuya datapoint commands invalid format (status,transid -> seq). Tuya has `uint16` type for the sequence(transaction) number. https://github.com/Koenkk/zigbee-herdsman/issues/466 * Tuya zcl refactoring: fix zigbe2mqtt tests https://github.com/Koenkk/zigbee-herdsman/issues/466 --- test/publish.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/publish.test.js b/test/publish.test.js index ef94c06a0..d529d4ec2 100644 --- a/test/publish.test.js +++ b/test/publish.test.js @@ -367,7 +367,7 @@ describe('Publish', () => { await MQTT.events.message('zigbee2mqtt/thermostat_group/set', stringify({child_lock: 'LOCK'})); await flushPromises(); expect(group.command).toHaveBeenCalledTimes(1); - expect(group.command).toHaveBeenCalledWith("manuSpecificTuya", "setData", {data: [1], datatype: 1, dp: 7, length_hi: 0, length_lo: 1, status: 0, transid: expect.any(Number)}, {disableDefaultResponse: true}); + expect(group.command).toHaveBeenCalledWith("manuSpecificTuya", "dataRequest", {data: [1], datatype: 1, dp: 7, length_hi: 0, length_lo: 1, seq: expect.any(Number)}, {disableDefaultResponse: true}); }); it('Should publish messages to groups with on and brightness', async () => { @@ -1294,7 +1294,7 @@ describe('Publish', () => { await MQTT.events.message('zigbee2mqtt/MKS-CM-W5/l3/set', stringify({state: 'ON'})); await flushPromises(); expect(endpoint.command).toHaveBeenCalledTimes(1); - expect(endpoint.command).toHaveBeenCalledWith("manuSpecificTuya", "setData", {data: [1], datatype: 1, dp: 3, length_hi: 0, length_lo: 1, status: 0, transid: expect.any(Number)}, {disableDefaultResponse: true}); + expect(endpoint.command).toHaveBeenCalledWith("manuSpecificTuya", "dataRequest", {data: [1], datatype: 1, dp: 3, length_hi: 0, length_lo: 1, seq: expect.any(Number)}, {disableDefaultResponse: true}); expect(MQTT.publish).toHaveBeenCalledTimes(1); expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/MKS-CM-W5'); expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({state_l3: 'ON'});