vangorra / python_withings_api

Library for the Withings Health API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Withings integration in HA broke

Bluhme1 opened this issue · comments

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.

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

Hello,

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

Please help :(

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 !

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...!

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

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)

@ArjanM83 THANK U <<<333

commented

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

@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!