mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fix system commands - #1886
This commit is contained in:
@@ -144,24 +144,20 @@ bool System::command_fetch(const char * value, const int8_t id) {
|
|||||||
if (value_s == "all") {
|
if (value_s == "all") {
|
||||||
LOG_INFO("Requesting data from EMS devices");
|
LOG_INFO("Requesting data from EMS devices");
|
||||||
EMSESP::fetch_device_values();
|
EMSESP::fetch_device_values();
|
||||||
return true;
|
|
||||||
} else if (value_s == (F_(boiler))) {
|
} else if (value_s == (F_(boiler))) {
|
||||||
EMSESP::fetch_device_values_type(EMSdevice::DeviceType::BOILER);
|
EMSESP::fetch_device_values_type(EMSdevice::DeviceType::BOILER);
|
||||||
return true;
|
|
||||||
} else if (value_s == (F_(thermostat))) {
|
} else if (value_s == (F_(thermostat))) {
|
||||||
EMSESP::fetch_device_values_type(EMSdevice::DeviceType::THERMOSTAT);
|
EMSESP::fetch_device_values_type(EMSdevice::DeviceType::THERMOSTAT);
|
||||||
return true;
|
|
||||||
} else if (value_s == (F_(solar))) {
|
} else if (value_s == (F_(solar))) {
|
||||||
EMSESP::fetch_device_values_type(EMSdevice::DeviceType::SOLAR);
|
EMSESP::fetch_device_values_type(EMSdevice::DeviceType::SOLAR);
|
||||||
return true;
|
|
||||||
} else if (value_s == (F_(mixer))) {
|
} else if (value_s == (F_(mixer))) {
|
||||||
EMSESP::fetch_device_values_type(EMSdevice::DeviceType::MIXER);
|
EMSESP::fetch_device_values_type(EMSdevice::DeviceType::MIXER);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
EMSESP::fetch_device_values(); // default if no name or id is given
|
||||||
}
|
}
|
||||||
|
|
||||||
EMSESP::fetch_device_values(); // default if no name or id is given
|
return true; // always true
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// mqtt publish
|
// mqtt publish
|
||||||
@@ -1295,6 +1291,7 @@ bool System::saveSettings(const char * filename, const char * section, JsonObjec
|
|||||||
return false; // not found
|
return false; // not found
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return back a system value
|
||||||
bool System::get_value_info(JsonObject root, const char * command) {
|
bool System::get_value_info(JsonObject root, const char * command) {
|
||||||
if (command == nullptr || strlen(command) == 0) {
|
if (command == nullptr || strlen(command) == 0) {
|
||||||
LOG_ERROR("empty system command");
|
LOG_ERROR("empty system command");
|
||||||
@@ -1344,8 +1341,9 @@ bool System::get_value_info(JsonObject root, const char * command) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
root.clear(); // empty json output, as it may have the default output from an info command earlier
|
||||||
|
|
||||||
if (!s.empty()) {
|
if (!s.empty()) {
|
||||||
root.clear();
|
|
||||||
if (val) {
|
if (val) {
|
||||||
root["api_data"] = s;
|
root["api_data"] = s;
|
||||||
} else {
|
} else {
|
||||||
@@ -1354,7 +1352,7 @@ bool System::get_value_info(JsonObject root, const char * command) {
|
|||||||
return true; // found
|
return true; // found
|
||||||
}
|
}
|
||||||
|
|
||||||
return EMSESP::return_not_found(root, "data", command); // not found
|
return false; // not found
|
||||||
}
|
}
|
||||||
|
|
||||||
// export status information including the device information
|
// export status information including the device information
|
||||||
|
|||||||
Reference in New Issue
Block a user