Eight Sleep component

I have a Pod. The ‘sleep stage’ looks to update (though I would argue with the results, a topic for another day) and the ‘bed state’ also looks to update but I don’t have any understanding of the percent value used here or what it represents.

I was recently trying to create an automation based on my being in bed and that’s when I noticed the presence always being ‘off’.

I’ve had decent luck with using bed presence to trigger 3 automations that I have programmed so far, but detection times varies greatly, so you can’t rely on it if you want something precise like triggering an automation 5 minutes after you get up.

What I have done originally to make sure that bed presence was being recorded is that I created an input_boolean that would turn on if I was in bed at a certain time of the night and left that input_boolean on until 9:30 in the morning, so if I needed to trigger anything based on me sleeping in my bed later on that morning, that flag would indicated that I did in fact sleep in my bed. I have another automation that turns it off at 9:30AM.

Mine has been working fine with the original eight sleep mattress pad…

Can you post a snapshot of your bed state graph during a time when you were in bed? The presence detection works off detecting changes in the bed state so that might give me a clue as to why it isn’t working for you.

Sure, this shows the view from last night in total:

image

I was probably in bed by about 12:10am:

image

So, if I’m reading this right this graph is showing the bed heating before I went to bed, then cooling at night and re-heating at some point in the middle of the night until I got up…?

Also, I am questioning the sleep stage accuracy a bit. This shows me as “awake” from 1245am until 416am, which isn’t the case… or I’m doing some wacky stuff in the middle of the night, lol.

image

Finally, here is where the presence shows the past 24 hours in which it was ‘off’ the entire time:

image

Interesting, when I added support for the POD I had assumed that the “resting state” for the POD would be 0% just like the heating only products, but your graph seems to indicate a negative resting point which explains why the presence detection doesn’t work. Does it always fall to around the same point when the bed is empty?

About the sleep stage info… it’s only marginally useful. Whatever algorithm they use to infer the sleep stage is constantly using both past and present mattress data to figure things out. This component captures the initial real-time decision that’s made available in the api, but as I’m sure you’ve noticed that doesn’t often sync up with the final results at the end of the session.

Looking at the data from yesterday/last night the state appears to be directly in line with the day prior: Hovering around -54 to -63 during the day and raising up to 7 to 14 during the night. If I look at the state for the right side of bed (which is unused) the day follows the same data. The night for the right side also follows a similar pattern as the left side, just not as drastic (which seems correct given that side is not directly heating and is only at the mercy of residual heat from the left side).

So, I assume the range of -54 to -63 represents the temperature in my bedroom during the day, when not in use.

Ok, i’ll need to make some changes to the presence detection logic to work for these conditions. I opened an issue on the library so I won’t forget.

No worries. if you need any help testing or even access to data when the time comes, just let me know.

Likewise, I noticed that if partner is set to true then the room temperature sensor is not created in HA. At least in my implementation.

I just ordered the mattress cover. I only plan on using the presumes sensor. Is it fairly accurate? I’m assuming could, not local?

Does this integration work with the new Pod Pro? I have it installed and it seems like bed state is working but bed_temperature and presence are not updating correctly.

There is a known issue with presence on the pod devices since the device resting state does not go to zero like the earlier non-cooling devices. Unfortunately I just haven’t had much free time lately to implement a fix.

Any chance we will see a fix for this? I have the Eight Sleep Pod and just thinking about the possibilities with Home Assistant keeps me up at night lol.

1 Like

I’ll gladly accept a PR to the pyEight library if someone else has the time to make the needed changes. It’s just not something I can make time for at the moment.

I’ve added what I consider to be beta support for POD presence detection in the latest version of the pyeight library. Feel free to post experiences with it here once it makes it’s way into home assistant so I can tweak the thresholds as needed.

When adding eight sleep to my configuration.yaml I get this error in the log:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
    result = await task
  File "/usr/src/homeassistant/homeassistant/components/eight_sleep/__init__.py", line 120, in async_setup
    success = await eight.start()
  File "/usr/local/lib/python3.8/site-packages/pyeight/eight.py", line 108, in start
    await self.assign_users()
  File "/usr/local/lib/python3.8/site-packages/pyeight/eight.py", line 159, in assign_users
    if data['result']['rightUserId'] == self._userid:
KeyError: 'rightUserId'

I am using the left side, I would prefer to keep it that way!

I changed my bed to solo mode instead of just specifying the left side. This made the error above go away. I would envision that I should see data for left and right side… all that came in was right side. I wish we could get this fixed. Who do we pay and how much lol?

Presence detection does not work and is not accurate

2 Likes

Recently got a Pod Pro Max and loving it. I just submitted a PR to convert the component to config flow so there’s no more hard coding credentials into YAML (although still supported). Once this is merged I have a few more things to do:

  • Improve the left/right/solo stuff. I’m a solo sleeper, so I don’t really like all my sensors are prefixed with right
  • Add current room temperature and humidity sensors. The former already exists but the data source isn’t as good as what’s now available.
  • Add a Climate platform, allowing control of the bed temperature as if it was a thermostat
  • Expose whatever other sensors I can find that are valuable

Let me know if there’s any other requests.

3 Likes

Hi,

Thanks for this. I have noticed recently that the eight sleep API server tends to have some down time for a short period of time every day. This causes home assistant to crash and reboot as it apparently is not handling the accumulation of errors well. It would be great to have the component handle the server outages better.