process message from scheduler

This commit is contained in:
MichaelDvP
2026-07-13 12:32:21 +02:00
parent 342878f628
commit b82f8c979f
4 changed files with 9 additions and 13 deletions

View File

@@ -39,17 +39,8 @@ std::deque<Token> exprToTokens(const std::string & expr) {
i += (*p == '{') ? 1 : (*p == '}') ? -1 : 0;
++p;
}
if (*p) {
++p;
}
// Use string_view to avoid unnecessary string copies
std::string_view s(b, p - b);
auto n = s.find("\"\"");
while (n != std::string_view::npos) {
s.remove_prefix(n + 2);
n = s.find("\"\"");
}
tokens.emplace_back(Token::Type::String, std::string(s), -3);
const auto s = std::string(b, p);
tokens.emplace_back(Token::Type::String, s, -3);
if (*p == '\0') {
--p;
}

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.8.3-dev.8e"
#define EMSESP_APP_VERSION "3.8.3-dev.8f"

View File

@@ -347,7 +347,11 @@ uint8_t WebSchedulerService::count_entities(bool cmd_only) {
// execute scheduled command
bool WebSchedulerService::command(const char * name, const std::string & command, const std::string & data) {
std::string cmd = Helpers::toLower(command);
if (cmd == "system/message") {
EMSESP::logger().info("Message: %s", data.c_str()); // send to log
Mqtt::queue_publish(F_(message), data); // send to MQTT if enabled
return true;
}
// check http commands. e.g.
// tasmota(get): http://<tasmotaIP>/cm?cmnd=power%20ON
// shelly(get): http://<shellyIP>/relais/0?turn=on