Closed dinki closed 6 years ago
You can now take the latest openScale dev version, go to settings, about and enable debug log. Then connect to the scale with openScale and weight yourself. Write down the numbers seen on the scale and provide them together with the log from openScale in this issue.
Might be easier than getting Bluetooth snoop logs from the original app (even if we'll still need them later to reverse engineer the data sent to the scale).
@erijo This certainly does seem easier. My scale only shows the weight on it's display. Don't you need to know body fat/bone density/etc? How will I get those? Do I do the debug in OpenScale then weigh again and grab the numbers from the scale's app?
Yes, that can work. The numbers shouldn't differ too much between measurements.
I have some bad news @dinki. Unfortunately it seems like the scale doesn't provide us with fat, water, etc., but only with weight and an impedance reading. This is then converted by the app to fat, water, etc. and reverse engineer that will be a challenge as it's done by a native (i.e. not java) library in the app.
@erijo I am a bit confused do we talk about two different scale devices? I thought @ec1coud have been already done the reverse engineer part for the other measurements like described in his notes?
@oliexdev It looks like @dinki has a scale with the device name "Health Scale" and @itsmegb, @simon6162 and I guess @ec1oud has one with the device name "Electronic Scale".
The former seems to only send the impedance value which is then converted to body fat etc. by a library from holtek.com (libBodyfat). Which by the way seems to be the same library as is used in the Mi app. The latter on the other hand seems to send all values.
@dinki: it would be good if you could download the latest dev version, start it and go to settings -> about and enable debug log. Then go to settings -> bluetooth and search for your device and click on it once found. Then do a measurement in openScale. Directly afterwards do the measurement in the original app and post all the values here together with the log from openScale. I'm interesting in seeing how the impedance values map to body fat etc.
@simon6162: if you could do the same that would be great.
Will do. Btw the label on the bottom of my scales has no fcc number or model number
On Wed, 25 Apr 2018, 19:50 Erik Johansson, notifications@github.com wrote:
@oliexdev https://github.com/oliexdev It looks like @dinki https://github.com/dinki has a scale with the device name "Health Scale" and @itsmegb https://github.com/itsmegb, @simon6162 https://github.com/simon6162 and I guess @ec1oud https://github.com/ec1oud has one with the device name "Electronic Scale".
The former seems to only send the impedance value which is then converted to body fat etc. by a library from holtek.com (libBodyfat). Which by the way seems to be the same library as is used in the Mi app. The latter on the other hand seems to send all values.
@dinki https://github.com/dinki: it would be good if you could download the latest dev version https://github.com/oliexdev/openScale/releases/tag/travis-dev-build, start it and go to settings -> about and enable debug log. Then go to settings -> bluetooth and search for your device and click on it once found. Then do a measurement in openScale. Directly afterwards do the measurement in the original app and post all the values here together with the log from openScale. I'm interesting in seeing how the impedance values map to body fat etc.
@simon6162 https://github.com/simon6162: if you could do the same that would be great.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/oliexdev/openScale/issues/159#issuecomment-384394910, or mute the thread https://github.com/notifications/unsubscribe-auth/AdUB7VvTs3Mlzgr1FTDlAM1f3L0HefYdks5tsMVhgaJpZM4Rngi2 .
@erijo Here's the info:
https://www.dropbox.com/s/n0r4eorhmy0lwti/openScale_2018-04-25_20-36.txt?dl=0 https://photos.app.goo.gl/3a0w73WaXoboMCtn1
Thanks for looking at this.
@dinki: can you also post your age, sex, height and activity level (as entered in the app)? They are all used in the calculations.
@erijo 46, male, 5'8", ordinary (lowest activity level)
@erijo was that the information you needed? Thanks
Yes it was.
I've been trying to reverse engineer the calculations done by the app, but the problem is that they are done by a native library (libBodyfat.so) and my assembler reading skills are not as good as they would need to be to decompile the formula.
I have a small native C++ program that can call the functions in the library and get e.g. the fat measurement. Perhaps the way forward would be to get an existing formula for fat calculation and try to compare the result for different input?
Is there any good formula available?
Is there any good formula available?
For general formula see https://www.biodyncorp.com/tools/450/calculations.html
Hi, i've the same scale with the infamous oem app.... i'm happy to post my data for help the reverse engineering. I'll be back ASAP.
Here my log + screen of official app. Thanks!
https://www.dropbox.com/s/h12txt9n07jmc78/test_openscale.zip?dl=0
@Condorello: can you also post your age, sex, height and activity level (as entered in the app) if they aren't included in the log already? They are all used in the calculations.
31, Male, 172cm, activity Amateur
Thanks again!
For reference, here are the values from @dinki (with impedance adjusted to get correct results):
// User
const double height = 172; // 5'8""
const int age = 46;
const int sex = 1; // 0 = female, 1 = male
const int peopleType = 0; // 0 = ordinary, 1 = amatuer, 2 = professional
// From measurement using original app
const double weight = 69.4; // ~153.0 lb
const double bodyWater = 53.9; // %
const double bodyFat = 21.4; // %
const double boneMass = 2.7; // ~6.0 lb
const double bmi = 23.5;
const double visceralFat = 12;
const double bmr = 1375;
const double muscle = 51.8; // ~114.4 lb
// From measurement using openScale (weight = 69.40)
const int impedance = 11839149 + 2;
And from @Condorello (had to change your age to 32 to get the same result as from the app, I assume your birthday is later this year and that the app isn't too smart when calculating the age):
// User
const double height = 172;
const int age = 32;
const int sex = 1; // 0 = female, 1 = male
const int peopleType = 1; // 0 = ordinary, 1 = amatuer, 2 = professional
// From measurement using original app
const double weight = 63.1;
const double bodyWater = 60.1; // %
const double bodyFat = 12.4; // %
const double boneMass = 2.7;
const double bmi = 21.3;
const double visceralFat = 5;
const double bmr = 1641;
const double muscle = 52.6;
// From measurement using openScale (weight = 63.10)
const int impedance = 472377 - 4;
Yep, 32 at the end of the year! I can add also a girl in the weekend so we can add a female data.
https://www.brianmac.co.uk/mobile//fatbia.htm
Here a formula for body fat from the resistance values... Maybe could be that One?
This is the BMR formula used by the app:
double bmr(int peopleType, int sex, double weight, double height, int age)
{
double typeFactor;
if (peopleType == 0) {
typeFactor = 1.32;
}
else if (peopleType == 1) {
typeFactor = 1.54;
}
else {
typeFactor = 1.98;
}
if (sex == 1) { // Male
return typeFactor * (11.3 * weight + 665 - 0.55 * height - 6.8 * age);
}
else {
return typeFactor * (7.73 * weight + 655 - 0.298 * height - 4.7 * age);
}
}
Hi, here a female data. 29, female, 164, Activity ordinary
I have that scale, will be happy to help since I don't like the vendor app
Same here. If you need some data just ask.
My scale shows up as "health scale", I'm happy to help if needed.
I have some logs and a screenshot for a 1byone scale described in this thread. https://klaashome.org/index.php/s/A7ob4pBJUc0gkSR
I can get measurements from my scale, but every measure I take it makes two or three entries in the app...
I can't connect to it. It says connected and then: lost connection
Please try the dev version and see if that works better @ulipo and @godinperson
Yep, it's the one I'm using
Ok. Please go to settings, about and enable debug log. Then try to connect to the scale and attach the log here afterwards.
@erijo I am also using the dev build, here I attached a log from one "double" measure, even if I don't see any relevant content...
[code] 2018-06-23 12:23:15.780 Debug AboutPreferences: Debug log enabled, openScale v1.8.1-dev_39737b52 (1529683770), SDK 25, OnePlus A0001 2018-06-23 12:23:23.936 Debug OpenScale: Disconnecting from bluetooth device [/code]
That looks really weird @ulipo. Could you try again, perhaps saving the log to a different location?
I tried several times to get a more detailed log, but probably I am doing it wrong... here is how I do:
Every time I get the same as reported in my previous post (except for the timestamps)
You need to swap step 2 and 3, ie enable debug log first.
You're (obviously) right! Here is the log! Also I got so lucky this time that the app got four measurements instead of one! openScale_2018-06-25_08-22.txt
I've also received this scale as a gift and I can help to test. There something that you need again like showed in the wiki or I simply try a beta-dev build? (play store beta program?)
Any progress on adding the other readings besides weight or is that a loss cause?
A measurement : Debug BluetoothCommunication$GattCallback: onCharacteristicChanged 00002a9c-0000-1000-8000-00805f9b34fb: 03 06 D0 07 02 04 0B 03 14 D4 0D 0C 26 00 00 46 43 E0 00 DE weight: 97,40, impedance: 14697286
On the official appli:
97.4 kg BMI 30.7 water 49% fat 28.6% bones 3.4kg visceral fat 11kg BMR 2147 kcal Muscles 66.1kg
If you need something else, please ask :)
Here is my log. My issue is it is connecting but it disconnect before getting the data openScale_2018-06-26_15-30 (1).txt
@godinperson: please try with the latest dev version.
@dinki: no real progress to report. I've been focusing on some other stuff lately.
@5thdev: what we need most is someone fluent in arm or x86 assembly ;)
Pretty sure I used the latest one, installed May 22nd, 1.8.1-dev_0444b9da (1527003541)
That version is a month old. Please download the latest from https://github.com/oliexdev/openScale/releases/tag/travis-dev-build
For the record, because I might not be the only one doing this mistake. On your link, it says: oliexdev released this on May 19. But we really need to look at the bottom where it says: Automatic openScale development build of master (c790ee6) built by Travis CI on 2018-06-24 20:11:58 UTC.
Thanks
Same issue with latest version openScale_2018-06-26_17-28.txt
In the newest version, if I go into bluetooth and select my scale, it fetches for information for a very long time.
OpenScale v1.8.1 (28) records two measurements instead of one, I tried several times with the same result. Here the bluetooth log: openScale_2018-06-28_19-13.txt
@erijo Same issue with newer version, here is the log openScale_2018-07-03_17-40.txt
That's strange @godinperson. I've added some more debug logs. Please try again with the latest dev version and attach the log.
Please try the latest dev version @5thdev, it should be fixed now.
@erijo Here! Thanks for your time! I really appreciate openScale_2018-07-03_19-24.txt
I'm writing in hopes that you can add 1byone BT scale (https://www.amazon.com/1byone-Bluetooth-Wireless-Bathroom-Visceral/dp/B01FHELB56/) to your list of supported devices. I received this as a gift from my wife but it is tied to a proprietary app that leaves much to be desired.
While I am much more of a hacker than a programmer, I am pretty sure that this is possible as someone has written some software that pulls the information from the scale:
https://github.com/ec1oud/qt-ble-weightscale
Further, I was able to use BT Snoop to pull the log where the scale connects and passes the information on to the phone. You can see the same type of information listed at the above repo here:
https://github.com/ec1oud/qt-ble-weightscale/blob/master/doc/notes.txt
Here's what it looks like:
I am certainly willing to do testing on this if someone can decrypt the handshake and add the functionality to openScale.
Let me know what you think!
Thanks