diff --git a/tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino b/tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino index 6f9003d70..4b3848e50 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_10_rules.ino @@ -1159,11 +1159,14 @@ bool RulesMqttData(void) } bool serviced = false; String sTopic = XdrvMailbox.topic; - String sData = XdrvMailbox.data; + String buData = XdrvMailbox.data; //AddLog(LOG_LEVEL_DEBUG, PSTR("RUL: MQTT Topic %s, Event %s"), XdrvMailbox.topic, XdrvMailbox.data); MQTT_Subscription event_item; //Looking for matched topic for (uint32_t index = 0; index < subscriptions.size(); index++) { + + String sData = buData; + event_item = subscriptions.get(index); //AddLog(LOG_LEVEL_DEBUG, PSTR("RUL: Match MQTT message Topic %s with subscription topic %s"), sTopic.c_str(), event_item.Topic.c_str()); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino b/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino index 3be9f834c..1e60baf1f 100755 --- a/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino @@ -8260,7 +8260,7 @@ bool ScriptCommand(void) { Response_P(S_JSON_COMMAND_SVALUE, command, result.c_str()); #ifdef DEBUG_MQTT_EVENT } else if (CMND_SUBTEST == command_code) { - XdrvMailbox.topic = (char*)"tele"; + XdrvMailbox.topic = (char*)"stat/tasmota/SENSOR"; ScriptMqttData(); serviced = true; #endif @@ -8291,92 +8291,12 @@ void dateTime(uint16_t* date, uint16_t* time) { #ifdef SUPPORT_MQTT_EVENT -/* -//#define DEBUG_MQTT_EVENT -// parser object, source keys, delimiter, float result or NULL, string result or NULL, string size -uint32_t JsonParsePath(JsonParserObject *jobj, const char *spath, char delim, float *nres, char *sres, uint32_t slen) { - uint32_t res = 0; - const char *cp = spath; -#ifdef DEBUG_JSON_PARSE_PATH - AddLog(LOG_LEVEL_INFO, PSTR("JSON: parsing json key: %s from json: %s"), cp, jpath); -#endif - JsonParserObject obj = *jobj; - JsonParserObject lastobj = obj; - char selem[32]; - uint8_t aindex = 0; - String value = ""; - while (1) { - // read next element - for (uint32_t sp=0; sp>> 1"); //toLog(XdrvMailbox.data); @@ -8396,7 +8315,7 @@ bool ScriptMqttData(void) return false; } String sTopic = XdrvMailbox.topic; - String sData = XdrvMailbox.data; + String buData = XdrvMailbox.data; #ifdef DEBUG_MQTT_EVENT AddLog(LOG_LEVEL_INFO, PSTR("Script: MQTT Topic %s, Event %s"), XdrvMailbox.topic, XdrvMailbox.data); @@ -8408,6 +8327,8 @@ bool ScriptMqttData(void) event_item = subscriptions.get(index); uint8_t json_valid = 0; + String sData = buData; + #ifdef DEBUG_MQTT_EVENT AddLog(LOG_LEVEL_INFO, PSTR("Script: Match MQTT message Topic %s with subscription topic %s and key %s"), sTopic.c_str(), event_item.Topic.c_str(),event_item.Key.c_str()); #endif