From 715f86b717531e09f1b7ddb2264747625bd5f9e3 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Thu, 26 Sep 2024 15:51:24 +0200 Subject: [PATCH] fix get attribute for second thermostat #2052 --- interface/package.json | 2 +- interface/yarn.lock | 10 +++++----- src/emsdevice.cpp | 9 ++++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/interface/package.json b/interface/package.json index 05a5b9b9f..4ecda7380 100644 --- a/interface/package.json +++ b/interface/package.json @@ -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", diff --git a/interface/yarn.lock b/interface/yarn.lock index 064c0596c..2ac4eb759 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -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" diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index 213f52ac3..c4909c314 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -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