From 45476312abffced6a5dafb822547fd8678ef5e4a Mon Sep 17 00:00:00 2001 From: "suks.ae" Date: Fri, 31 Jul 2026 10:01:42 +0200 Subject: [PATCH 1/4] initial proposal --- src/_P037_MQTTImport.ino | 46 ++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/src/_P037_MQTTImport.ino b/src/_P037_MQTTImport.ino index 44f158a5a..f1aaf51a5 100644 --- a/src/_P037_MQTTImport.ino +++ b/src/_P037_MQTTImport.ino @@ -632,24 +632,7 @@ boolean Plugin_037(uint8_t function, struct EventStruct *event, String& string) } UserVar.setFloat(event->TaskIndex, x, doublePayload); // Save the new value - if (!checkJson && P037_SEND_EVENTS && Settings.UseRules) { // Generate event of all non-json topic/payloads - String RuleEvent = strformat(F("%s#%s=%s"), - getTaskDeviceName(event->TaskIndex).c_str(), - event->String1.c_str(), - wrapWithQuotesIfContainsParameterSeparatorChar(unparsedPayload).c_str()); - P037_addEventToQueue(event, RuleEvent); - } - // Log the event - # if !defined(P037_LIMIT_BUILD_SIZE) || defined(P037_OVERRIDE) - - if (loglevelActiveFor(LOG_LEVEL_INFO)) { - addLog(LOG_LEVEL_INFO, strformat(F("IMPT : [%s#%s] : %s"), - getTaskDeviceName(event->TaskIndex).c_str(), - checkJson ? key.c_str() : getTaskValueName(event->TaskIndex, x).c_str(), - toString(doublePayload, ExtraTaskSettings.TaskDeviceValueDecimals[x]).c_str())); - } - # endif // if !defined(P037_LIMIT_BUILD_SIZE) || defined(P037_OVERRIDE) // Generate event for rules processing - proposed by TridentTD @@ -678,6 +661,29 @@ boolean Plugin_037(uint8_t function, struct EventStruct *event, String& string) } P037_addEventToQueue(event, RuleEvent); } + else + { // Generate event of all non-json topic/payloads + String tmp = unparsedPayload; + tmp.replace('}', '>'); // Replace curly braces by angle brackets to avoid problems with string processing in rules + tmp.replace('{', '<'); + + String RuleEvent = strformat(F("%s#%s=%s"), + getTaskDeviceName(event->TaskIndex).c_str(), + event->String1.c_str(), + wrapWithQuotesIfContainsParameterSeparatorChar(tmp).c_str()); + P037_addEventToQueue(event, RuleEvent); + } + + // Log the event + # if !defined(P037_LIMIT_BUILD_SIZE) || defined(P037_OVERRIDE) + + if (loglevelActiveFor(LOG_LEVEL_INFO)) { + addLog(LOG_LEVEL_INFO, strformat(F("IMPT : [%s#%s] : %s"), + getTaskDeviceName(event->TaskIndex).c_str(), + checkJson ? key.c_str() : getTaskValueName(event->TaskIndex, x).c_str(), + toString(doublePayload, ExtraTaskSettings.TaskDeviceValueDecimals[x]).c_str())); + } + # endif // if !defined(P037_LIMIT_BUILD_SIZE) || defined(P037_OVERRIDE) // (Always) Generate #= event String RuleEvent; @@ -690,7 +696,11 @@ boolean Plugin_037(uint8_t function, struct EventStruct *event, String& string) if (numericPayload) { RuleEvent += toString(doublePayload, ExtraTaskSettings.TaskDeviceValueDecimals[x]); } else { - RuleEvent += wrapWithQuotesIfContainsParameterSeparatorChar(Payload); + String tmp = Payload; + tmp.replace('}', '>'); // Replace curly braces by angle brackets to avoid problems with + tmp.replace('{', '<'); // string processing in rules if a JSON message is received + + RuleEvent += wrapWithQuotesIfContainsParameterSeparatorChar(tmp); } P037_addEventToQueue(event, RuleEvent); } From a85eb3065979bc176cf9b0bb002e4301b54decce Mon Sep 17 00:00:00 2001 From: "suks.ae" Date: Fri, 31 Jul 2026 12:10:16 +0200 Subject: [PATCH 2/4] escape characters instead of angle brackets --- src/_P037_MQTTImport.ino | 14 +++++--------- src/src/Helpers/StringParser.cpp | 11 +++++++++++ src/src/Helpers/StringParser.h | 2 ++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/_P037_MQTTImport.ino b/src/_P037_MQTTImport.ino index f1aaf51a5..d355fe267 100644 --- a/src/_P037_MQTTImport.ino +++ b/src/_P037_MQTTImport.ino @@ -632,8 +632,6 @@ boolean Plugin_037(uint8_t function, struct EventStruct *event, String& string) } UserVar.setFloat(event->TaskIndex, x, doublePayload); // Save the new value - - // Generate event for rules processing - proposed by TridentTD if (Settings.UseRules && P037_SEND_EVENTS) { @@ -661,11 +659,10 @@ boolean Plugin_037(uint8_t function, struct EventStruct *event, String& string) } P037_addEventToQueue(event, RuleEvent); } - else - { // Generate event of all non-json topic/payloads + else // Generate event of all non-json topic/payloads + { String tmp = unparsedPayload; - tmp.replace('}', '>'); // Replace curly braces by angle brackets to avoid problems with string processing in rules - tmp.replace('{', '<'); + addEscapeCharacters(tmp); // Add escape characters to avoid problems with rules processing if a JSON message is received String RuleEvent = strformat(F("%s#%s=%s"), getTaskDeviceName(event->TaskIndex).c_str(), @@ -697,9 +694,8 @@ boolean Plugin_037(uint8_t function, struct EventStruct *event, String& string) RuleEvent += toString(doublePayload, ExtraTaskSettings.TaskDeviceValueDecimals[x]); } else { String tmp = Payload; - tmp.replace('}', '>'); // Replace curly braces by angle brackets to avoid problems with - tmp.replace('{', '<'); // string processing in rules if a JSON message is received - + addEscapeCharacters(tmp); // Add escape characters to avoid problems with rules processing if a JSON message is received + RuleEvent += wrapWithQuotesIfContainsParameterSeparatorChar(tmp); } P037_addEventToQueue(event, RuleEvent); diff --git a/src/src/Helpers/StringParser.cpp b/src/src/Helpers/StringParser.cpp index d0e487d4d..ccf985cf7 100644 --- a/src/src/Helpers/StringParser.cpp +++ b/src/src/Helpers/StringParser.cpp @@ -46,6 +46,17 @@ void stripEscapeCharacters(String& str) } } +void addEscapeCharacters(String& str) +{ + const char braces[] = { '%', '[', ']', '{', '}', '(', ')' }; + constexpr uint8_t nrbraces = NR_ELEMENTS(braces); + + for (uint8_t i = 0; i < nrbraces; ++i) { + const String s(concat(F("\\"), braces[i])); + str.replace(s.substring(1), s); + } +} + #if FEATURE_STRING_VARIABLES String parseTemplateAndCalculate(String& tmpString) { stripEscapeCharacters(tmpString); diff --git a/src/src/Helpers/StringParser.h b/src/src/Helpers/StringParser.h index 939a6d718..25406e881 100644 --- a/src/src/Helpers/StringParser.h +++ b/src/src/Helpers/StringParser.h @@ -15,6 +15,8 @@ bool hasEscapedCharacter(String& str, const char EscapeChar); // So far \\% \\[ \\] \\{ \\} \\( and \\) are used (all with single backslash!) void stripEscapeCharacters(String& str); +void addEscapeCharacters(String& str); + #if FEATURE_STRING_VARIABLES String parseTemplateAndCalculate(String& tmpString); uint8_t getDerivedValueCountForTask(taskIndex_t taskIndex); From 5574bc0fe26f727ebb9a1b45fc7c4452aba7c2c9 Mon Sep 17 00:00:00 2001 From: Ton Huisman Date: Sun, 2 Aug 2026 15:56:21 +0200 Subject: [PATCH 3/4] [Fix] Write _plugin_sets_overview.repl as utf-8 so it works again on Windows --- docs/builds_overview.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/builds_overview.py b/docs/builds_overview.py index 0f36316bb..513756f5c 100644 --- a/docs/builds_overview.py +++ b/docs/builds_overview.py @@ -173,7 +173,7 @@ def generateBuildOverview(fileName): print('Writing build sets overview to:', filepath) - output = open(filepath, "w") + output = open(filepath, "w", encoding="utf-8") output.write('Plugins per build set\n') output.write('=====================\n') output.write('\n') From 8f8b6c801eaa5026db109a208982ba64104ff994 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 8 Aug 2026 19:09:59 +0000 Subject: [PATCH 4/4] Bump cryptography from 44.0.1 to 50.0.0 Bumps [cryptography](https://github.com/pyca/cryptography) from 44.0.1 to 50.0.0. - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/44.0.1...50.0.0) --- updated-dependencies: - dependency-name: cryptography dependency-version: 50.0.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fab1f055f..777e2035b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ pioarduino==6.1.19 pygit2>=1.10.1 -cryptography==44.0.1 +cryptography==50.0.0 setuptools>=75.8 uv \ No newline at end of file