[OBSOLETE] Eight Sleep (Connect) V1.0 [Eight Sleep Mattress and Cover]

This is an unofficial Eight Sleep and SmartThings integration. With this smart app and device handler you are able to connect the Eight Sleep Mattress and Cover to SmartThings. https://www.eightsleep.com

Author - @Alyc100
getCSSData and HTMLTile elements - @tonesto7

Donations
This integration is provided completely free of charge and is open source. If however you really feel like it, you can make a donation here

#Latest Versions
Ensure you install the latest versions of both the Smart App and Device Handler

Smart App - Eight Sleep (Connect) v1.0b - Updated 26/01/2017 20:15

  • (1.0b) Token renew error fix.
  • Remove BETA label.

Device Handler - Eight Sleep Mattress v1.1 - Updated 13/11/2017 12:30

  • Add back up method for determining sleep event if presence values from API become unreliable.

#Supported Devices

  • Eight Sleep Cover (tested)
  • Eight Sleep Mattress

#Notable Features

  • Separate devices within SmartThings for left and right side of bed.
  • On/Off functionality
  • Control heat level and set timer within SmartThings
  • Turn on notifications from your Eight Sleep mattress
  • View historic sleep/presence data within SmartThings app
  • View mattress presence status
  • Feed latest Sleep Score event into SmartThings. Turn on the coffee machine if you’ve had a terrible nights sleep.
  • Full control over your Eight Sleep Mattress including usage in rules and routines (i.e, CoRE)!!

#Screenshots

#Installation Guide
To install the Eight Sleep (Connect) app and Eight Sleep Mattress device handler:

  1. Add the Eight Sleep (Connect) app from GitHub as a new ā€˜My SmartApps’, select create from code option and paste. Save and Publish.

  2. Add the Eight Sleep Mattress device type from GitHub as a new ā€˜My Device Handlers’, select create from code option and paste. Save and Publish.

  3. Add the Eight Sleep (Connect) app within the ST app from the Marketplace, then selecting the ā€˜SmartApps’ tab and locating the Eight Sleep (Connect) app under the ā€˜My Apps’ section which should be at the bottom of the list.

  4. Add your Eight Sleep credentials (email and password) and select ā€˜Done’ on top right of app.

  5. You should be able to select your Eight Sleep devices in the configuration screen.

  6. Once you have selected your devices, click Done on the top right.

  7. For every Eight Sleep device, you should see two devices automatically appear under ā€˜Things’ with the labels Eight Sleep [device ID] [Left] and Eight Sleep [device ID] [Right] (may require SmartThings app restart). You most likely will want to relabel these devices to something more useful. This can be done by pressing the settings icon on the top right of the device tile screen.

#Github Links
Github Repository Integration details:
Owner: alyc100, Name: SmartThingsPublic, Branch: master

Smart App

Device Handler

#Feedback
Please post your comments, any issues experienced, suggestions and feedback on this topic thread.

10 Likes

Hi, I think that the instruction to enable oAuth in the Connect App is missing.

Regards.

No OAuth required for this integration.

Using the King size Eight Sleep Cover

Installation went smoothly. Can see the bed warmer is active and counting down. Looking forward to the morning and seeing the stats showing up. Great start!

Hi, I use my smartapps to schedule the mattress’ switch level

However, I don’t see the actual warming action and level in the Eight mobile app… Is it normal?

Are the Eight APIs synchronized with the Eight mobile app?

Regards.

And I have mixed status messages in the logs (status 200, Body error: Unauthorized). See below.

e97f5e10-8c97-4a58-bfff-f87d82a762cb 9:10:04 PM: info Status: 200
e97f5e10-8c97-4a58-bfff-f87d82a762cb 9:10:03 PM: info Status: 200
e97f5e10-8c97-4a58-bfff-f87d82a762cb 9:05:01 PM: info Refreshing device Eight Sleep XXXX [Left] …
e97f5e10-8c97-4a58-bfff-f87d82a762cb 9:05:01 PM: info Refreshing device Eight Sleep XXXX [Right] …
e97f5e10-8c97-4a58-bfff-f87d82a762cb 9:05:01 PM: debug getChildDevices(false), children=2
e97f5e10-8c97-4a58-bfff-f87d82a762cb 9:05:01 PM: info Executing refreshDevices…
e97f5e10-8c97-4a58-bfff-f87d82a762cb 9:05:02 PM: info Body: [error:Unauthorized]
e97f5e10-8c97-4a58-bfff-f87d82a762cb 9:05:02 PM: info Status: 403

Hi again,

I have another question: if you send a setLevel command to 100 for example, I suppose that the switch will be turn on too… The DTH does not reflect this in the UI.

Am I mistaken to assume that a setLevel command will turn on the switch also?

Regards.

Hi there,

Will attempt to answer some of your questions.

The api does sync with the eight Sleep app. This is most apparent by changing the level of heat and turning be mattress on and off. Altering the timer will not as this does not fire an api call.

The 403 is due to the device attempting to fetch sleep data for your partner user. I will stop this in the next release.

Setlevel does not turn the switch on. It just sets the level via the api and you should see this sync into the eight Sleep app.

@Alyc100,

Are you planning to change the behavior of the setLevel command later?

Usually, for any switch under ST, a setLevel command usually means that the switch will be turned on too.

As an example, if I send a setLevel command ā€˜30’ to my kitchen dimmer switch, it will turn on the switch and set its level to 30%.

Another small issue: is there a way to get rid of the timer? It seems that every time the ā€˜on’ command is sent, a 3:00 timer is set…

Let me know.

P.S. It’s a very good DTH overall, it’s really a good start!

I just bought one… I was on the fence about it during the campaign, but now that I see it’s integrated here, I bit.

20% off at least, so only $280 for the tracker (will be buying a new mattress soon).

Will you make the Eight devices Precense sensors?
My main goal for Eight was to have a way to have a way to set the house into Good Night mode based on both my wife and I getting in bed at a certain time slot. I currently have it set to no motion in the house at 11:00 pm but would love to come up with a way to use the sensors if my wife and I are both in bed for a xx:xx amount of time set the house into good night also.

4 Likes

Would also be cool to integrate with AskAlexa.

Ask SmartThings if my wife is in bed
Ask SmartThings how long until my side of the bed is warmed

Sorry about that. As noted in the ā€œKnown Issuesā€ section, the presence detection is far from reliable at the moment.

As for the AskAlexa integration, it’s not on the immediate road map but definitely will look into this.

The ā€˜presence’ indicator is a contact sensor but is far from reliable at the moment to use within a rule. This is on the top of my list of things to figure out.

Thanks for all your feedback by the way.

I can certainly alter the setLevel behaviour for the device so it also switches on the device if it makes it more consistent with other devices with similar capability.

As for the timer, that’s a mandatory requirement when you send an ā€˜on’ command to the eight sleep API. The only way round this is to up the timer to the maximum 10 hours in the device. It’s the up arrow on the right hand side.

BETA Release 2 is here. Thank you for all the feedback and please keep it coming.
New features and areas to test include:

  • Changing setLevel behaviour to also turn on mattress if off as requested by @yvesracine
  • Partner account support. You should be able to add this into the Eight Sleep (Connect) app once updated. You should be able to view sleep trend data for both left and right side devices after this.

Still working on improving the presence detection. I’m analysing the variables over the next few nights to see if any patterns occur.

I’ve noticed just last night when it does switch to the closed state on the sensor its only for 5 minutes max.

I’m currently working on making the sleep detection more reliable. Hopefully have something released in the next couple of days.

sounds good, keep up the hard work.

Hi @Alyc100,

Another request if it’s possible: could you expose the internal temperature reported in the Eight Mobile app… I don’t know if the APIs allow it.

That way, my smartapps could proportionally calculate the right setLevel to send to the device based on the temperature readings and the user’s desired temp.

Regards.

EDIT: BTW, could you post the Eight APIs documentation?