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

Home Assistant #1

Closed
jer78 opened this issue Mar 30, 2017 · 6 comments
Closed

Home Assistant #1

jer78 opened this issue Mar 30, 2017 · 6 comments

Comments

@jer78
Copy link

jer78 commented Mar 30, 2017

Hi, I just came across this. Any chance you can integrate with Home Assistant? www.home-assistant.io

@mezz64
Copy link
Owner

mezz64 commented Mar 30, 2017

That's the end goal. It's being written with home assistant in mind.

Just started working on it so it'll be a couple weeks at least until it gets that far. The API is a little limited so i'd be interested in what types of use cases you were hoping to get out of it.

@jer78
Copy link
Author

jer78 commented Mar 30, 2017

That's awesome! Looking forward to it. My goal is to learn Python so I can do the same thing one day. ;)

What does the API now provide? I noticed there's a smartthings integration (unofficial of course) that has sleep score, warming etc.

My use cases would be the following:

  1. I have an alarm within Home Assistant that wakes me up with a tts of my daily activities. I would integrate the last nights sleep score (for both my wife and I) and/or hours of sleep.
  2. Delay the alarm by up to 15 minutes if it senses I'm in a deep sleep vs. light sleep. (this would be really cool if it was possible)
  3. If I'm home, turn on the bed warming. I'd rather not use the auto timer in the app, because if I'm not at home there's no sense turn it on.

Thanks again for working on this!!

@mezz64
Copy link
Owner

mezz64 commented Mar 30, 2017

1 and 3 are definitely possible, 2 is a maybe. Right now the api only reports certain things on an hourly basis once it determines someone is actually in the bed so it's easy to get the deep sleep data after the fact, but harder to get it in real-time.

The smartthings integration was what motivated me to get started on this without the official API being available. There are some neat things in there in terms of using the bed heating level (one of the few things that can be requested in real-time) to determine bed presence that I plan to work into the python library also.

@jer78
Copy link
Author

jer78 commented Mar 30, 2017

Awesome!! So for #2, would there be a way to pull data at a certain time? For instance, if my alarm is set to go off, could a script in Home Assistant request an update? Or do you mean, Eight Sleep doesn't actually even know until an hour after the fact because it pushes the data every hour? Somehow Eight Sleep uses it for their "Smart Alarm" in real-time. But maybe they don't expose it to their API?

@mezz64
Copy link
Owner

mezz64 commented Mar 31, 2017

The intervals api endpoint does report what it thinks the current sleep state is and how long you've been in that state. Problem is that data is very dynamic while you are sleeping because of the way it's processed, so you could query it and it might say light sleep one minute and then update that past state to deep sleep once it processes more data the next time you query it.

@mezz64
Copy link
Owner

mezz64 commented May 5, 2017

First implementation of this has been merged into home assistant. Closing this...

@mezz64 mezz64 closed this as completed May 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants