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

Had my internet go offline last night and this app flooded the logs with Retrying failed request messages every minute for hours. Any way to throttle how many times that gets logged? Maybe after a few it gives up and tries every hour or something? Not sure if it is safe to post that connection string in the error but I can send you the screenshot if you need it.

Can you turn on debugging and PM me the logs? If you have it set up to poll differently between day and night then it should poll X during the day and Y at night or if you have a constant period set then it'll just be the one.

Right now there's no way to change that (short of updating the code to remove the logging). I can look into this but my understanding from other HE staff posts is that logging shouldn't hurt the platform so it's been low on my list so far. I'll see what I can come up with.

The only issue I had was it pushed anything else off the end of the log so I could not see anything older than around 4am. Unless there is a way to see older logs that I missed. I did not dig into it any further. Might need to adjust some settings to keep more logs or something.

Seems when I ran this the first time, the app never installed. Everything seems to stay working now as long as the app remains, in an "online" state. However, yesterday after I installed and configured it, it went offline. It didn't return online until this morning. I reconnected it, and rebooted the hub. It's been online for about 5 hours now, so maybe it's solved. If there's something I should be aware of outside of normal configuration and what is in this thread, please let me know. Once I have the application stable, I'll start configuring rules.

Couple questions about this....

  1. What are valid values for outOfBedTime?
  2. Also, how do I create the dash tile with all the sleep information in it?

Out of bed time is read-only and set if you have sleep data enabled. It's read from the SleepNumber servers and represents the "Bed Exit" time shown in their app.

If you want to create a dash tile you add an attribute tile to the dashboard and pick the attribute you want to show; the sleep summary data is named sessionSummary and there's another representation called sleepIQSummary (you can see the data for both of these on the device page). More information is here GitHub - rvrolyk/SleepNumberController too.

2 Likes

I just noticed the HomeBridge SleepIQ integration was pulled at the request of Sleep Number for overloading their network with API calls.

Because I definitely don't want that to happen to all of us, it may be proactive/prudent to limit the frequency of API calls.

Yeah, thanks for flagging @aaiyar. I actually noticed that which is what prompted the day/night toggle. I'm hoping folks here use that to avoid needless communication during the day hours.

1 Like

Would you consider making that toggle mode dependent? For example, I would like the polling to occur every 30 minutes (or more) in Home mode, but every 1 minute in Sleep mode. And the timing of Home mode varies from day to day.

Sure, that sounds like a reasonable request. Personally I set mine to the time I usually think about going to bed but then use bed presence to actually trigger "sleep mode" but I can certainly understand the desire to do it differently. I'll try to look into it in the next week or two; unfortunately juggling a bunch of unrelated things right now so probably can't get to it quicker than that.

1 Like

No rush. And I just realized that there's actually a workaround for my use-case. That being to load two instances of your app. One for Home mode and one for Sleep mode. I'd end up with a bunch of devices, but they're "free". Any pitfalls with this approach/logic?

No, as long as the polling period is far enough apart it in the two modes should be pretty minimal impact, if any.

1 Like

I just released v3.1.1 which adds two features:

  • use modes instead of times for refresh intervals (@aaiyar)
  • set a numeric value for minutes between error logs (@jzulkeski)
3 Likes

Thank you - I'll try it out this weekend!

Haven't checked into this feed for a while. However, I noticed this in my logs. What is the reason for all the "foo" errors?

Also, noticed multiple "unauthorized" lines. Lost power and internet due to ice the night before last. Could that be the issue? What would be the fix?

foo Errors

Unauthorized

Sorry, the foo log was me testing yesterday and accidentally left it in. Just pushed 3.1.2 that removes it.

Unauthorized is likely due to the power loss but I'm not sure why it wouldn't recover. If you now have power, you can try opening the app and re-saving your credentials. If that doesn't work, can you enable debug logging (after taking the update) and PM me the logs?

1 Like

I already tried resaving the credentials. I just updated and will turn on debugging for a bit.

I just updated to the newest version yesterday. Now it looks like the day/night modes are battling each other for some reason.

image

Here are my settings

image

interesting, I shuffled that around a bit but didn't change the underlying logic. I'll take a look later today.

I think I see the problem; I'll run it overnight and if it fixes things I'll push the update tomorrow.

2 Likes