mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
response error messages
This commit is contained in:
@@ -1505,6 +1505,10 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8
|
||||
output["api_data"] = data;
|
||||
return true;
|
||||
} else {
|
||||
char error[100];
|
||||
snprintf(error, sizeof(error), "cannot find attribute %s in entity %s", attribute_s, command_s);
|
||||
output.clear();
|
||||
output["message"] = error;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1513,6 +1517,9 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8
|
||||
}
|
||||
}
|
||||
|
||||
char error[100];
|
||||
snprintf(error, sizeof(error), "cannot find values for entity '%s'", cmd);
|
||||
json["message"] = error;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -250,9 +250,7 @@ void Mqtt::on_message(const char * topic, const uint8_t * payload, size_t len) c
|
||||
if ((!strcmp(topic, full_topic)) && (mf.mqtt_subfunction_)) {
|
||||
if (!(mf.mqtt_subfunction_)(message)) {
|
||||
LOG_ERROR("error: invalid payload %s for this topic %s", message, topic);
|
||||
if (send_response_) {
|
||||
Mqtt::queue_publish("response", "error: invalid data");
|
||||
}
|
||||
Mqtt::queue_publish("response", "error: invalid data");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user