[RELEASE] Sleep Number Controller - control your Sleep Number bed and use it for presence

NP. If there is anything I can do let me know. I'd like to get better at this stuff anyway.

This is now resolved. It was a type mismatch introduced in a prior refactoring. Please try updating to the latest version and let me know if you still see issues.

1 Like

Geesh. Those are almost as annoying as syntax errors. :smiley:

That appears to be working in a quick test. I'm able to adjust the sleep number and favorite now. There was some error spam in the logs for a bit after the app installed, but I think I read above that may be normal. It settled down and I haven't found any other problems.

Thanks for the quick fix. I have the C5 hub and have had the Sleep Number bed even longer. I just never did any cloud integrations until now since we had a crappy slow 10\1 DSL. We are now on 500\500 fibre that is way too expensive in my area, but at least I finally get to play with these things. I just got lucky and happened to pick the time when it had a bug. I assumed it was just me since it was the first time setting that app up.

Again. Thanks!

I just updated this to v4.0 and it encompasses one of the larger changes this code has seen in a while. This change adds support for the Climate 360 and P6 beds (and maybe more?) so if you were only presence was working for you but you wanted more, give this a shot.

It also removes support for virtual containers and instead relies entirely on the generic child devices for multi-device use cases. Apologies if anyone really wanted that but this change greatly simplifies the driver structure and allowed some app cleanup too. If you're using virtual containers then you'll need to remove the devices, upgrade and then re-add them (or, I guess, just not upgrade).

Finally, I moved some of the duplicate code (between app & driver) into a library. In order to distribute easily, this meant I had to add a bundle and at least right now, that bundle just contains the library but I may just move all the code in there in the future (I'd love to avoid the bundle but it seems like the only way to distribute the library right now).

Because adding the new API support involved many changes and due to the other cleanup, it's very possible there are still bugs lurking. If you see something strange please make sure you have debug logging enabled and PM me details.

Huge thanks to @DiverRich and @jeff_laughter for help with the new bed support.

3 Likes

So I just installed, configured, and with 5 minutes of effort I was controlling the sleep numbers and bed positions on both sides through Alexa.

Huge, amazing success. Well done!

Will play with presence and advanced stuff over the next few days!

It’s working great with the Climate360. Thanks again for all of your time and effort @rvrolyk.

Are others seeing the API going offline the last day or so? I keep getting “Retrying Failed Requests” error in the log because the device is offline. I then go into the app, Done out, whereupon it starts working again. Then, some number of minutes or hours later, the process seems to repeat.

Would feel better knowing it’s not just me! @rvrolyk, should there have been any breaking changes in the recent rounds of big changes?

I updated to the latest version a few days ago (I think the day it came out). Not seeing any errors in my logs, seems to be working here.

1 Like

I’m on v4.0.0 as well. Strange.

How are you saving the current sleepNumber to a variable? I'm trying to do this in rule machine, but don't see the option anywhere.

@mluck - are you saying it's not refreshing on its own? It is normal for the auth token (or cookie) to timeout after some period (I think it's ~2h) but it should get refreshed on the next retry without any action from you.

There were no breaking changes in the actual request / auth logic.

FWIW, I haven’t had any logged errors or issues since release with the Climate360.

1 Like

Are you trying to use this as a trigger? If so it's custom attribute

I'm trying to use it in an action.
The trigger is when presence is detected.

The action I'm trying to create is setLevel to sleepNumber.

But, I figured I would have to get the sleepNumber as a variable before I could attempt that?

Hmm, I'm not sure; I haven't looked at it that way. What I noticed (a few times in the last couple days) is that my bed wasn't responding to commands, so I pulled up the app and I can see it says "API Error" to the right of the app listing. So I click in and done out, and it changes to Online and suddenly the commands work. The only error in the log is the one I mentioned above, but I should probably activate debug logging, and report back.

Should I debug log the app or the devices? Or should I try something else?

You only need to set as a variable if you're trying to do some sort of math or something on it since, for comparisons, you can always use custom attribute. To set it, you should be able to run custom action:

that's interesting and not something I've seen (yet at least). Debugging the app should help shed some light on this, feel free to PM me the logs once it happens again.

1 Like

Ok, so how do I get it to make setLevel using the sleepNumber as the parameter?

For example, my sleep number is 40, but at some point during the day I changed the level of the bed to 100. So, when I lay down I want it to adjust to 40, but I don't want to statically assign 40. I want it to use the sleep number is gets from the bed so that when I change my sleep number to 45 in the app (which I do from time to time) it uses 45 instead of 40.

if you're using your favorite sleep number then you can use setSleepNumberFavorite. If you just want the "last used" sleep number then you'd need to stash that in a variable before you set it to 100 and then use that variable when restoring it.

Thanks! I had my variables set to string instead of number which was causing some things to show up incorrectly. Thank you for clarifying and for updating this for the climate360 bed! It works great!

Another quick question. Is there support for the cooling on the climate360 beds?