python_withings_api icon indicating copy to clipboard operation
python_withings_api copied to clipboard

Withings integration in HA broke

Open Bluhme1 opened this issue 4 years ago • 9 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.

Bluhme1 avatar Apr 13 '21 05:04 Bluhme1

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

myplatox avatar Jul 10 '21 09:07 myplatox

Hello,

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

Please help :(

Sebwap avatar Aug 19 '21 20:08 Sebwap

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 !

Sebwap avatar Aug 21 '21 19:08 Sebwap

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

myplatox avatar Aug 23 '21 15:08 myplatox

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

Sebwap avatar Aug 23 '21 16:08 Sebwap

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 avatar Feb 04 '22 14:02 ArjanM83

@ArjanM83 THANK U <<<333

jwstc99 avatar Mar 29 '22 00:03 jwstc99

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

Xlinx64 avatar Mar 29 '22 08:03 Xlinx64

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

jwstc99 avatar Mar 29 '22 13:03 jwstc99