Closed cristian5th closed 6 years ago
I don't think the issue is in the code, but rather the measurement fom Nokia. Which scale do you have?
What output does
python3 nokia-weight-sync last
give you?
Ha, ha. You are right. It gives me the heart pulse:
2018-03-06T05:18:11+00:00
Weight: None
Height: None
Fat free mass: None
Fat ratio: None
Fat mass weight: None
Diastolic blood pressure: None
Systolic blood pressure: None
Heart pulse: 65
Config file saved to config.ini
I have a Smart Body Analyzer from the date before Nokia purchased Withings. There should be weight, Fat and Heart pulse. Is there a variable I can print to see all the brute data? Maybe it is stored differently.
Ah good, we're getting closer. My guess is that it's part of another (earlier) measurement group. So dumping the raw data of the last group won't provide it. I'll look into fetching a previous group if the last one has an empty weight.
My scale does only weight. I had initially assumed that Nokia would combine weight and all the other measurement types (like BPM) into a single group. But that is not the case for yours.
I added a simple command to test whether I'm thinking in the right direction of iterating over previous measurements. Can you pull the updated code and test:
python3 nokia-weight-sync.py lastn 10
And see whether you see your weight in any of the groups displayed? Also does it combine the Fat measurements at least with the Weight in the same group? At which group number do you see this?
I just hope the measurement history isn't spammed by heart rate. If it is you could try increasing n (10 in the example), till you see the weight.
Hello @magnific0
Sorry for my delay.
It seems that the Heart pulse is stored in a group for himself and all the rest of the data in a different group:
--Group 0
2018-03-06T05:18:11+00:00
Weight: None
Height: None
Fat free mass: None
Fat ratio: None
Fat mass weight: None
Diastolic blood pressure: None
Systolic blood pressure: None
Heart pulse: 65
--Group 1
2018-03-06T05:18:11+00:00
Weight: 90.159
Height: None
Fat free mass: 70.82900000000001
Fat ratio: 21.44
Fat mass weight: 19.330000000000002
Diastolic blood pressure: None
Systolic blood pressure: None
Heart pulse: None
--Group 2
2018-01-20T08:23:40+00:00
Weight: None
Height: None
Fat free mass: None
Fat ratio: None
Fat mass weight: None
Diastolic blood pressure: None
Systolic blood pressure: None
Heart pulse: 83
--Group 3
2018-01-20T08:23:40+00:00
Weight: 87.621
Height: None
Fat free mass: 68.285
Fat ratio: 22.068
Fat mass weight: 19.336000000000002
Diastolic blood pressure: None
Systolic blood pressure: None
Heart pulse: None
Best regards.
Thanks! That confirms the suspicions. I have updated the code and also tested, by manually adding a HR on Nokia Health Mate. It now looks within the last 5 measurement groups for the last weight measurement. I'm curious to hear how it works for you.
Correct! It all works fine now. Last weight from Nokia Health is correctly read and the weight is correctly stored into Garmin. It is even stored for the day the weight has been recorded and not the day the sync is performed, so it is better than great.
Now, I only need to attach this script to a cron task and all will be set.
Thank you very much for your huge work.
Regards.
Glad to hear. Yes that feature was important to me too. Perhaps I should consider adding a feature for syncing a history of weight data. It just never occurred to me me as I only got the scale a few weeks back.
Good luck with the remaining set-up!
Hello @magnific0
When I try to sync the data between Nokia and Garmin I always get the same result:
python3 nokia-weight-sync.py sync garmin
Last weight from Nokia Health: None kg taken at 2018-03-06T05:18:11+00:00
Garmin Connect User Name: myusername
Weight has been successfully updated to Garmin!
Config file saved to config.ini
Date and time of the last measurement is correct but the value is always "None". Then, when I go to Garmin Connect, there is no new weight there but I believe this is normal.
I tried to look for clues in the code but I couldn't.
Best regards.