[No Longer Maintained] Withings Integration

Hmm I will need to do some research but to fix it, just go through the OAuth process within the integration again. It is saying the refresh token expired. I have code to renew the token but clearly something didn't work right. I have a thought but will need to do some homework.

1 Like

Hi there,

That seems to have done the trick - data flowing through now after going through the token process again.

Let me know if there’s any other info I can provide to help.

Best wishes
Guy

I've found that every few days I need to re-authorize to Withings. Maybe every 5 days or so?

Yes, it works! I now have bodyTemperature:98 on my Thermo device. Would it be possible to record it at 97.6 or 98.0 rather than rounding it off?

Thanks a ton.

I just pushed an update to round to 1 decimal. Also I made a small change that might help with the reauth, it defnitely should NOT be every 5 days, according to their docs the refresh token is valid for a year which is why I find the whole thing confusing, though I've experienced it myself too.

I have a similar issue on just one of my sleep pads where it drops time by time and I have to re-authorize. Such a pain. What I've also found is that when I do that, the device in HE gets deleted and a new one created which messes up my dashboard (I have to delete the tile and re-add the new device). I was surprised that the app didn't retain the existing device when re-authenticating.

You're running an old version of the code, that bug was already fixed.

Ah ok. I deliberately didn't update because I added code (mentioned way above) to include switches for presence (for the reasons I mentioned way above too) and an update overwrites my changes. Will update and reapply my switch code then.

Cheers.

1 Like

Hmm -- getting this:

app:8342021-01-05 08:08:17.282 pm errorgroovy.lang.MissingMethodException: No signature of method: java.math.BigDecimal.round() is applicable for argument types: (java.lang.Integer) values: [1] Possible solutions: round(java.math.MathContext), find(), pow(int), mod(java.lang.Number), and(java.lang.Number), find(groovy.lang.Closure) on line 115 (asyncWithingsNotificationHandler)

app:8342021-01-05 08:08:17.132 pm debugTemp: 368219985 Unit: -7 Result: 36.8219985

app:8342021-01-05 08:08:16.496 pm debugmeasure?action=getmeas -- [startdate:1609895193, enddate:1609895194, category:1]

Or maybe... @dman2306 pretty please... You could consider adding my small additions (post #36) into your core code?.... (ok, cheeky I know)... But it would mean I don't have to keep ignoring update requests across HPM because I can't snooze reminders for updates on this app which I don't want to update and then keep losing my changes....

I hate not being able to test locally but I can't justify buying such an expensive thermometer I'll never use! Can you try again?

It seems like you have it working, are you able to submit a pull request so I could just merge in your code?

I don't have git account to be honest...(I'm not a real developer lol). Ok maybe it's time I set one up :smiley:

Bingo! 98.2!

Thanks a ton.

1 Like

Just merged it into the main branch. @Angus_M I had a long day at work so I'm a bit tired but I'll look at adding in the switches tomorrow. If you don't hear from me by the weekend, feel free to remind me as I likely forgot :slight_smile:

1 Like

Ah, no problem/rush. It's much appreciated. It's only a few lines of code as per my post above so hopefully not too much trouble. Cheers.

Gentle reminder @dman2306 :grinning:

Just about done, I had to refactor it a bit so it took a bit longer. While what you had worked, it was kind of designed for your use case and not generic. Meaning it wouldn't hide the switch setting if they have no sleep sensors, didn't properly handle if you don't want a switch set, etc.

1 Like

No problem. Thank you very much for doing this. Much appreciated!

Just published the update, let me know how it goes!

2 Likes