Git Product home page Git Product logo

Comments (17)

tjmehta avatar tjmehta commented on September 25, 2024 1

hey! I haven't looked at this in a bit you can just provide email and password in the config it should login for you after that. lmk if that works out for you and feel free to update the docs marking oauthClient as optional

EDIT: not true, see comment below - #5 (comment)

from homebridge-eightsleep-platform.

ftoralesacosta avatar ftoralesacosta commented on September 25, 2024 1

Just tried it, works great!

from homebridge-eightsleep-platform.

ftoralesacosta avatar ftoralesacosta commented on September 25, 2024 1

Hm, make sure the platform is "EightSleepPod", and if you're using the home bridge UI to edit the config file, it should point out to you any other syntax errors. Otherwise, you'll have to post the errors your getting to debug.

from homebridge-eightsleep-platform.

ChewietheWookiee avatar ChewietheWookiee commented on September 25, 2024

ok I sorted out the syntax in my config file. but I assume I need help to get the oauth info as this is the error I'm getting:

`[1/6/2021, 8:07:30 AM] [EightSleepPod] Get RotationSpeed Error -> InvalidResponseError: invalid response
at Function.wrap (/usr/lib/node_modules/homebridge-eightsleep-pod/node_modules/baseerr/src/index.ts:51:12)
at EightSleepClientApi. (/usr/lib/node_modules/homebridge-eightsleep-pod/node_modules/simple-api-client/src/index.ts:244:34)
at Generator.throw ()
at rejected (/usr/lib/node_modules/homebridge-eightsleep-pod/node_modules/simple-api-client/dist/cjs/index.js:6:65)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
{
"status": 401,
"headers": {},
"path": "users/oauth-token",
"init": {
"method": "POST",
"headers": {
"accept": "application/json",
"content-type": "application/json",
"user-agent": "Eight/786 CFNetwork/1125.2 Darwin/19.4.0",
"accept-language": "en-us",
"accept-encoding": "gzip, deflate, br",
"user-id": "f2886ebe4e854c178541a919851cf905",
"session-token": "f0272abf9cc34486a247c2f90990c515-ce4c7be2275438a8908d96f46d57fdcf"
},
"body": "{"client_id":"clientid....","client_secret":"clientsecret...."}"
}
}

FetchError: invalid json response body at https://client-api.8slp.net/v1/users/oauth-token reason: Unexpected end of JSON input
at /usr/lib/node_modules/homebridge-eightsleep-pod/node_modules/node-fetch/lib/index.js:272:32
at processTicksAndRejections (internal/process/task_queues.js:93:5)
{
status: 401,
headers: Headers {
[Symbol(map)]: [Object: null prototype] {
date: [Array],
'content-length': [Array],
connection: [Array],
'x-powered-by': [Array]
}
},
path: 'users/oauth-token',
init: {
method: 'POST',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'user-agent': 'Eight/786 CFNetwork/1125.2 Darwin/19.4.0',
'accept-language': 'en-us',
'accept-encoding': 'gzip, deflate, br',
'user-id': 'f2886ebe4e854c178541a919851cf905',
'session-token': 'f0272abf9cc34486a247c2f90990c515-ce4c7be2275438a8908d96f46d57fdcf'
},
body: '{"client_id":"clientid....","client_secret":"clientsecret...."}'
}
}`

from homebridge-eightsleep-platform.

nstefanelli avatar nstefanelli commented on September 25, 2024

Hi - having the same issue as above. If I remove the oAuth line as suggested, I get an error that it is required.

What do you recommend I try? Here is my current config:

{ "name": "Eightsleep", "platform": "EightSleepPod", "email": "[email protected]", "password": "mypassword", "oauthClient": { "id": "clientid...." "secret": "clientsecret...." } }

from homebridge-eightsleep-platform.

ftoralesacosta avatar ftoralesacosta commented on September 25, 2024

Hi - having the same issue as the two above....

fyi: when the oauthClient line in the config is omitted, for example:

        {
          "name": "EighSleep",
          "platform": "EightSleepPod",
          "email": "[email protected]"
          "password": "mypassword"
        }

I get the several instances of following oath error in the homebridge logs:

RotationSpeed Error -> BaseError: appApiClient is missing (client should be instantiated with oauthClient)^[[39m
^[[31m    at EightSleepClientApi.getAppApiClient (/usr/local/lib/node_modules/homebridge-eightsleep-pod/node_modules/eightsleep/src/index.ts:144:13

Looking through your very nice Eightsleep api client for Node.js repo, doesn't the client take as input the oath id?

Lmk if I can provide more information to help.

from homebridge-eightsleep-platform.

abonstu avatar abonstu commented on September 25, 2024

same issue here - the api client wants oauth token (even with oauth attribute omitted from config):

[Eight Sleep Pod] Get Active Error -> BaseError: appApiClient is missing (client should be instantiated with oauthClient)
    at EightSleepClientApi.getAppApiClient (/usr/local/lib/node_modules/homebridge-eightsleep-pod/node_modules/eightsleep/src/index.ts:144:13)
    at /usr/local/lib/node_modules/homebridge-eightsleep-pod/src/EightSleepPod.ts:44:20
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-eightsleep-pod/node_modules/memoize-concurrent/src/index.ts:31:22)
    at Generator.next (<anonymous>)
    at /usr/local/lib/node_modules/homebridge-eightsleep-pod/node_modules/memoize-concurrent/dist/cjs/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/homebridge-eightsleep-pod/node_modules/memoize-concurrent/dist/cjs/index.js:4:12)
    at EightSleepPod.<anonymous> (/usr/local/lib/node_modules/homebridge-eightsleep-pod/node_modules/memoize-concurrent/src/index.ts:29:66)
    at EightSleepPod.getDeviceStatus (/usr/local/lib/node_modules/homebridge-eightsleep-pod/node_modules/mem/index.js:24:21)
    at EightSleepPod.getStatus (/usr/local/lib/node_modules/homebridge-eightsleep-pod/src/EightSleepPod.ts:48:37)

from homebridge-eightsleep-platform.

tjmehta avatar tjmehta commented on September 25, 2024

alright this took entirely way too long but I think I resolved it. the reason why I never updated this is bc I was providing oauth id and secret directly, so I never saw the issue when providing user/pass only. anyways at somepoint my auth expired and I ran into the problem myself so I think I fixed it. going to test it out in the next few hours.

from homebridge-eightsleep-platform.

tjmehta avatar tjmehta commented on September 25, 2024

hmm okay nvm I am not able to get it to work using only username/password. the oauthClient id and secret are required. the way that I was able to get this information was using the Charles iOS app to spy on all the requests the Eightsleep app was making on my iPhone. look for a POST request to /v1/users/oauth-token and view the request body.

you will see something like this:

{
	"client_id": "<hex-string>",
	"client_secret": "<hex-string>"
}

plug those values into your config:

{
            "platform": "EightSleepPod",
            "email": "<email address>",
            "password": "<password>",
            "oauthClient": {
                "id": "<hex-string-client-id-from-above>",
                "secret": "<hex-string-client-secret-from-above>"
            }
}

from homebridge-eightsleep-platform.

ftoralesacosta avatar ftoralesacosta commented on September 25, 2024

Hi tjmehta,

I was able to get my id and secret, and will input that into my config when I get a chance (this week is pretty busy unfortunately). Many thanks for the info!

By the way, I’ve been looking into this since I last posted on this issue, and the home-assistant implementation for 8sleep uses pyeight repo in the background. There are some trade offs compared to your repo but their implementation just required username and password of the eight sleep account: https://github.com/mezz64/pyEight/blob/master/pyeight/user.py

I’ll take a closer look soon, thanks again the the response!

from homebridge-eightsleep-platform.

carbonappsx avatar carbonappsx commented on September 25, 2024

Here's what I have in homebridge and it's not working. Any ideas?

{
"platform": "ExampleHomebridgePlugin",
"email": "email",
"password": "pass",
"oauthClient": {
"id": "08xxxxxxx",
"secret": "f09xxxxxxx"
}
}

from homebridge-eightsleep-platform.

carbonappsx avatar carbonappsx commented on September 25, 2024

Getting an error after the new firmware upgrade:

[ExampleHomebridgePlugin] Get TargetHeaterCoolerState Error -> InvalidSideStatusError: invalid currentTargetLevel
at validateSideStatus (/usr/local/lib/node_modules/homebridge-eightsleep-pod/node_modules/eightsleep/src/validateDeviceStatus.ts:76:11)
at Object.validateDeviceStatus [as default] (/usr/local/lib/node_modules/homebridge-eightsleep-pod/node_modules/eightsleep/src/validateDeviceStatus.ts:51:11)
at EightSleepAppApi. (/usr/local/lib/node_modules/homebridge-eightsleep-pod/node_modules/eightsleep/src/EightSleepAppApi.ts:79:32)
at Generator.next ()
at fulfilled (/usr/local/lib/node_modules/homebridge-eightsleep-pod/node_modules/eightsleep/dist/cjs/EightSleepAppApi.js:5:58)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
{

from homebridge-eightsleep-platform.

steveb85 avatar steveb85 commented on September 25, 2024

@carbonappsx same it worked for a few mins before this. any chance you found a fix?

from homebridge-eightsleep-platform.

steveb85 avatar steveb85 commented on September 25, 2024

It seems the problem occurs when the unit is set to 0 +- on the app. It has an invalid current target level then,

from homebridge-eightsleep-platform.

tjmehta avatar tjmehta commented on September 25, 2024

if someone has the charles app on ios you should be able to snoop on the eightsleep app and figure out what they do for setting the temp to 0, ill get to it eventually.. feel free to PR :-D

from homebridge-eightsleep-platform.

cmlouie17 avatar cmlouie17 commented on September 25, 2024

I've downloaded Charles but am having trouble getting the client id and secret from the request body. Any help would be appreciated! @tjmehta are you still able to collect them?

from homebridge-eightsleep-platform.

carmanj avatar carmanj commented on September 25, 2024

I've downloaded Charles but am having trouble getting the client id and secret from the request body. Any help would be appreciated! @tjmehta are you still able to collect them?

Did you ever sort this out? I do notice the ClientID/Secret has changed since the last time I was actively looking at this back in November. Since then, they actually enforce the ClientID/Secret, which they didn't previously.

from homebridge-eightsleep-platform.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.