diff --git a/main/ZgatewayBT.ino b/main/ZgatewayBT.ino index 163d4bb..46ae804 100644 --- a/main/ZgatewayBT.ino +++ b/main/ZgatewayBT.ino @@ -1466,7 +1466,16 @@ JsonObject& process_scale_v1(JsonObject& BLEdata) { JsonObject& process_scale_v2(JsonObject& BLEdata) { const char* servicedata = BLEdata["servicedata"].as(); - double weight = (double)value_from_hex_data(servicedata, 22, 4, true) / 200; + double weight = 0; + if (servicedata[1] == '2') { //kg + weight = (double)value_from_hex_data(servicedata, 22, 4, true) / 200; + BLEdata.set("unit", "kg"); + } else if (servicedata[1] == '3') { //lbs + weight = (double)value_from_hex_data(servicedata, 22, 4, true) / 100; + BLEdata.set("unit", "lbs"); + } else { //unknown unit + BLEdata.set("unit", "unknown"); + } double impedance = (double)value_from_hex_data(servicedata, 18, 4, true); //Set Json values