[Release] Withings Integration (New Management)

I was not able to reproduce this error after adding a new user and new device to my account.

Overall, my migration was successful. It is very likely I goofed something up along the way as I ended up with duplicate code for the apps and drivers . I just deleted the older entries and all was well. No re-auth or additional setup needed. Thank you for sharing!

1 Like

The first time I just added your version via HPM because I rely heavily on this integration and didn't want to break what was otherwise working.

When that didn't work, I deleted everything (including the old version and users). Unfortunately, I'm still getting that message.

I tried installing without HPM and got the same result.

I can't replicate it either. I manually installed the apps and drivers from GitHub then unmatched it in HPM and was able to match the correct one in HPM.

Working fine for me even with adding new users.

I'm afraid I'm at a loss as to how to troubleshoot the error on my end, especially since I can't replicate it and some others can't either. I can confirm that the code shows the right parent-child relationship, so the code description doesn't lead me down a path that would fix the error. I wonder if contacting support as the error suggests would help...

Okay, I got to the bottom of this. I recalled some time last year I ran into a similar problem and the solution was to repair HPM.(see post 124 of [RELEASE] Xiaomi Aqara and Mijia Drivers with Device Presence - #124 by csteele) So, I did that and voilà, installed no problem after that.

4 Likes

So now I have a new mystery. Since going to bed last night and getting up this morning I've received three emails from Withings with "Impossible to reach your server" in the subject line. Here's a redacted version of the email:

The User Id checks out, and the first bit of info is my hub UID, but token info doesn't match anything I can find. So, I suspect that is where the problem lies. If I click on the link in the email I get this:

At the Withing's developer portal page I tested the registered URL and it gave me this error:

Odd thing is, everything is updating properly within the Hubitat app as far as I can tell and it's correctly passing on the state to node-RED. But, the developer site does say my user (me) will be removed from the app if this happens four consecutive times in 20 days.

Thoughts?

My guess is this is a relic from your previous install and it won’t matter if the notification gets removed by Withings. Anything to suggest that might be the case?

I suspected the same thing. So, as an experiment I deleted the app in the Withings developer portal, deleted everything from my hub and started over. I'm still getting Partner error: Host Unreachable on the Withings page, but otherwise it seems like it's working fine and I haven't received any additional emails. To be fair, I don't recall ever testing the registered URL under the old version so I can't say this is new.

The main thing that concerned me was on this page:

"If during a period of 20 days, there are more than 4 consecutive failures for a specific user the subscription for this user will be removed." I'll see how it plays out and let you know if anything interesting comes up.

On to a feature request note. When setting up the users there is a section about turning something on when getting into bed and turning it off when getting out of bed. Could we get an option to do the exact opposite. For example, turning on a night light getting out of bed, but turning it off getting into bed?

Thanks a ton for taking this project over. I use the presence attribute extensively with my node-red presence flows, so I very much appreciate your work. You're not the hero we deserve, but you're the hero we need. :wink:

1 Like

I understand your use case. But I believe Rule Machine or Simple Automations is more appropriate for this sort of thing. You wouldn't want the night light to turn on every time bed presence goes to 'not present', even during the middle of the day. You would want to limit the night light to being turned on only during cetaint times of day (when it's night). Otherwise your night light might turn on after someone or something gets off the bed during the day.

The point of having the switch as an output in the Withings app was simply to have a switch reflect the presence status, so that the switch can then be used in other apps (like Rule Machine) for automations. It's simple to set up a Rule Machine rule to turn the night light on and off based on the output switch's status. It would become a slippery slope as to what automations Withings should have built-in if rules like this were to be added. And this is the model that most apps adopt. Do you get my point?

3 Likes

I hadn't thought about using a switch to reflect presence but that makes a lot of sense. I always wondered why that option was in there. Your point about the slippery slope is more than valid.

Since I'm using node-red, I never use the rule machine so I didn't think about that either. I do have flows in node-red to turn on a nightlight; which has time gates and timers to control the when and how long aspects. There's just enough of a delay to make that solution less than ideal. In my use case I need the light to be as instant as possible. It's a long story, but the short version is my cat has severe asthma and I frequently have to wake up in the middle of the night to give him his rescue inhaler.

Anyway, I've been putting it off for the sake of consolidation, but if I'm being honest with myself, I've got automation scattered all over the place at this point. So, I suppose it's time to get my hands dirty with rule machine. :wink:

I truly appreciate the response and the effort you're putting into this project. As I mentioned earlier, I have a fairly complex presence detection scheme (see pic) and this component is one of the keys to its continued success.

Cheers!

1 Like

@JustinL nice job consolidating this automation -- thank you.

I reinstalled the new automation via HPM and created my two new users from scratch, so just everything was clean. When I did, I noticed a recurrence of an old problem--my scale shows up with the name "Null", even though when I look at the device with the Withings web portal, it has the correct name.

So I reached out to Withings support, and they're asking me what link I'm using to access the API? Do I just give them the API endpoint URL or is the answer specific to this app? TIA...

https://wbsapi.withings.net/v2/user
with action "getdevice"

Could probably figure it out if you put in this debug code:

def prefDevices() {
	app.updateLabel("${userName}")
	state.devices = getWithingsDevices()
       logDebug("Device Info: ${state.devices}")

Then press Done in the app and provide the log output

Thanks Justin -- here's the log output.

app:7192023-03-24 01:48:46.177 PMdebugnotify?action=subscribe -- [callbackurl:http://cloud.hubitat.com/api/redacted/apps/719/notification/heartrate?access_token=redacted, appli:4]
app:7192023-03-24 01:48:46.020 PMdebugNotification Received: [access_token:redacted, type:heartrate]
app:7192023-03-24 01:48:45.102 PMdebugnotify?action=subscribe -- [callbackurl:http://cloud.hubitat.com/api/redacted/apps/719/notification/heartrate?access_token=redacted, appli:4]
app:7192023-03-24 01:48:44.933 PMdebugNotification Received: [access_token:redacted, type:weight]
app:7192023-03-24 01:48:44.019 PMdebugnotify?action=subscribe -- [callbackurl:http://cloud.hubitat.com/api/redacted/apps/719/notification/weight?access_token=redacted, appli:1]
app:7192023-03-24 01:48:43.443 PMdebugnotify?action=revoke -- [callbackurl:http://cloud.hubitat.com/api/redacted/apps/714/notification/heartrate?access_token=redacted, appli:4]
app:7192023-03-24 01:48:42.886 PMdebugnotify?action=revoke -- [callbackurl:http://cloud.hubitat.com/api/redacted/apps/714/notification/weight?access_token=redacted, appli:1]
app:7192023-03-24 01:48:42.252 PMdebugnotify?action=list -- null
app:7192023-03-24 01:48:41.966 PMdebugUpdated with settings: [bloodPressure:[redacted], scales:[redacted], userName:Mark]
app:7192023-03-24 01:48:37.767 PMdebugv2/user?action=getdevice -- null

Hey @JustinL, don't mean to be a nag, but wondering if you saw my above response from a couple weeks ago? No rush -- appreciate the help!

I did but haven’t had a chance to look into it yet. I’m having trouble with my hub and am working to figure that out. I might have to buy a second hub….

yuck, been there. Good luck

@JustinL

So how do I install your app?
I attempted to follow an instruction but for the REGISTERED URL I am getting this:

Do the install via hubitat package manager. If you're sure all parts are installed, go into the driver and make sure oauth is enabled. HPM should automatically enable it and make sure the full package is installed.

I am all set. Thank you very much.

1 Like