[No Longer Maintained] Withings Integration

It seems to be working fine.
Thank you so much! :pray:

1 Like

@dman2306
I am on day six of my token! Previously, I was having to re-auth every 2 1/2 to 3 days, so it appears whatever tweak you did, worked.

I've added the hydration and hydrationDisplay attributes to the scale driver and hydrationDisplay to the converter section of the user app. Would it be possible, down the road sometime, to include these ? I can try to submit a PR (I've never done one) if you'd like.

Thanks again for this integration!

3 Likes

This is a great integration, thank you for the work you have put in! I just got our Sleep Analyzers installed today.

It is my understanding that they can detect the difference between an occupant being awake and an occupant sleeping. Do you know if there is a way to capture that information in a manner similar to the switch on/off function?

In our use case, laying in bed may mean laying in bed and reading, or my wife working on her laptop, etc. If I could detect the difference between that and actual sleeping, I could trigger some additional late night automations that we use.

Thoughts?

3 Likes

There isn't though I agree it would be VERY useful. I would love something like "turn off my TV when I fall asleep." Unfortunately, it doesn't exist. I submitted this feature request 7 months ago, https://support.withings.com/hc/en-us/community/posts/360011604297-API-and-IFTTT-notifications-for-fell-asleep-and-woke-up- as you can see, they have ignored it. Wouldn't hurt if you up voted it, but I'm sure it won't actually amount to anything :frowning:

4 Likes

Ironic; I came here this morning looking for the Withings thread to specifically mention that I haven't had to reauth recently. As I mentioned earlier in the thread, I was having to do so every handful (I was guesstimating 5 but hadn't actively tracked it) days.

So, seconded -- the Withings authentication appears to be stable.

1 Like

That's a bummer, because I really like the Withings ecosystem (at least, pre- and post-Nokia). I do get the impression they might be short-staffed; their Android app always seems like a bit of a mess.

My wife, neighbors, and local wildlife would surely appreciate being able to use my snoring episodes as a trigger. :laughing:

I read, that because of customer's concerns of EMF radiation the Withings watches shut down Bluetooth once they deem you are asleep. I wonder if that policy also applies to the sleep sensors, as I see no communication in my router logs between bed in/bed out. Personally, I don't think having a Wi-Fi connected pad under my mattress is any worse than having my phone and Echo Show less than two feet from my head while I sleep.

2 Likes

I'm relatively new to Hubitat, having only had my hub for a couple of months. It came in at the end of September while I was on an emergency trip for work, where, coincidentally I picked up COVID. I was hospitalized for the first half of October, and didn't really start messing with replacing my SmartThings Hubv2 system until mid-November... I have since caught the HA bug again, which had petered out for me for the last two years or so since the system mostly worked.

This integration is the primary reason I am gung ho on my HA setup again, and let me tell you why.

I've been wanting to find a way to truly automate certain aspects of the house. I don't want to tell Alexa to "Turn off the whole house". I want the whole house to just turn off when I get into bed and go to sleep. When I get out of bed in the middle of the night (I'm getting older, this is happening more frequently...), I want the house to just respond so I can go do my business without being assaulted by photons, but have just enough to see by. I want the house to be smart enough to recognize when either my wife or myself, or both of us are in bed, when one or both of us get up, etc.

So, here's where I'm at today.

I picked up two WiThings Sleep Analyzers, and configured them in my account. I assigned one to my wife by sharing it with her in the app. I followed the steps as listed, and integration went smoothly with OAuth and the like, and have enabled the switch function. I created two virtual switches, one for my wife and one for me, and tied them into each of our units respectively.

Now the house responds intelligently to us.

When someone gets into bed, the WiThings Sleep virtual switch turns on.
When they get up, the switch turns off.

Some logic on the back end, and now the house goes into "Night" mode when one of us goes and lays in bed. This sets automatic night light rules so that any motion controlled lighting in the house will fade on to 30% brightness over 3 seconds when motion is detected, and fade off when motion ends.

When both of us go to bed, both switches are now on. House goes into Sleep mode. All lighting automations are disabled to prevent the pets from turning lights on, the door/window sensors are monitored for activity and the house enables alerts via the Echo units in the event one of these is triggered.

If one of us gets up in the middle of the night, the virtual switch turns off for one of us and the house switches back to night mode and turns on a light at 10% in the bedroom if it is after 10PM and before 6AM, re-enables automations such as night light mode for the hallway, kitchen, and living room, disables alerts on sensors for the front and back doors so the dogs can be let out/in.
Get back into bed, and Sleep mode kicks in again.

If both of us get up, the house goes back to Day mode. All automations are present, lights come on full when motion detected, etc.

If it is after 5AM and my wife gets out of bed and the system detects motion in the hallway, the forecast and quick news briefing that she likes plays on the Ecobee 4 in the hallway across from the bathroom door. My settings are near identical, though I plan to add a 3/4 minute delay to this and schedule it to play in my home office instead.

This is just a small taste of the magic I have discovered again. Thank you for such a great integration.

4 Likes

Hi there,

This morning I noticed the lights came on when I was in bed and then I saw the token must have expired again (after just over 30 days) - not sure if it’s only me, but thought it was worth flagging.

Cheers
Guy

I'm not sure that tokens are expiring for no reason. What I do know in my setup is that Withings has a 2 second timeout for responses to their server (their support confirmed this to me). Since I'm in Thailand behind the Great Silk Curtain and, in addition, my HE hub performance can sometimes suck quite hard, I'm often getting an email notification that Withings was unable to achieve the desired response. After a couple of these they (stupidly) appear to disconnect the connection (yeah, thanks Withings) and it has to be reauthorised. Apparently they do try an additional connection after a few seconds but it's not unusual with my setup for that also to fail hence the disconnections. It's a righteous pain in the *SS.

Ahhh actually that's a good point - I had problems with the DNS bug as part of the new firmware so perhaps that caused the timeout. Will monitor and see if it drops out again!

Bummed that they have not exposed the "is this user actually asleep," portion of the API. I wonder if I could tie in my WearOS device? I'm pretty sure I can use Sleep as Android to handle that.

Hey there,

I have a quick noob question, concerning the sleep pad integration. I'm considering getting one for some automations, when I fall asleep. Question is: Is it possible, using the recognition of the pad, that I fell asleep, to trigger automations?
I was thinking about stuff like: Sleeping triggers TV and lights to turn off for example.

Hi there,

This integration has been working great for a number of weeks since the last few tweaks, I noticed that WitThings are depreciating Tokens and moving to OAuth 2.0, will this affect this integration please?

Cheers
Guy

Yes it will and I am aware. The change doesn't go into effect for 5 months though so there is plenty of time.

4 Likes

Great - thanks for the update!

Just setup my first automation with the activity monitor.
Which has lead me to notice that moderate activity is always 0 and moderate activity is added to intense activity when compared to the app.

Can anybody else confirm this?

I hadn't checked my actual iOS Health Mate app in a while. Today, I did. I thought there was a problem with the integration because the sleep scores in HE did not match the sleep scores in the iOS Health Mate app. But, apparently, the sleep scores on the iOS Health Mate app even differ from the sleep scores on the web version of the Health Mate app. Seems Withings can't make up their mind about how my sleep should be scored. I kind of like the iOS app better - higher scores :slight_smile:

Anyway, my presence seems to be stuck despite my sleep score updating. Any idea what's up with that? I haven't re-synced because it's obviously syncing in some respects, and I'd prefer not to have to re-add the device to all my automations/rules if I don't have to.

A very quick peak at the code for this integration suggests the integration does not support multiple sleep devices registered with the same withings account (under different profiles). Am I correct? That would be a useful thing to have. But if it's complicated to add, no worries, I can set up a separate account for each sleep device.

I haven't tried it, but what makes you say that? I didn't code it with that intention as far as I recall.