Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sleepiq] Communication with SleepIQ cloud very unreliable #11764

Closed
mhilbush opened this issue Dec 12, 2021 · 9 comments · Fixed by #14180
Closed

[sleepiq] Communication with SleepIQ cloud very unreliable #11764

mhilbush opened this issue Dec 12, 2021 · 9 comments · Fixed by #14180
Assignees
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@mhilbush
Copy link
Contributor

After fixing the ClassNotFoundException through PR #11700, the binding now runs again (albeit, not well).

However, after the first hour or so of runtime, the binding's communication with the SleepIQ cloud service becomes very unstable. Many transactions fail, and many NPEs are logged. For all intents and purposes, the binding is effectively unusable.

I spent the better part of two days trying to figure it out with little success. I was beginning to think the SleepIQ cloud service was just that unreliable. Rather than continue to invest time into it, I decided to see what would happen if I replaced the JAX-RS implementation with Jetty HttpClient.

Since having done that several days ago, the binding has been rock solid stable for me and one other OH user. I dunno what it was about the JAX-RS implementation (I don't know that package very well), but there was something that was not working with the SleepIQ cloud service. I suspect it had something to do with session management and the AWS load balancer used by the SleepIQ cloud. But I tried multiple changes to the binding, and nothing solved the core issue.

So, my intention is to submit a PR with a highly modified version of the binding that uses the Jetty client instead of JAX-RS. At a minimum, the PR will:

  • replace the JAX-RS implementation with HttpClient
  • use null annotations
  • eliminate the NPEs
  • Implement a new function to set the sleep number from openHAB
  • conform to latest OH coding guidelines and remove as many compiler warnings as practical

Given the closeness to the upcoming release, I will target the next release cycle.

@mhilbush mhilbush added the bug An unexpected problem or unintended behavior of an add-on label Dec 12, 2021
@mhilbush mhilbush self-assigned this Dec 12, 2021
@brianwarner
Copy link
Contributor

@mhilbush I'm seeing the same. Any chance you have a patch of the changes that you can share?

@mhilbush
Copy link
Contributor Author

mhilbush commented Oct 9, 2022

Yes, try this version of the binding.

https://github.com/mhilbush/openhab-binding-releases/blob/master/sleepiq/org.openhab.binding.sleepiq-3.4.0-SNAPSHOT.jar?raw=true

Please let me know how it works for you. I'm pretty close to submitting the PR, so your feedback would be valuable.

@brianwarner
Copy link
Contributor

Wow. You really did a lot of work on this, there are a ton of new channels. This looks great! Thank you so much for putting in this work. I'll run it for a bit and keep an eye on my logs, and confirm that I'm seeing the same improvement in stability.

Out of curiosity, did you find a documented API somewhere?

@mhilbush
Copy link
Contributor Author

mhilbush commented Oct 9, 2022

Out of curiosity, did you find a documented API somewhere?

No. I just looked at a couple other implementations that were using some additional APIs.

@brianwarner
Copy link
Contributor

It's unfortunate they don't publish it.

I think I found a python implementation with the adjustable base endpoints. Is the source for your update branch public yet? I'd be happy to try to implement them.

@brianwarner
Copy link
Contributor

Just confirming the bridge seems to be rock solid for me as well.

@mhilbush
Copy link
Contributor Author

Glad to hear it's working well for you.

Can you post the link to the adjustable base endpoints?

@brianwarner
Copy link
Contributor

Certainly. Here's a python app:
https://github.com/technicalpickles/sleepyq/blob/master/sleepyq/__init__.py

and it looks like someone wrote a Groovy app for Hubitat as well:
https://github.com/rvrolyk/SleepNumberController

Anything I can do to help?

The updated binding is already really popular in the house because one of us is a light sleeper who gets really annoyed with the responsive air setting turning the pump on in the middle of the night, and the other likes the bed to keep air correctly. I have a rule that boosts the sleep number by 5, waits 30 seconds, then drops it back down again, once per day. This at least ensures the bed does a regular pressure adjustment. It wasn't possible before with the read-only endpoints, so multiple wins here. Thanks again for doing this!

@brianwarner
Copy link
Contributor

This is amazing, thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants