mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
empty json instead of "no entries"
This commit is contained in:
@@ -625,7 +625,7 @@ void AnalogSensor::publish_values(const bool force) {
|
|||||||
// searches by name
|
// searches by name
|
||||||
bool AnalogSensor::get_value_info(JsonObject & output, const char * cmd, const int8_t id) const {
|
bool AnalogSensor::get_value_info(JsonObject & output, const char * cmd, const int8_t id) const {
|
||||||
if (sensors_.empty()) {
|
if (sensors_.empty()) {
|
||||||
output["message"] = "no entries";
|
// output["message"] = "no entries";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// make a copy of the string command for parsing
|
// make a copy of the string command for parsing
|
||||||
@@ -687,7 +687,7 @@ bool AnalogSensor::get_value_info(JsonObject & output, const char * cmd, const i
|
|||||||
// returns false if there are no sensors
|
// returns false if there are no sensors
|
||||||
bool AnalogSensor::command_info(const char * value, const int8_t id, JsonObject & output) const {
|
bool AnalogSensor::command_info(const char * value, const int8_t id, JsonObject & output) const {
|
||||||
if (sensors_.empty()) {
|
if (sensors_.empty()) {
|
||||||
output["message"] = "no entries";
|
// output["message"] = "no entries";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ bool TemperatureSensor::command_commands(const char * value, const int8_t id, Js
|
|||||||
// returns false if there are no sensors
|
// returns false if there are no sensors
|
||||||
bool TemperatureSensor::command_info(const char * value, const int8_t id, JsonObject & output) {
|
bool TemperatureSensor::command_info(const char * value, const int8_t id, JsonObject & output) {
|
||||||
if (sensors_.empty()) {
|
if (sensors_.empty()) {
|
||||||
output["message"] = "no entries";
|
// output["message"] = "no entries";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ bool TemperatureSensor::command_info(const char * value, const int8_t id, JsonOb
|
|||||||
// called from emsesp.cpp, similar to the emsdevice->get_value_info
|
// called from emsesp.cpp, similar to the emsdevice->get_value_info
|
||||||
bool TemperatureSensor::get_value_info(JsonObject & output, const char * cmd, const int8_t id) {
|
bool TemperatureSensor::get_value_info(JsonObject & output, const char * cmd, const int8_t id) {
|
||||||
if (sensors_.empty()) {
|
if (sensors_.empty()) {
|
||||||
output["message"] = "no entries";
|
// output["message"] = "no entries";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// make a copy of the string command for parsing
|
// make a copy of the string command for parsing
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ bool WebCustomEntityService::get_value_info(JsonObject & output, const char * cm
|
|||||||
// if no entries, return a message instead of an error
|
// if no entries, return a message instead of an error
|
||||||
// https://github.com/emsesp/EMS-ESP32/issues/1297
|
// https://github.com/emsesp/EMS-ESP32/issues/1297
|
||||||
if (customEntityItems->size() == 0) {
|
if (customEntityItems->size() == 0) {
|
||||||
output["message"] = "no entries";
|
// output["message"] = "no entries";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (strlen(cmd) == 0 || Helpers::toLower(cmd) == F_(values) || Helpers::toLower(cmd) == F_(info)) {
|
if (strlen(cmd) == 0 || Helpers::toLower(cmd) == F_(values) || Helpers::toLower(cmd) == F_(info)) {
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ bool WebSchedulerService::get_value_info(JsonObject & output, const char * cmd)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (scheduleItems->size() == 0) {
|
if (scheduleItems->size() == 0) {
|
||||||
output["message"] = "no entries";
|
// output["message"] = "no entries";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (strlen(cmd) == 0 || Helpers::toLower(cmd) == F_(values) || Helpers::toLower(cmd) == F_(info)) {
|
if (strlen(cmd) == 0 || Helpers::toLower(cmd) == F_(values) || Helpers::toLower(cmd) == F_(info)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user