print numbers as numbers in json, not strings.

This commit is contained in:
David Gwynne 2020-02-19 18:10:07 +11:00
parent 25034c153a
commit 6e0cd5bd68
1 changed files with 3 additions and 3 deletions

View File

@ -696,14 +696,14 @@ void TuyaSerialInput(void)
if (TUYA_CMD_STATE == Tuya.buffer[3]) {
ResponseAppend_P(PSTR(",\"DpType%uId%u\":"), dpDataType, dpId);
if (TUYA_TYPE_BOOL == dpDataType && dpDataLen == 1) {
ResponseAppend_P(PSTR("\"%u\""), dpData[0]);
ResponseAppend_P(PSTR("%u"), dpData[0]);
} else if (TUYA_TYPE_VALUE == dpDataType && dpDataLen == 4) {
uint32_t dpValue = (uint32_t)dpData[0] << 24 | (uint32_t)dpData[1] << 16 | (uint32_t)dpData[2] << 8 | (uint32_t)dpData[3] << 0;
ResponseAppend_P(PSTR("\"%u\""), dpValue);
ResponseAppend_P(PSTR("%u"), dpValue);
} else if (TUYA_TYPE_STRING == dpDataType) {
ResponseAppend_P(PSTR("\"%.*s\""), dpDataLen, dpData);
} else if (TUYA_TYPE_ENUM == dpDataType && dpDataLen == 1) {
ResponseAppend_P(PSTR("\"%u\""), dpData[0]);
ResponseAppend_P(PSTR("%u"), dpData[0]);
} else {
ResponseAppend_P(PSTR("\"0x%s\""), dpHexData);
}