mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
id to value_info, alternative prefix to command/value
This commit is contained in:
12
src/mqtt.cpp
12
src/mqtt.cpp
@@ -328,11 +328,11 @@ void Mqtt::on_message(const char * fulltopic, const char * payload, size_t len)
|
||||
}
|
||||
cmd_only++; // skip the /
|
||||
int8_t id = -1;
|
||||
// check for hcx/ prefix
|
||||
if (cmd_only[0] == 'h' && cmd_only[1] == 'c' && cmd_only[3] == '/') {
|
||||
id = cmd_only[2] - '0';
|
||||
cmd_only += 4;
|
||||
}
|
||||
// check for hcx/ prefix, commented out, this is now in command::call
|
||||
// if (cmd_only[0] == 'h' && cmd_only[1] == 'c' && cmd_only[3] == '/') {
|
||||
// id = cmd_only[2] - '0';
|
||||
// cmd_only += 4;
|
||||
// }
|
||||
// LOG_INFO(F("devicetype= %d, topic = %s, cmd = %s, message = %s, id = %d"), mf.device_type_, topic, cmd_only, message, id);
|
||||
if (!Command::call(mf.device_type_, cmd_only, message, id)) {
|
||||
LOG_ERROR(F("No matching cmd (%s) in topic %s, id %d, or invalid data"), cmd_only, topic, id);
|
||||
@@ -382,7 +382,7 @@ void Mqtt::on_message(const char * fulltopic, const char * payload, size_t len)
|
||||
if (cmd_known && json.size()) {
|
||||
Mqtt::publish(F("response"), resp.as<JsonObject>());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!cmd_known) {
|
||||
|
||||
Reference in New Issue
Block a user