mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
Tweak the key/value for the type+id so it's only printed for STAT
This commit is contained in:
parent
d651e5c4a2
commit
f3c6627ec6
@ -688,18 +688,20 @@ void TuyaSerialInput(void)
|
|||||||
const unsigned char *dpData = (unsigned char*)&Tuya.buffer[dpidStart + 4];
|
const unsigned char *dpData = (unsigned char*)&Tuya.buffer[dpidStart + 4];
|
||||||
const char *dpHexData = ToHex_P(dpData, dpDataLen, hex_char, sizeof(hex_char));
|
const char *dpHexData = ToHex_P(dpData, dpDataLen, hex_char, sizeof(hex_char));
|
||||||
|
|
||||||
ResponseAppend_P(PSTR(",\"Cmnd%dDpId%dDpType%d\":"), Tuya.buffer[3], dpId, dpDataType);
|
if (TUYA_CMD_STATE == Tuya.buffer[3]) {
|
||||||
if (TUYA_TYPE_BOOL == dpDataType && dpDataLen == 1) {
|
ResponseAppend_P(PSTR(",\"DpType%uId%u\":"), dpDataType, dpId);
|
||||||
ResponseAppend_P(PSTR("\"%d\""), dpData[0]);
|
if (TUYA_TYPE_BOOL == dpDataType && dpDataLen == 1) {
|
||||||
} else if (TUYA_TYPE_VALUE == dpDataType && dpDataLen == 4) {
|
ResponseAppend_P(PSTR("\"%u\""), dpData[0]);
|
||||||
uint32_t dpValue = (uint32_t)dpData[0] << 24 | (uint32_t)dpData[1] << 16 | (uint32_t)dpData[2] << 8 | (uint32_t)dpData[3] << 0;
|
} else if (TUYA_TYPE_VALUE == dpDataType && dpDataLen == 4) {
|
||||||
ResponseAppend_P(PSTR("\"%u\""), dpValue);
|
uint32_t dpValue = (uint32_t)dpData[0] << 24 | (uint32_t)dpData[1] << 16 | (uint32_t)dpData[2] << 8 | (uint32_t)dpData[3] << 0;
|
||||||
} else if (TUYA_TYPE_STRING == dpDataType) {
|
ResponseAppend_P(PSTR("\"%u\""), dpValue);
|
||||||
ResponseAppend_P(PSTR("\"%.*s\""), dpDataLen, dpData);
|
} else if (TUYA_TYPE_STRING == dpDataType) {
|
||||||
} else if (TUYA_TYPE_ENUM == dpDataType && dpDataLen == 1) {
|
ResponseAppend_P(PSTR("\"%.*s\""), dpDataLen, dpData);
|
||||||
ResponseAppend_P(PSTR("\"%d\""), dpData[0]);
|
} else if (TUYA_TYPE_ENUM == dpDataType && dpDataLen == 1) {
|
||||||
} else {
|
ResponseAppend_P(PSTR("\"%u\""), dpData[0]);
|
||||||
ResponseAppend_P(PSTR("\"0x%s\""), dpHexData);
|
} else {
|
||||||
|
ResponseAppend_P(PSTR("\"0x%s\""), dpHexData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ResponseAppend_P(PSTR(",\"%d\":{\"DpId\":%d,\"DpIdType\":%d,\"DpIdData\":\"%s\""), dpId, dpId, dpDataType, dpHexData);
|
ResponseAppend_P(PSTR(",\"%d\":{\"DpId\":%d,\"DpIdType\":%d,\"DpIdData\":\"%s\""), dpId, dpId, dpDataType, dpHexData);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user