mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-07-29 01:52:51 +00:00
process message from scheduler
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define EMSESP_APP_VERSION "3.8.3-dev.8e"
|
||||
#define EMSESP_APP_VERSION "3.8.3-dev.8f"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user