Prep mqtt_data from char to String (prt.2)

This commit is contained in:
Theo Arends 2021-06-06 16:32:08 +02:00
parent aa64428c2f
commit 2cd88645d1
3 changed files with 6 additions and 6 deletions

View File

@ -1626,7 +1626,7 @@ void DisplayJsonValue(const char* topic, const char* device, const char* mkey, c
DisplayLogBufferAdd(buffer);
}
void DisplayAnalyzeJson(char *topic, char *json)
void DisplayAnalyzeJson(char *topic, const char *json)
{
// //tele/pow2/STATE {"Time":"2017-09-20T11:53:03", "Uptime":10, "Vcc":3.123, "POWER":"ON", "Wifi":{"AP":2, "SSId":"indebuurt2", "RSSI":68, "APMac":"00:22:6B:FE:8E:20"}}
// //tele/pow2/ENERGY {"Time":"2017-09-20T11:53:03", "Total":6.522, "Yesterday":0.150, "Today":0.073, "Period":0.5, "Power":12.1, "Factor":0.56, "Voltage":210.1, "Current":0.102}

View File

@ -526,9 +526,9 @@ void Z_Device::jsonPublishAttrList(const char * json_prefix, const Z_attribute_l
// What key do we use, shortaddr or name?
if (!Settings.flag5.zb_omit_json_addr) {
if (use_fname) {
Response_P(PSTR("%s{\"%s\":"), TasmotaGlobal.mqtt_data, friendlyName);
ResponseAppend_P(PSTR("{\"%s\":"), friendlyName);
} else {
Response_P(PSTR("%s{\"0x%04X\":"), TasmotaGlobal.mqtt_data, shortaddr);
ResponseAppend_P(PSTR("{\"0x%04X\":"), shortaddr);
}
}
ResponseAppend_P(PSTR("{"));
@ -561,13 +561,13 @@ void Z_Device::jsonPublishAttrList(const char * json_prefix, const Z_attribute_l
snprintf_P(subtopic, sizeof(subtopic), PSTR("%s"), stemp);
} else {
snprintf_P(subtopic, sizeof(subtopic), PSTR("%s/%s"), TasmotaGlobal.mqtt_topic, stemp);
}
}
} else {
if (Settings.flag5.zigbee_hide_bridge_topic) {
snprintf_P(subtopic, sizeof(subtopic), PSTR("%04X"), shortaddr);
} else {
snprintf_P(subtopic, sizeof(subtopic), PSTR("%s/%04X"), TasmotaGlobal.mqtt_topic, shortaddr);
}
}
}
if (Settings.flag5.zb_topic_endpoint) {
if (attr_list.isValidSrcEp()) {

View File

@ -793,7 +793,7 @@ bool Xdrv35(uint8_t function)
// If hold time has arrived and no rule is enabled that handles the button hold, handle it.
else if (button_hold_time[button_index] <= now) {
#ifdef USE_RULES
sprintf(TasmotaGlobal.mqtt_data, PSTR("{\"Button%u\":{\"State\":3}}"), button_index + 1);
Response_P(PSTR("{\"Button%u\":{\"State\":3}}"), button_index + 1);
Rules.no_execute = true;
if (!XdrvRulesProcess(0)) {
#endif // USE_RULES