From 25034c153ae8e777a498f1f1a43b33c02366bd6b Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Sun, 9 Feb 2020 18:44:05 +1100 Subject: [PATCH] use TuyaSend0 to send a TUYA_CMD_QUERY_STATE command. --- tasmota/xdrv_16_tuyamcu.ino | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tasmota/xdrv_16_tuyamcu.ino b/tasmota/xdrv_16_tuyamcu.ino index 4a49c8ee0..11b134489 100644 --- a/tasmota/xdrv_16_tuyamcu.ino +++ b/tasmota/xdrv_16_tuyamcu.ino @@ -114,6 +114,7 @@ void (* const TuyaCommand[])(void) PROGMEM = { TuyaSend dpId,data +TuyaSend0 -> Sends TUYA_CMD_QUERY_STATE TuyaSend1 11,1 -> Sends boolean (Type 1) data 0/1 to dpId 11 (Max data length 1 byte) TuyaSend2 11,100 -> Sends integer (Type 2) data 100 to dpId 11 (Max data length 4 bytes) TuyaSend2 11,0xAABBCCDD -> Sends 4 bytes (Type 2) data to dpId 11 (Max data length 4 bytes) @@ -124,9 +125,13 @@ TuyaSend4 11,1 -> Sends enum (Type 4) data 0/1/2/3/4/5 to dpId 11 (Max data leng void CmndTuyaSend(void) { - if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 4)) { + if (XdrvMailbox.index > 4) { + return; + } + if (XdrvMailbox.index == 0) { + TuyaRequestState(); + } else { if (XdrvMailbox.data_len > 0) { - char *p; char *data; uint8_t i = 0; @@ -150,8 +155,8 @@ void CmndTuyaSend(void) { TuyaSendEnum(dpId, strtoul(data, nullptr, 0)); } } - ResponseCmndDone(); } + ResponseCmndDone(); } /*