id to value_info, alternative prefix to command/value

This commit is contained in:
MichaelDvP
2021-04-24 10:39:17 +02:00
parent c4e7747fd1
commit 70d8b6824c
8 changed files with 75 additions and 24 deletions

View File

@@ -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) {