vangorra / python_withings_api

Library for the Withings Health API
MIT License
101 stars 34 forks source link

Withings integration in HA broke #68

Open Bluhme1 opened 3 years ago

Bluhme1 commented 3 years ago

Hi Robert Are you still developing this Integration. Since 2021.3.0 we (approximately 300 users) have had issues. We now get sleep data in nicely thanks to @ronaldheft . But no data from scale, blood pressure and others.

myplatox commented 3 years ago

Same here, i can query my devices (scale) but no measures/weight data.

Sebwap commented 3 years ago

Hello,

Same here. Any request to measure_get_meas return an empty result. Oauth is ok since my device is visible.

Please help :(

Sebwap commented 3 years ago

Finally got a workaround by myself: problem is located in withings_api__init__.py file: in measure_get_meas function, line 152, a default value is added for parameter "lastupdate" and is set to now. As you can't have a measure after this date, it's impossible to obtain a return. I just comment out theses lignes

` #update_params(

params, "lastupdate", lastupdate, lambda val: arrow.get(val).int_timestamp

    #)`

and everything work !

myplatox commented 3 years ago

Thanks for your help @Sebwap it really work out that way. but i have to use the start/enddate with smth like this meas_result = api.measure_get_meas(startdate=arrow.utcnow().shift(days=-21), enddate=arrow.utcnow())

But anyway...!

Sebwap commented 3 years ago

Yes it's mandatory to use either start/enddate either lastupdate. You can't simply obtain last value with no parameter.

ArjanM83 commented 2 years ago

Thank you @Sebwap for pointing out this issue. I have resolved this in my code without commenting out the line, but instead now I also provide a value for the lastupdate:

measure_get_meas(startdate=datetime.datetime.utcnow().date(), lastupdate=None)

jwstc99 commented 2 years ago

@ArjanM83 THANK U <<<333

Xlinx64 commented 2 years ago

Is this a permanent fix? Can we do a PR on this and bump the version of the api in home assistant?

jwstc99 commented 2 years ago

@Xlinx64 I cant confirm this is a permanent fix, but it worked for me. Looks like what they said above is true, startdate and enddate are mutually exclusive with lastupdate. However they all are given default value, so if you use startdate and enddate, you must set lastupdate to None, and vice versa, if you use lastupdate, then you must set startdate and enddate to None. Hope this helps you!