openhab-addons
openhab-addons copied to clipboard
[sleepiq] Communication with SleepIQ cloud very unreliable
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 I'm seeing the same. Any chance you have a patch of the changes that you can share?
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.
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?
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.
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.
Just confirming the bridge seems to be rock solid for me as well.
Glad to hear it's working well for you.
Can you post the link to the adjustable base endpoints?
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!
This is amazing, thank you so much!