mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fix unknown command being added to return json
This commit is contained in:
@@ -743,7 +743,7 @@ void EMSESP::publish_response(std::shared_ptr<const Telegram> telegram) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// builds json with the detail of each value, for a given EMS device
|
// builds json with the detail of each value, for a given EMS device
|
||||||
// for other types like sensors, scheduler, custom entities it will process single commands like 'info', 'values', 'commands'...
|
// for other types like sensors, scheduler, custom entities it will process single commands like 'info', 'values', 'commands', 'entities'...
|
||||||
bool EMSESP::get_device_value_info(JsonObject root, const char * cmd, const int8_t id, const uint8_t devicetype) {
|
bool EMSESP::get_device_value_info(JsonObject root, const char * cmd, const int8_t id, const uint8_t devicetype) {
|
||||||
// check first for EMS devices
|
// check first for EMS devices
|
||||||
bool found_device = false;
|
bool found_device = false;
|
||||||
@@ -755,9 +755,8 @@ bool EMSESP::get_device_value_info(JsonObject root, const char * cmd, const int8
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if the EMS device was valid, but the cmd not found show an error
|
// if the EMS device was valid, but the cmd not found exit. it will be handled upstream.
|
||||||
if (found_device) {
|
if (found_device) {
|
||||||
root["message"] = std::string("unknown command ") + cmd;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user