command executed only for commands without value, fix hcx custom names

This commit is contained in:
MichaelDvP
2024-07-26 17:59:49 +02:00
parent dd7cce508f
commit 1183db88b7
3 changed files with 27 additions and 12 deletions

View File

@@ -109,7 +109,9 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
// some commands may be prefixed with hc. dhw. or hc/ or dhw/ so extract these if they exist
// parse_command_string returns the extracted command
command_p = parse_command_string(command_p, id_n);
if (device_type > EMSdevice::DeviceType::BOILER) {
command_p = parse_command_string(command_p, id_n);
}
if (command_p == nullptr) {
// handle dead endpoints like api/system or api/boiler
// default to 'info' for SYSTEM, the other devices to 'values' for shortname version
@@ -159,7 +161,10 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
strlcpy(device_s, d, device_end - d + 1);
data_p = device_end + 1;
int8_t id_d = -1;
data_p = parse_command_string(data_p, id_d);
uint8_t device_type = EMSdevice::device_name_2_device_type(device_p);
if (device_type > EMSdevice::DeviceType::BOILER) {
data_p = parse_command_string(data_p, id_d);
}
if (data_p == nullptr) {
return CommandRet::INVALID;
}
@@ -170,7 +175,6 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
strcat(data_s, "/value");
}
uint8_t device_type = EMSdevice::device_name_2_device_type(device_p);
if (Command::call(device_type, data_s, "", true, id_d, output) != CommandRet::OK) {
return CommandRet::INVALID;
}