[RELEASE] Withings Integration

Ok trying now ty

I unistalled and reinstalled and pressed the oauth button.

I still get the same error =(

I'm away from my hub right now so can't check it, but I recall you have to save the app after clicking the OAuth button. Pls try it. The app works fine so it seems the problem must be your setup. Once this is done, go back through the app menu flow again and reset your Withings connection etc.

ok will try!

Btw I am not suggesting it doesn't work. I had the same troubles trying the withings integration with home assistant. I think I mess up the account creation or something?

It won’t have anything to do with withings. That error is generated by hubitat when you don’t turn oauth on. I’d recommend you consider using HPM. It sets it up for you. [BETA] Hubitat Package Manager

Yeah maybe. I've had quite a few issues myself with this integration. I get regular timeouts reported by Withings by emails. I tried working with their support staff but they have no solution. They stated that they allow a 2 second delay only and then they do retry again a few seconds later with a 5 second timeout but even so I still had quite a few failures. I think this is because my HE hub tends to be slow quite often and I'm in Thailand with the great Smooth as Silk Internet Wall in the way. In the end I've set up a rather convoluted approach using Node-RED and a Telegram bot to get the presence signal directly from Withings to Hubitat instead of using this app and it now works reliably at last.

None of the things you describe are related to HE saying OAuth is not enabled. That would have nothing to do with his Withings account, it's an HE setting.

Correct. I was just sharing my experience with the integration in general.

1 Like

I noticed that my Withings integration was no longer working, not sure when it happened. I thought it was the authorization, so I tried to authorize it again through the app. Now I get an error - "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data" Is anyone else seeing this issue?

Working for me. What devices do you have? I suspect your token expired some how. Try reloading in to withings in the integration.

I have a watch, scale and sleep device. I launch the app (Withings Integration), then click on User, That takes me to the "Intgration Page" with my email. I then click next and I am on Withings Account Authorization. Click on that and a window appears to login to Withings. I log in and it asks to select a user, I pick me, and I am on the Integration Page.


Click on "Allow this app" and I get....

What browser is that? Looks like Firefox, but why is there a tab called "JSON"? Are you in a developer tool or something? That page is not JSON, it's HTML, so that would explain why you're getting a JSON syntax error. What exactly is rendering that JSON/Raw Data/Headers tab section? It's not my integration and my Chrome doesn't show that. Nor does Firefox. Curious, what shows up if you switch to Raw Data and Headers? The content type is text/html so I don't know why it would think it's JSON.

Yes, that is FireFox, but I have no idea what you mean by the developer tool, I am using the normal product I have been using for years. I am on a MAC if that helps. I tried it with Safari, different error but still does not work.

Do you have anything in place (firewall wise) that would be preventing your hub from talking to the internet? That looks like a communication error between your hub and the hubitat cloud.

@dman2306, thanks for this awesome work.

I had an issue that I was able to track down, wanted to share the fix with you. Short version is that I have the (new'ish) Withings Scanwatch. Apparently the API does not return a 'model' for the Scanwatch. Because device.model was null, the prefDevices page in the Withings User app would fail.

I fixed this up by slightly tweaking getWithingsDevices(). Unfortunately I'm not smart enough to figure git out, so here's the closest I can get to formally submitting a fix for this issue:

else if (device.type == 'Activity Tracker') {
if (device.model != null) {
activityTrackers[device.deviceid] = device.model
} else {
activityTrackers[device.deviceid] = 'Undefined Activity Tracker'
}
}

Looking forward to kicking the tires on this integration as I have all 5 devices types. Thanks for your work on this.

@dman2306, are you still maintaing this intergration? I'm having some trouble with 3 of the 5 device types.

Yes. I just have been busy lately. Can you provide details on what isn’t working? I only own a scale and sleep pad personally so those are the only ones I have tested myself.

What are you using the scale integration for? I integrated mine, but can't really find a use for it in hubitat.

1 Like
IF (this week’s weight > last week’s weight)
THEN
Turn on siren, lock fridge door
END-IF
7 Likes

Download the Hubitat app