Bug when leaving your socks on :)
Closed this issue ยท 8 comments
Device: Scale-X
I noticed that when I weigh myself barefoot the Wyze API response includes fields like 'bmr', 'body_fat', 'body_vfr', 'body_water', 'bone_mineral'. When I weigh myself with socks on, it's unable to do the test to get those values and it excludes them from the response. It looks like wyze_garmin_sync is always expecting (some or all of) those nodes and returns a TypeError when they aren't present.
Example:
Traceback (most recent call last):
File "/wyze_garmin_sync/scale.py", line 47, in
percent_fat=float(scale.latest_records[0].body_fat),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'
Can't make that up.... easy bug fixe remove your socks.
I ll check into it to the the value in the fit file only if it exist.
@ksarnelli Could you please put back your socks on and give it a try again, the new docker has the code to avoid the issue of none values.
I saved a pair of socks just for this occasion!
Looks like there is still a line that relies on the 'bmr' value:
Traceback (most recent call last):
File "/wyze_garmin_sync/scale.py", line 153, in
main()
File "/wyze_garmin_sync/scale.py", line 112, in main
generate_fit_file(scale)
File "/wyze_garmin_sync/scale.py", line 66, in generate_fit_file
'active_met': int(float(scale.latest_records[0].bmr) * 1.25),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'
@ksarnelli lets try it one more time :)
File "/wyze_garmin_sync/scale.py", line 77
if data.get('basal_met') = None:
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
doh!
@ksarnelli Ok my bad, I updated and the new image is available. That should be good.
Works great now, thanks! ๐งฆ๐งฆ๐งฆ
Great next one might be weighting doing a head stand :)