fix get attribute for second thermostat #2052

This commit is contained in:
MichaelDvP
2024-09-26 15:51:24 +02:00
parent ccd6b132cc
commit 715f86b717
3 changed files with 12 additions and 9 deletions

View File

@@ -47,7 +47,7 @@
"@preact/preset-vite": "^2.9.1",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/formidable": "^3",
"@types/node": "^22.7.0",
"@types/node": "^22.7.2",
"@types/react": "^18.3.9",
"@types/react-dom": "^18.3.0",
"@types/react-router-dom": "^5.3.3",

View File

@@ -1446,12 +1446,12 @@ __metadata:
languageName: node
linkType: hard
"@types/node@npm:^22.7.0":
version: 22.7.0
resolution: "@types/node@npm:22.7.0"
"@types/node@npm:^22.7.2":
version: 22.7.2
resolution: "@types/node@npm:22.7.2"
dependencies:
undici-types: "npm:~6.19.2"
checksum: 10c0/127b1ac3eebe8c2b09e3d2de277ee906710c4908b4573cde23b9c7cec1cb1aaf1af8bdabbccdac08d005f820b770e7447b22c8eb56ca63344f4d2e26bcdc29fb
checksum: 10c0/987e4df034e4af0ce76b938c2c0d94373da376b228f1c93081a661c77e682795c599bcad47c93c70a25b8ea443587137cf23088fb7f62ef442955f13046eae3d
languageName: node
linkType: hard
@@ -1678,7 +1678,7 @@ __metadata:
"@table-library/react-table-library": "npm:4.1.7"
"@trivago/prettier-plugin-sort-imports": "npm:^4.3.0"
"@types/formidable": "npm:^3"
"@types/node": "npm:^22.7.0"
"@types/node": "npm:^22.7.2"
"@types/react": "npm:^18.3.9"
"@types/react-dom": "npm:^18.3.0"
"@types/react-router-dom": "npm:^5.3.3"

View File

@@ -1460,12 +1460,15 @@ bool EMSdevice::get_value_info(JsonObject output, const char * cmd, const int8_t
}
// search device value with this tag
const char * attribute_s = Command::get_attribute(cmd);
// make a copy of cmd and split attribute (leave cmd untouched for other devices)
char cmd_s[COMMAND_MAX_LENGTH];
strlcpy(cmd_s, cmd, sizeof(cmd_s));
const char * attribute_s = Command::get_attribute(cmd_s);
for (auto & dv : devicevalues_) {
if (cmd == Helpers::toLower(dv.short_name) && (tag <= 0 || tag == dv.tag)) {
if (cmd_s == Helpers::toLower(dv.short_name) && (tag <= 0 || tag == dv.tag)) {
get_value_json(output, dv);
// if we're filtering on an attribute, go find it
return Command::set_attribute(output, cmd, attribute_s);
return Command::set_attribute(output, cmd_s, attribute_s);
}
}
return false; // not found, but don't return a message error yet