Eight Sleep component

I’m running on a Mac. I’m also using 0.69.1. I’ll downgrade to 0.68 and see if it fixes the issue later tonight.

@mezz64
Rolled back to 0.68 and same issue. Looks like a certificate problem. Could it be something with my account??

2018-05-18 00:06:24 ERROR (MainThread) [pyeight.eight] Error posting Eight data. Cannot connect to host app-api.8slp.net:443 ssl:True [[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)]
2018-05-18 00:06:24 ERROR (MainThread) [pyeight.eight] Unable to authenticate and fetch eight token.
2018-05-18 00:06:24 ERROR (MainThread) [homeassistant.setup] Setup failed for eight_sleep: Component failed to initialize.

I don’t believe it has to do with your account, for some reason you can’t even fetch the url.

Can you do a curl check from the HASS instance of the eight sleep api url to make sure you have connectivity?

curl https://app-api.8slp.net/v1

Should return:

{“apiName”:“Eight API v1”,“version”:“v1.0.0”}

@mezz64
I created a command line sensor and I get the same results.

{“apiName”:“Eight API v1”,“version”:“v1.0.0”}

Is it possible there’s another dependency that isn’t loading? Or permissions on the folder?? There’s a few components that all failed around the same time so it has to be something that’s shared that isn’t functioning properly.

Fixed. So the issue was with my Python 3.6 install. When I reinstalled it, I noticed this…

One more thing: to verify the identity of secure network connections, this Python needs a set of SSL root certificates. You can download and install a current curated set from the Certifi project by double-clicking on the Install Certificates icon in the Finder window. See the ReadMe file for more information.

Once I installed the certificates, everything started working again. Thanks again @mezz64 for helping me troubleshoot. I appreciate the time you spent.

I have been noticing some differences between in the data provided by the component/API and what is in the eight sleep app. Anybody else noticing this? The score is always correct but the time slept and the heart-rate seem to be off.

Time slept variations are due to the addition of the “REM” sleep stage. My summing function of the duration’s isn’t updated yet to include that type. Not sure about the heat rate, but I also see very slight variation from the app data. I’ll look into it.

Sounds good. Let me know when you have a fix which can be tested. The summing should not be too hard if you the API now also reports the REM time.

PR is submitted to add REM sleep. The variation in the other attributes is due to how they are displayed versus the app. They are updated in real time in hass so the last value shown is equal to the last measured, not the average for the session. You can break out the attribute with a template sensor to see exactly what is happening vs time.

2 Likes

Great! Thank you! I check it out when I get back in about a week.

So after a few days of testing the update, I noticed a problem I actually have observed before:

It looks like the bed presence sensor does not update status without a restart of HASS at the end of a sleep session: I have noticed that I often see the binary sensor stay tripped through the day. The opposite though works: If the sensor is not tripped during the day, it trips appropriately when the bed is occupied. Not sure how frequently the sensors actually ping the API…

Is the bed state sensor being updated? Bed state is updated once a minute and sleep data every 5 minutes. Bed presence is based on the bed state, so if the bed state is updated the presence should be correct as well.

Seems to be working now… Not sure what changed.

I just had this problem again and I am wondering if either the API or HAss component ignores the bed presence status change if the sleep stage is awake. Most days, I am having to reload HAss to get around this problem.

Edit: It just happened again today: The sleep stage updates fine but the presence sensor does not update. I have to reload the component to update. It definitely looks like a problem within the component itself.

Hi there,
I’m constantly getting the below in my logs

unable to fetch eight device data

has anything changed?

Nothing has changed that i’m aware of. I do also see connection errors on occasion, with a good chunk occurring on 9/20 most recently, but the url endpoints are still valid for the api.

1 Like

Ok thanks. Will keep my eye on it.

Hoping to use both move away from awake state as an alternate trigger for a goodnight routine, but haven’t had reliable results yet.

Eight Sleep Owners: How fast do you find the occupancy sensor updates? I’d like to be able to get up out of bed in the middle of the night and the lights to the hallway/bathroom immediately turn on; however, it seems to be minutes before my occupancy sensor updates that I’m out of bed. Does anyone else experience this?

I’m afraid the speed is a limitation of the api access we’ve been able to achieve. The only realtime data available from the bed is a sudo heat value on a scale of 10-100. When you get in or out of bed it takes some time for this value to change enough for us to detect it as a user actually leaving the bed versus just changing positions.

In short, unless Eight provides an actual documented API with more data, there is no way to make it faster.

2 Likes

Looks like the eight component died…

Unable to authenticate and fetch eight token.

1 Like