diff --git a/src/lib/ebus/data.cpp b/src/lib/ebus/data.cpp index ddcf9238..5e5dfc3e 100644 --- a/src/lib/ebus/data.cpp +++ b/src/lib/ebus/data.cpp @@ -211,7 +211,11 @@ result_t DataField::create(vector::iterator& it, while (getline(stream, token, VALUE_SEPARATOR) != 0) { const char* str = token.c_str(); char* strEnd = NULL; - unsigned int id = strtoul(str, &strEnd, 10); + unsigned int id; + if (strncasecmp(str, "0x", 2) == 0) + id = strtoul(str+2, &strEnd, 16); // hexadecimal + else + id = strtoul(str, &strEnd, 10); // decimal if (strEnd == NULL || strEnd == str || *strEnd != '=') { result = RESULT_ERR_INVALID_LIST; break; diff --git a/src/lib/ebus/test/test_data.cpp b/src/lib/ebus/test/test_data.cpp index 3ddd4f9b..08faf8d3 100644 --- a/src/lib/ebus/test/test_data.cpp +++ b/src/lib/ebus/test/test_data.cpp @@ -185,7 +185,7 @@ int main() {"x,,bi3:2,0=off;1=on;2=auto;3=eco","auto", "10feffff0110", "00", ""}, {"x,,bi3:2,0=off;1=on","on", "10feffff0108", "00", ""}, {"x,,bi3:2,0=off;1=on","off","10feffff0100", "00", ""}, - {"x,,uch,1=test;2=high;3=off;4=on","on","10feffff0104", "00", ""}, + {"x,,uch,1=test;2=high;3=off;0x10=on","on","10feffff0110", "00", ""}, {"x,s,uch","3","1050ffff00", "0103", ""}, {"x,,d2b,,°C,Aussentemperatur","x=18.004 °C [Aussentemperatur]","10fe0700090112", "00", "v"}, {"x,,bti,,,,y,,bda,,,,z,,bdy", "21:04:58;26.10.2014;Sun","10fe0700085804212610061406", "00", ""}, // combination