mirror of https://github.com/arendst/Tasmota.git
Refactor access TasnotaGlobal.mqtt_data
This commit is contained in:
parent
4ed6335428
commit
e5e8ef4736
|
@ -1191,6 +1191,14 @@ char* ResponseGetTime(uint32_t format, char* time_str)
|
|||
return time_str;
|
||||
}
|
||||
|
||||
char* ResponseData(void) {
|
||||
#ifdef MQTT_DATA_STRING
|
||||
return (char*)TasmotaGlobal.mqtt_data.c_str();
|
||||
#else
|
||||
return TasmotaGlobal.mqtt_data;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t ResponseSize(void) {
|
||||
#ifdef MQTT_DATA_STRING
|
||||
return MAX_LOGSZ; // Arbitratry max length satisfying full log entry
|
||||
|
@ -1333,29 +1341,15 @@ int ResponseJsonEndEnd(void)
|
|||
}
|
||||
|
||||
bool ResponseContains_P(const char* needle) {
|
||||
/*
|
||||
#ifdef MQTT_DATA_STRING
|
||||
return (strstr_P(TasmotaGlobal.mqtt_data.c_str(), needle) != nullptr);
|
||||
#else
|
||||
return (strstr_P(TasmotaGlobal.mqtt_data, needle) != nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
uint32_t ResponseContains_P(const char* needle) {
|
||||
const char *tmp;
|
||||
#ifdef MQTT_DATA_STRING
|
||||
tmp = TasmotaGlobal.mqtt_data.c_str();
|
||||
#else
|
||||
tmp = TasmotaGlobal.mqtt_data;
|
||||
#endif
|
||||
uint32_t count = 0;
|
||||
while (tmp = strstr_P(tmp, needle)) {
|
||||
count++;
|
||||
tmp++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
*/
|
||||
return (strstr_P(ResponseData(), needle) != nullptr);
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* GPIO Module and Template management
|
||||
|
|
|
@ -432,7 +432,7 @@ void CmndStatusResponse(uint32_t index) {
|
|||
all_status = (const char*) nullptr;
|
||||
} else {
|
||||
if (0 == index) { all_status = ""; }
|
||||
all_status += TasmotaGlobal.mqtt_data;
|
||||
all_status += ResponseData();
|
||||
}
|
||||
}
|
||||
else if (index < 99) {
|
||||
|
|
|
@ -2135,11 +2135,7 @@ void HandleOtherConfiguration(void) {
|
|||
WSContentSendStyle();
|
||||
|
||||
TemplateJson();
|
||||
#ifdef MQTT_DATA_STRING
|
||||
WSContentSend_P(HTTP_FORM_OTHER, TasmotaGlobal.mqtt_data.c_str(), (USER_MODULE == Settings->module) ? PSTR(" checked disabled") : "",
|
||||
#else
|
||||
WSContentSend_P(HTTP_FORM_OTHER, TasmotaGlobal.mqtt_data, (USER_MODULE == Settings->module) ? PSTR(" checked disabled") : "",
|
||||
#endif
|
||||
WSContentSend_P(HTTP_FORM_OTHER, ResponseData(), (USER_MODULE == Settings->module) ? PSTR(" checked disabled") : "",
|
||||
(Settings->flag.mqtt_enabled) ? PSTR(" checked") : "", // SetOption3 - Enable MQTT
|
||||
SettingsText(SET_FRIENDLYNAME1), SettingsText(SET_DEVICENAME));
|
||||
|
||||
|
|
|
@ -670,16 +670,12 @@ void MqttPublishPayload(const char* topic, const char* payload) {
|
|||
}
|
||||
|
||||
void MqttPublish(const char* topic, bool retained) {
|
||||
// Publish <topic> default TasmotaGlobal.mqtt_data string with optional retained
|
||||
#ifdef MQTT_DATA_STRING
|
||||
MqttPublishPayload(topic, TasmotaGlobal.mqtt_data.c_str(), 0, retained);
|
||||
#else
|
||||
MqttPublishPayload(topic, TasmotaGlobal.mqtt_data, 0, retained);
|
||||
#endif
|
||||
// Publish <topic> default ResponseData string with optional retained
|
||||
MqttPublishPayload(topic, ResponseData(), 0, retained);
|
||||
}
|
||||
|
||||
void MqttPublish(const char* topic) {
|
||||
// Publish <topic> default TasmotaGlobal.mqtt_data string no retained
|
||||
// Publish <topic> default ResponseData string no retained
|
||||
MqttPublish(topic, false);
|
||||
}
|
||||
|
||||
|
@ -750,40 +746,36 @@ void MqttPublishPayloadPrefixTopicRulesProcess_P(uint32_t prefix, const char* su
|
|||
}
|
||||
|
||||
void MqttPublishPayloadPrefixTopicRulesProcess_P(uint32_t prefix, const char* subtopic, const char* payload) {
|
||||
// Publish <prefix>/<device>/<RESULT or <subtopic>> default TasmotaGlobal.mqtt_data string no retained
|
||||
// Publish <prefix>/<device>/<RESULT or <subtopic>> default ResponseData string no retained
|
||||
// then process rules
|
||||
MqttPublishPayloadPrefixTopicRulesProcess_P(prefix, subtopic, payload, false);
|
||||
}
|
||||
|
||||
void MqttPublishPrefixTopic_P(uint32_t prefix, const char* subtopic, bool retained) {
|
||||
// Publish <prefix>/<device>/<RESULT or <subtopic>> default TasmotaGlobal.mqtt_data string with optional retained
|
||||
#ifdef MQTT_DATA_STRING
|
||||
MqttPublishPayloadPrefixTopic_P(prefix, subtopic, TasmotaGlobal.mqtt_data.c_str(), 0, retained);
|
||||
#else
|
||||
MqttPublishPayloadPrefixTopic_P(prefix, subtopic, TasmotaGlobal.mqtt_data, 0, retained);
|
||||
#endif
|
||||
// Publish <prefix>/<device>/<RESULT or <subtopic>> default ResponseData string with optional retained
|
||||
MqttPublishPayloadPrefixTopic_P(prefix, subtopic, ResponseData(), 0, retained);
|
||||
}
|
||||
|
||||
void MqttPublishPrefixTopic_P(uint32_t prefix, const char* subtopic) {
|
||||
// Publish <prefix>/<device>/<RESULT or <subtopic>> default TasmotaGlobal.mqtt_data string no retained
|
||||
// Publish <prefix>/<device>/<RESULT or <subtopic>> default ResponseData string no retained
|
||||
MqttPublishPrefixTopic_P(prefix, subtopic, false);
|
||||
}
|
||||
|
||||
void MqttPublishPrefixTopicRulesProcess_P(uint32_t prefix, const char* subtopic, bool retained) {
|
||||
// Publish <prefix>/<device>/<RESULT or <subtopic>> default TasmotaGlobal.mqtt_data string with optional retained
|
||||
// Publish <prefix>/<device>/<RESULT or <subtopic>> default ResponseData string with optional retained
|
||||
// then process rules
|
||||
MqttPublishPrefixTopic_P(prefix, subtopic, retained);
|
||||
XdrvRulesProcess(0);
|
||||
}
|
||||
|
||||
void MqttPublishPrefixTopicRulesProcess_P(uint32_t prefix, const char* subtopic) {
|
||||
// Publish <prefix>/<device>/<RESULT or <subtopic>> default TasmotaGlobal.mqtt_data string no retained
|
||||
// Publish <prefix>/<device>/<RESULT or <subtopic>> default ResponseData string no retained
|
||||
// then process rules
|
||||
MqttPublishPrefixTopicRulesProcess_P(prefix, subtopic, false);
|
||||
}
|
||||
|
||||
void MqttPublishTeleSensor(void) {
|
||||
// Publish tele/<device>/SENSOR default TasmotaGlobal.mqtt_data string with optional retained
|
||||
// Publish tele/<device>/SENSOR default ResponseData string with optional retained
|
||||
// then process rules
|
||||
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_SENSOR), Settings->flag.mqtt_sensor_retain); // CMND_SENSORRETAIN
|
||||
}
|
||||
|
@ -1079,17 +1071,9 @@ void MqttReconnect(void) {
|
|||
}
|
||||
|
||||
String azureMqtt_userString = String(SettingsText(SET_MQTT_HOST)) + "/" + String(SettingsText(SET_MQTT_CLIENT)); + "/?api-version=2018-06-30";
|
||||
#ifdef MQTT_DATA_STRING
|
||||
if (MqttClient.connect(TasmotaGlobal.mqtt_client, azureMqtt_userString.c_str(), azureMqtt_password.c_str(), stopic, 1, lwt_retain, TasmotaGlobal.mqtt_data.c_str(), MQTT_CLEAN_SESSION)) {
|
||||
if (MqttClient.connect(TasmotaGlobal.mqtt_client, azureMqtt_userString.c_str(), azureMqtt_password.c_str(), stopic, 1, lwt_retain, ResponseData(), MQTT_CLEAN_SESSION)) {
|
||||
#else
|
||||
if (MqttClient.connect(TasmotaGlobal.mqtt_client, azureMqtt_userString.c_str(), azureMqtt_password.c_str(), stopic, 1, lwt_retain, TasmotaGlobal.mqtt_data, MQTT_CLEAN_SESSION)) {
|
||||
#endif
|
||||
#else
|
||||
#ifdef MQTT_DATA_STRING
|
||||
if (MqttClient.connect(TasmotaGlobal.mqtt_client, mqtt_user, mqtt_pwd, stopic, 1, lwt_retain, TasmotaGlobal.mqtt_data.c_str(), MQTT_CLEAN_SESSION)) {
|
||||
#else
|
||||
if (MqttClient.connect(TasmotaGlobal.mqtt_client, mqtt_user, mqtt_pwd, stopic, 1, lwt_retain, TasmotaGlobal.mqtt_data, MQTT_CLEAN_SESSION)) {
|
||||
#endif
|
||||
if (MqttClient.connect(TasmotaGlobal.mqtt_client, mqtt_user, mqtt_pwd, stopic, 1, lwt_retain, ResponseData(), MQTT_CLEAN_SESSION)) {
|
||||
#endif // USE_MQTT_AZURE_IOT
|
||||
#ifdef USE_MQTT_TLS
|
||||
if (Mqtt.mqtt_tls) {
|
||||
|
|
|
@ -987,11 +987,7 @@ void RulesEvery100ms(void) {
|
|||
if (ResponseLength()) {
|
||||
ResponseJsonStart(); // {"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089}
|
||||
ResponseJsonEnd();
|
||||
#ifdef MQTT_DATA_STRING
|
||||
RulesProcessEvent(TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
RulesProcessEvent(TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
RulesProcessEvent(ResponseData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2403,11 +2403,7 @@ chknext:
|
|||
char rstring[SCRIPT_MAXSSIZE];
|
||||
rstring[0] = 0;
|
||||
int8_t index = fvar;
|
||||
#ifdef MQTT_DATA_STRING
|
||||
char *wd = (char*)TasmotaGlobal.mqtt_data.c_str();
|
||||
#else
|
||||
char *wd = TasmotaGlobal.mqtt_data;
|
||||
#endif
|
||||
char *wd = ResponseData();
|
||||
strlcpy(rstring, wd, glob_script_mem.max_ssize);
|
||||
if (index) {
|
||||
if (strlen(wd) && index) {
|
||||
|
@ -2432,11 +2428,7 @@ chknext:
|
|||
// preserve mqtt_data
|
||||
char *mqd = (char*)malloc(ResponseSize()+2);
|
||||
if (mqd) {
|
||||
#ifdef MQTT_DATA_STRING
|
||||
strlcpy(mqd, TasmotaGlobal.mqtt_data.c_str(), ResponseSize());
|
||||
#else
|
||||
strlcpy(mqd, TasmotaGlobal.mqtt_data, ResponseSize());
|
||||
#endif
|
||||
strlcpy(mqd, ResponseData(), ResponseSize());
|
||||
wd = mqd;
|
||||
char *lwd = wd;
|
||||
while (index) {
|
||||
|
@ -5007,11 +4999,7 @@ void ScripterEvery100ms(void) {
|
|||
if (ResponseLength()) {
|
||||
ResponseJsonStart();
|
||||
ResponseJsonEnd();
|
||||
#ifdef MQTT_DATA_STRING
|
||||
Run_Scripter(">T", 2, TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
Run_Scripter(">T", 2, TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
Run_Scripter(">T", 2, ResponseData());
|
||||
}
|
||||
}
|
||||
if (bitRead(Settings->rule_enabled, 0)) {
|
||||
|
@ -7735,13 +7723,12 @@ int32_t http_req(char *host, char *request) {
|
|||
#ifdef USE_WEBSEND_RESPONSE
|
||||
#ifdef MQTT_DATA_STRING
|
||||
TasmotaGlobal.mqtt_data = http.getString();
|
||||
//AddLog(LOG_LEVEL_INFO, PSTR("HTTP RESULT %s"), TasmotaGlobal.mqtt_data.c_str());
|
||||
Run_Scripter(">E", 2, TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
strlcpy(TasmotaGlobal.mqtt_data, http.getString().c_str(), ResponseSize());
|
||||
//AddLog(LOG_LEVEL_INFO, PSTR("HTTP RESULT %s"), TasmotaGlobal.mqtt_data);
|
||||
Run_Scripter(">E", 2, TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
//AddLog(LOG_LEVEL_INFO, PSTR("HTTP RESULT %s"), ResponseData());
|
||||
Run_Scripter(">E", 2, ResponseData());
|
||||
|
||||
glob_script_mem.glob_error = 0;
|
||||
#endif
|
||||
|
||||
|
@ -8442,41 +8429,24 @@ bool Xdrv10(uint8_t function)
|
|||
break;
|
||||
case FUNC_RULES_PROCESS:
|
||||
if (bitRead(Settings->rule_enabled, 0)) {
|
||||
#ifdef MQTT_DATA_STRING
|
||||
#ifdef USE_SCRIPT_STATUS
|
||||
if (!strncmp_P(TasmotaGlobal.mqtt_data.c_str(), PSTR("{\"Status"), 8)) {
|
||||
Run_Scripter(">U", 2, TasmotaGlobal.mqtt_data.c_str());
|
||||
if (!strncmp_P(ResponseData(), PSTR("{\"Status"), 8)) {
|
||||
Run_Scripter(">U", 2, ResponseData());
|
||||
} else {
|
||||
Run_Scripter(">E", 2, TasmotaGlobal.mqtt_data.c_str());
|
||||
Run_Scripter(">E", 2, ResponseData());
|
||||
}
|
||||
#else
|
||||
Run_Scripter(">E", 2, TasmotaGlobal.mqtt_data.c_str());
|
||||
Run_Scripter(">E", 2, ResponseData());
|
||||
#endif
|
||||
#else // MQTT_DATA_STRING
|
||||
#ifdef USE_SCRIPT_STATUS
|
||||
if (!strncmp_P(TasmotaGlobal.mqtt_data, PSTR("{\"Status"), 8)) {
|
||||
Run_Scripter(">U", 2, TasmotaGlobal.mqtt_data);
|
||||
} else {
|
||||
Run_Scripter(">E", 2, TasmotaGlobal.mqtt_data);
|
||||
}
|
||||
#else
|
||||
Run_Scripter(">E", 2, TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
#endif // MQTT_DATA_STRING
|
||||
|
||||
result = glob_script_mem.event_handeled;
|
||||
}
|
||||
break;
|
||||
case FUNC_TELEPERIOD_RULES_PROCESS:
|
||||
if (bitRead(Settings->rule_enabled, 0)) {
|
||||
#ifdef MQTT_DATA_STRING
|
||||
if (TasmotaGlobal.mqtt_data.length()) {
|
||||
Run_Scripter(">T", 2, TasmotaGlobal.mqtt_data.c_str());
|
||||
if (ResponseLength()) {
|
||||
Run_Scripter(">T", 2, ResponseData());
|
||||
}
|
||||
#else
|
||||
if (TasmotaGlobal.mqtt_data[0]) {
|
||||
Run_Scripter(">T", 2, TasmotaGlobal.mqtt_data);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
#ifdef USE_WEBSERVER
|
||||
|
|
|
@ -896,11 +896,7 @@ void HAssAnnounceSensors(void)
|
|||
TasmotaGlobal.tele_period = tele_period_save;
|
||||
size_t sensordata_len = ResponseLength();
|
||||
char sensordata[sensordata_len+2]; // dynamically adjust the size
|
||||
#ifdef MQTT_DATA_STRING
|
||||
strcpy(sensordata, TasmotaGlobal.mqtt_data.c_str()); // we can use strcpy since the buffer has the right size
|
||||
#else
|
||||
strcpy(sensordata, TasmotaGlobal.mqtt_data); // we can use strcpy since the buffer has the right size
|
||||
#endif
|
||||
strcpy(sensordata, ResponseData()); // we can use strcpy since the buffer has the right size
|
||||
|
||||
// ******************* JSON TEST *******************
|
||||
// char sensordata[512];
|
||||
|
|
|
@ -1301,11 +1301,7 @@ void DisplayDTVarsTeleperiod(void) {
|
|||
if (jlen < DTV_JSON_SIZE) {
|
||||
char *json = (char*)malloc(jlen + 2);
|
||||
if (json) {
|
||||
#ifdef MQTT_DATA_STRING
|
||||
strlcpy(json, (char*)TasmotaGlobal.mqtt_data.c_str(), jlen + 1);
|
||||
#else
|
||||
strlcpy(json, TasmotaGlobal.mqtt_data, jlen + 1);
|
||||
#endif
|
||||
strlcpy(json, ResponseData(), jlen + 1);
|
||||
get_dt_vars(json);
|
||||
free(json);
|
||||
}
|
||||
|
@ -1324,11 +1320,7 @@ void get_dt_mqtt(void) {
|
|||
ResponseJsonStart();
|
||||
ResponseJsonEnd();
|
||||
}
|
||||
#ifdef MQTT_DATA_STRING
|
||||
get_dt_vars((char*)TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
get_dt_vars(TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
get_dt_vars(ResponseData());
|
||||
}
|
||||
|
||||
void get_dt_vars(char *json) {
|
||||
|
@ -1743,13 +1735,8 @@ void DisplayLocalSensor(void)
|
|||
{
|
||||
if ((Settings->display_mode &0x02) && (0 == TasmotaGlobal.tele_period)) {
|
||||
char no_topic[1] = { 0 };
|
||||
#ifdef MQTT_DATA_STRING
|
||||
// DisplayAnalyzeJson(TasmotaGlobal.mqtt_topic, TasmotaGlobal.mqtt_data.c_str()); // Add local topic
|
||||
DisplayAnalyzeJson(no_topic, TasmotaGlobal.mqtt_data.c_str()); // Discard any topic
|
||||
#else
|
||||
// DisplayAnalyzeJson(TasmotaGlobal.mqtt_topic, TasmotaGlobal.mqtt_data); // Add local topic
|
||||
DisplayAnalyzeJson(no_topic, TasmotaGlobal.mqtt_data); // Discard any topic
|
||||
#endif
|
||||
// DisplayAnalyzeJson(TasmotaGlobal.mqtt_topic, ResponseData()); // Add local topic
|
||||
DisplayAnalyzeJson(no_topic, ResponseData()); // Discard any topic
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1227,11 +1227,7 @@ void TuyaSerialInput(void)
|
|||
if (Settings->flag3.tuya_serial_mqtt_publish) { // SetOption66 - Enable TuyaMcuReceived messages over Mqtt
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_TUYA_MCU_RECEIVED));
|
||||
} else {
|
||||
#ifdef MQTT_DATA_STRING
|
||||
AddLog(LOG_LEVEL_DEBUG, TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
AddLog(LOG_LEVEL_DEBUG, TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
AddLog(LOG_LEVEL_DEBUG, ResponseData());
|
||||
}
|
||||
XdrvRulesProcess(0);
|
||||
|
||||
|
|
|
@ -751,11 +751,7 @@ public:
|
|||
if (Settings->flag3.tuya_serial_mqtt_publish) {
|
||||
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_SENSOR));
|
||||
} else {
|
||||
#ifdef MQTT_DATA_STRING
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), ResponseData());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1577,11 +1577,7 @@ void Z_AutoConfigReportingForCluster(uint16_t shortaddr, uint16_t groupaddr, uin
|
|||
ResponseAppend_P(PSTR("}}"));
|
||||
|
||||
if (buf.len() > 0) {
|
||||
#ifdef MQTT_DATA_STRING
|
||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "auto-bind `%s`"), TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "auto-bind `%s`"), TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "auto-bind `%s`"), ResponseData());
|
||||
ZCLMessage zcl(buf.len()); // message is 4 bytes
|
||||
zcl.shortaddr = shortaddr;
|
||||
zcl.cluster = cluster;
|
||||
|
|
|
@ -152,11 +152,7 @@ void ZigbeeInputLoop(void) {
|
|||
if (Settings->flag3.tuya_serial_mqtt_publish) {
|
||||
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_SENSOR));
|
||||
} else {
|
||||
#ifdef MQTT_DATA_STRING
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "%s"), ResponseData());
|
||||
}
|
||||
// now process the message
|
||||
ZigbeeProcessInput(znp_buffer);
|
||||
|
@ -601,11 +597,7 @@ void ZigbeeProcessInputEZSP(SBuffer &buf) {
|
|||
log_level = LOG_LEVEL_DEBUG;
|
||||
break;
|
||||
}
|
||||
#ifdef MQTT_DATA_STRING
|
||||
AddLog(log_level, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data.c_str()); // TODO move to LOG_LEVEL_DEBUG when stable
|
||||
#else
|
||||
AddLog(log_level, PSTR(D_LOG_ZIGBEE "%s"), TasmotaGlobal.mqtt_data); // TODO move to LOG_LEVEL_DEBUG when stable
|
||||
#endif
|
||||
AddLog(log_level, PSTR(D_LOG_ZIGBEE "%s"), ResponseData()); // TODO move to LOG_LEVEL_DEBUG when stable
|
||||
}
|
||||
|
||||
// Pass message to state machine
|
||||
|
|
|
@ -123,11 +123,7 @@ extern "C" {
|
|||
const char * command = be_tostring(vm, 2);
|
||||
be_pop(vm, 2); // clear the stack before calling, because of re-entrant call to Berry in a Rule
|
||||
ExecuteCommand(command, SRC_BERRY);
|
||||
#ifdef MQTT_DATA_STRING
|
||||
be_pushstring(vm, TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
be_pushstring(vm, TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
be_pushstring(vm, ResponseData());
|
||||
be_return(vm); // Return
|
||||
}
|
||||
be_raise(vm, kTypeError, nullptr);
|
||||
|
|
|
@ -256,7 +256,7 @@ char* InfluxDbNumber(char* alternative, const char* source) {
|
|||
void InfluxDbProcessJson(void) {
|
||||
if (!IFDB.init) { return; }
|
||||
|
||||
// AddLog(LOG_LEVEL_DEBUG, PSTR("IFX: JSON %s"), TasmotaGlobal.mqtt_data.c_str());
|
||||
// AddLog(LOG_LEVEL_DEBUG, PSTR("IFX: JSON %s"), ResponseData());
|
||||
|
||||
String jsonStr = TasmotaGlobal.mqtt_data;
|
||||
JsonParser parser((char *)jsonStr.c_str());
|
||||
|
|
|
@ -2689,11 +2689,7 @@ void MI32ShowSomeSensors(){
|
|||
}
|
||||
ResponseAppend_P(PSTR("}"));
|
||||
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_SENSOR), Settings->flag.mqtt_sensor_retain);
|
||||
#ifdef MQTT_DATA_STRING
|
||||
//AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: show some %d %s"),D_CMND_MI32, MI32.mqttCurrentSlot, TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
//AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: show some %d %s"),D_CMND_MI32, MI32.mqttCurrentSlot, TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
//AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: show some %d %s"),D_CMND_MI32, MI32.mqttCurrentSlot, ResponseData());
|
||||
|
||||
#ifdef USE_HOME_ASSISTANT
|
||||
if(hass_mode==2){
|
||||
|
@ -2746,11 +2742,7 @@ void MI32ShowOneMISensor(){
|
|||
id);
|
||||
|
||||
MqttPublish(SensorTopic);
|
||||
#ifdef MQTT_DATA_STRING
|
||||
//AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: show some %d %s"),D_CMND_MI32, MI32.mqttCurrentSlot, TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
//AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: show some %d %s"),D_CMND_MI32, MI32.mqttCurrentSlot, TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
//AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: show some %d %s"),D_CMND_MI32, MI32.mqttCurrentSlot, ResponseData());
|
||||
}
|
||||
MI32.mqttCurrentSingleSlot++;
|
||||
}
|
||||
|
@ -3006,11 +2998,7 @@ void MI32DiscoveryOneMISensor(){
|
|||
//vTaskDelay(100/ portTICK_PERIOD_MS);
|
||||
}
|
||||
} // end if hass discovery
|
||||
#ifdef MQTT_DATA_STRING
|
||||
//AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: show some %d %s"),D_CMND_MI32, MI32.mqttCurrentSlot, TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
//AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: show some %d %s"),D_CMND_MI32, MI32.mqttCurrentSlot, TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
//AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: show some %d %s"),D_CMND_MI32, MI32.mqttCurrentSlot, ResponseData());
|
||||
#endif //USE_HOME_ASSISTANT
|
||||
|
||||
}
|
||||
|
@ -3088,11 +3076,7 @@ void MI32ShowTriggeredSensors(){
|
|||
} else {
|
||||
MqttPublishPrefixTopic_P(STAT, PSTR(D_RSLT_SENSOR), Settings->flag.mqtt_sensor_retain);
|
||||
}
|
||||
#ifdef MQTT_DATA_STRING
|
||||
AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: triggered %d %s"),D_CMND_MI32, sensor, TasmotaGlobal.mqtt_data.c_str());
|
||||
#else
|
||||
AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: triggered %d %s"),D_CMND_MI32, sensor, TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: triggered %d %s"),D_CMND_MI32, sensor, ResponseData());
|
||||
XdrvRulesProcess(0);
|
||||
|
||||
} else { // else don't and clear
|
||||
|
|
Loading…
Reference in New Issue