diff --git a/src/analogsensor.cpp b/src/analogsensor.cpp index d7d2ad3fd..09ac15728 100644 --- a/src/analogsensor.cpp +++ b/src/analogsensor.cpp @@ -580,7 +580,7 @@ bool AnalogSensor::get_value_info(JsonObject & output, const char * cmd, const i } for (const auto & sensor : sensors_) { - if (strcmp(command_s, sensor.name().c_str()) == 0 || Helpers::atoint(command_s) == sensor.gpio()) { + if (Helpers::toLower(command_s) == Helpers::toLower(sensor.name().c_str()) || Helpers::atoint(command_s) == sensor.gpio()) { output["gpio"] = sensor.gpio(); output["name"] = sensor.name(); output["type"] = F_(number); diff --git a/src/command.cpp b/src/command.cpp index edcc19c17..26123341f 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -158,15 +158,22 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec data_p = device_end + 1; int8_t id_d = -1; data_p = parse_command_string(data_p, id_d); - char data_s[50]; - strcpy(data_s, data_p); - strcat(data_s, "/value"); - uint8_t device_type = EMSdevice::device_name_2_device_type(device_p); - if (CommandRet::OK == Command::call(device_type, data_s, "", true, id_d, output)) { - if (output.containsKey("api_data")) { - data = output["api_data"]; - } + if (data_p == nullptr) { + return CommandRet::INVALID; } + char data_s[40]; + strlcpy(data_s, Helpers::toLower(data_p).c_str(), 30); + if (strstr(data_s, "/value") == nullptr) { + strcat(data_s, "/value"); + } + uint8_t device_type = EMSdevice::device_name_2_device_type(device_p); + if (CommandRet::OK != Command::call(device_type, data_s, "", true, id_d, output)) { + return CommandRet::INVALID; + } + if (!output.containsKey("api_data")) { + return CommandRet::INVALID; + } + data = output["api_data"]; output.clear(); } } diff --git a/src/dallassensor.cpp b/src/dallassensor.cpp index 48114a80f..4e3815c83 100644 --- a/src/dallassensor.cpp +++ b/src/dallassensor.cpp @@ -404,7 +404,7 @@ bool DallasSensor::get_value_info(JsonObject & output, const char * cmd, const i } for (const auto & sensor : sensors_) { - if (strcmp(command_s, sensor.name().c_str()) == 0 || strcmp(command_s, sensor.id().c_str()) == 0) { + if (Helpers::toLower(command_s) == Helpers::toLower(sensor.name().c_str()) || Helpers::toLower(command_s) == Helpers::toLower(sensor.id().c_str())) { output["id"] = sensor.id(); output["name"] = sensor.name(); char val[10]; diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index b3797bb0a..5302d3f37 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -1341,7 +1341,7 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 // search device value with this tag for (auto & dv : devicevalues_) { - if (!strcmp(command_s, dv.short_name) && (tag <= 0 || tag == dv.tag)) { + if (Helpers::toLower(command_s) == Helpers::toLower(dv.short_name) && (tag <= 0 || tag == dv.tag)) { uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (dv.uom == DeviceValueUOM::DEGREES) ? 2 : (dv.uom == DeviceValueUOM::DEGREES_R) ? 1 : 0; const char * type = "type";