[OBSOLETE] Sleep Number SleepIQ SmartThings Integration

Big Shout Out to @Classic_Tim for making this possible. Everything worked without any issues. Was even able to get it to work with my Google Home/Assistant Voice Commands. So much better than having to use the Remote/App :joy::+1:t2:.

My Setup is:
FlexTop King iLE Sleep Number Bed
FlexFit2

I’ve got a flextop adjustable king, just installed this and it’s working as advertised.

I see a lot of people asking about being able to adjust the head/foot position by number, instead of just setting to “flat” or “favorite”.

I’m guessing the nuance here is that because this is being treated like a dimmer, you can’t give this device a number for different things (firmness and head position).

Not sure I’ll be successful, but one thought to address this was going to be to clone the SmartApp and Handler code you’ve written, and change the dimmer functionality to set head position instead of firmness. (I’ve been sniffing the app’s traffic, and I think I’ve found the API calls to set head position by value…)

Then I’d need to install these cloned apps/handlers, and set up 2 new devices. I could name them slightly different (“side” vs “bed”), and have the following setup:

“Alexa, set Scott’s bed to 50”. This would set the firmness to 50, as it’s tied to the original SmartApp.
“Alexa, set Scott’s side to 30”. This would set my head position to 30, as it’s tied to the cloned SmartApp.

Thoughts? It’s a hack, but would be worth the one time setup if it works…

I’m going to play around and see what I can break. :slight_smile:

1 Like

So it turns out my theory is possible. I was able to clone @Classic_Tim 's Smart App and Device handler and change what the dimmer setting controls, and now I have the following setup:

“Alexa, set Scott’s Firmness to 30”. This uses the original SmartApp and device handler, and I set the device’s name to “Scott’s Firmness”.

“Alexa, set Scott’s head to 30”. This uses a cloned SmartApp and device handler, and I set the device name to “Scott’s Head”.

(I also have the same setup for the other side of the bed. I have 4 total devices in SmartThings for my bed.)

@Classic_Tim, I threw my changes up quickly on Github here: https://github.com/scottconnor/SleepNumberManager/pull/1

I know you won’t actually want to merge this pull request in, because it will override your current code. I didn’t do anything revolutionary here, I copied your code and changed just a handful of lines. You are free to take what I did and find the best way (if you want) to merge this functionality back into your GitHub repo. You can also ignore this entirely if you want!

3 Likes

@Classic_Tim
Can you add the ability to enable/disable the privacy mode?

Hey @Classic_Tim so I have a i10 Sleep Number 360® Smart Bed, it has a foot warmer that I would love to control as well. I was wondering did you use Wireshark or some other sniffing tool to see the URL requests and went from there? Or is there a Sleep Number dev doc’s that you used?

Here’s the URL for the privacy mode toggle.

https://prod-api.sleepiq.sleepnumber.com/rest/bed/XXXXXXXXXXXXXX/pauseMode?mode=on&_k=XXXXXXXXX

@scottconnor can you share you code that you change for this app and device? Thanks

Here’s the code for FlexBase/SmartApp.groovy
https://raw.githubusercontent.com/scottconnor/SleepNumberManager/81e9f566e6a60d7bfab833d184556796a23c1ba7/FlexBase/SmartApp.groovy

And here’s the code for FlexBase/DeviceHandler.groovy
https://raw.githubusercontent.com/scottconnor/SleepNumberManager/e950941fa0097583df20664648a53d8a297911a5/FlexBase/DeviceHandler.groovy

1 Like

@scottconnor Thanks for sharing.

I have loaded both the smartapp and device handler, but once in the Smartthings app it will not allow me to “create new device.” Is there an update that will allow for follow through in order to utilize the Sleep Number Manager created by @Classic_Tim ?

Can this control the responsive air tech as well?

Is there a reason the present sensors doesn’t work in the new app? It works correctly in the old app. Are you still supporting this?

@Classic_Tim, thanks for the app! By now you are probably wishing you never started this thread, but hoping this is a quick fix. I have a top-split king with adjustable base, so foot moves together, head separately. There is an odd condition happening where if one side is “on” and the other side is “off”, and you turn one side “off”, the other side turns back “on” . It doesn’t move, it just indicates that is is “on”.

Note: My favorite bed position is ‘zero-gravity’, and because this is a top-split, joined foot, both sides go up together.

Recreate:

  1. Bed Right: Turn “on” or “Raise”. Results in zero gravity setting and both sides indicate “on”
  2. Bed Right: Turn “off”. Results in right side of bed flattening, as well as both sides for foot (expected). Bed Right indicates it is “off”. Bed Left indicates it is “on” (and the left side of bed is indeed still raised)
  3. Bed Left: Turn “off”. Results in left side of bed lowers to flat, but Bed Right device now shows as “on” – but remains flat. Now both sides of bed are flat, but Bed Right shows “on”
  4. Bed Right: Turn “off”. Nothing happens because bed is already flat, but Bed Left now shows “on”
  5. Repeat 3 & 4 indefinitely.


303438a0-5465-4140-8b02-d156f0134760
3:27:05 PM: trace [SleepNumberManager] Updating Foundation Status for: Right

303438a0-5465-4140-8b02-d156f0134760 3:27:04 PM: trace [SleepNumberManager] Updating Foundation Status for: Left

303438a0-5465-4140-8b02-d156f0134760 3:27:04 PM: debug getChildDevices(false), children=2

303438a0-5465-4140-8b02-d156f0134760 3:27:04 PM: trace [SleepNumberManager] Updating Family Status

303438a0-5465-4140-8b02-d156f0134760 3:27:04 PM: trace getBedData()

303438a0-5465-4140-8b02-d156f0134760 3:27:04 PM: trace [SleepNumberManager] Lowering bed side R…

303438a0-5465-4140-8b02-d156f0134760 3:26:51 PM: trace [SleepNumberManager] Updating Foundation Status for: Right

303438a0-5465-4140-8b02-d156f0134760 3:26:50 PM: trace [SleepNumberManager] Updating Foundation Status for: Left

303438a0-5465-4140-8b02-d156f0134760 3:26:50 PM: debug getChildDevices(false), children=2

303438a0-5465-4140-8b02-d156f0134760 3:26:50 PM: trace [SleepNumberManager] Updating Family Status

303438a0-5465-4140-8b02-d156f0134760 3:26:50 PM: trace getBedData()

303438a0-5465-4140-8b02-d156f0134760 3:26:50 PM: trace [SleepNumberManager] Lowering bed side L…

303438a0-5465-4140-8b02-d156f0134760 3:26:35 PM: trace [SleepNumberManager] Updating Foundation Status for: Right

303438a0-5465-4140-8b02-d156f0134760 3:26:35 PM: trace [SleepNumberManager] Updating Foundation Status for: Left

303438a0-5465-4140-8b02-d156f0134760 3:26:35 PM: debug getChildDevices(false), children=2

303438a0-5465-4140-8b02-d156f0134760 3:26:34 PM: trace [SleepNumberManager] Updating Family Status

303438a0-5465-4140-8b02-d156f0134760 3:26:34 PM: trace getBedData()

303438a0-5465-4140-8b02-d156f0134760 3:26:34 PM: trace [SleepNumberManager] Lowering bed side R…

303438a0-5465-4140-8b02-d156f0134760 3:26:19 PM: trace [SleepNumberManager] Updating Foundation Status for: Right

303438a0-5465-4140-8b02-d156f0134760 3:26:18 PM: trace [SleepNumberManager] Updating Foundation Status for: Left

303438a0-5465-4140-8b02-d156f0134760 3:26:18 PM: debug getChildDevices(false), children=2

303438a0-5465-4140-8b02-d156f0134760 3:26:18 PM: trace [SleepNumberManager] Updating Family Status

303438a0-5465-4140-8b02-d156f0134760 3:26:18 PM: trace getBedData()

303438a0-5465-4140-8b02-d156f0134760 3:26:18 PM: trace [SleepNumberManager] Lowering bed side L…

First of all THANKS @Classic_Tim for crating this SmartApp and Device Hander. This is amazing.

I have a standard adjustable base (no split, head and foot moves together for both sides) and the bed status is correct, moving up and down works.

The only issue I have is that when I turn the bed “on” it moves to the “Zero-G” position, not the position named “Favorite”.
Is there something I need to do to mark “Favorite” as my favorite position?
I am not a coder, but is there any value I can change in the SmartApp that determines which position the bed moves to when it is turned “on”?

Thanks for any help you can spare!

Andreas

Having the same exact issue…am I (are we) doing something incorrectly?

I have installed the app and DTH and they are working as described with the app and WebCoRE.

One feature that would be very useful is the ability to enable/disable pauseMode (Privacy). Is this something that could be added?

Looks like I may have figured it out.
Line 287 in the smart app has a ‘preset’ value that is set to “1”
I changed the value to 3, saved and published
The bed now seems to go to the favorite position. Will try it for a few days.

@Classic_Tim Are you still able to use this smartapp? When I put in my SleepIQ info, I keep getting unauthorized. I have confirmed that username:password is correct. Here is the log of what I’m seeing. Any help would be greatly appreciated.

thx!!!

@Classic_Tim - Great work on this SmartApp - I set it up on our new I8 in 5 minutes. I did make one change so that when you turn the bed “on” and “off” it adjusts both the foot AND the head to your favorite position (original code only adjusts the head). Below, I added the lines to set actuator to ‘F’ which will go to preset 1 (favorite) for the foot of the bed as well. Thanks!

private def raiseBed(String bedId, String side){
log.trace “[SleepNumberManager] Raising bed side “+side+”…”
put(’/rest/bed/’+bedId+’/foundation/preset?_k=’, “{‘preset’:1,‘side’:”+side+",‘speed’:0}")
put(’/rest/bed/’+bedId+’/foundation/preset?_k=’, “{‘preset’:1,‘actuator’:‘F’,‘side’:”+side+",‘speed’:0}")
}

private def lowerBed(String bedId, String side){
log.trace “[SleepNumberManager] Lowering bed side “+side+”…”
put(’/rest/bed/’+bedId+’/foundation/preset?_k=’, “{‘preset’:4,‘side’:”+side+",‘speed’:0}")
put(’/rest/bed/’+bedId+’/foundation/preset?_k=’, “{‘preset’:4,‘actuator’:‘F’,‘side’:”+side+",‘speed’:0}")
}

works great on my non adjustable base king sleep number. Thanks!