Observed since 20 Oct, 21:25 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
8slp
# 8slp
Client for unpublished EightSleep API.
This client is a v1 and has some wishlist items you could help implement:
score() on past sessionsnpm install --save 8slp
yarn install 8slp
const EightSleep = require('8slp')
const eightSleep = new EightSleep('America/New_York')
await eightSleep.authenticate('fakeemail@email.com', 'hunter7')
const isActive = eightSleep.me.isHeating()
const mySide = eightSleep.me.whoami()
console.log(`I sleep on the ${mySide} side of the bed.`)
if (isActive) {
console.log(`My side of the bed is currently on!`)
}
const [date, roomTempC, roomTempF] = eightSleep.me.roomTemp()
console.log(`My room is currently ${roomTempF}F`)
EightSleep is the global class that contains and manages info for both sides of the bed. When authenticate is called, three members are instantiated: me, left and right.
Each of these members can call methods to get specific info about that side of the bed. me is an alias the side of the logged-in user.
Internal cache can be directly accessed using <instance>.cache
async authenticate(email, password): void
getSides and currentDeviceId are called and return values persisted to internal cacheasync getSides(): [ leftUserId, rightUserId ]
After instantiating new EightSleep and calling authenticate(), your instance will have me, left and right populated with instatiated classes of EightSleepSide. These sides can individually be addressed and have information requested about the current session or past sessions.
Internal cache can be addressed directly with eightSleep.<side>.cache, useful for retrieving info of all previous sessions rather than just current or a dump of previous
async refresh()
whoami()
left or right. Useful for determining which side me is referencingasync setLevel(level: number, duration: number): object
isHeating(): boolean
targetLevel(): number
lastSeen(): datestring
status(): object
[ targetHeatingLevel, heatingLevel, heatingDuration, nowHeating, presenceEnd ]isHeating(), targetLevel(), and lastSeen() in one callsession({ [date] }): object
date is not specified, it tries to return current session. If a session isn't active, it returns nullsleepStage(): string
roomTemp(): [ date, roomTempC, roomTempF ]
bedTemp(): [ date, bedTempC, bedTempF ]
tossAndTurns(): [ date, tossAndTurns ]
heartRate(): [ date, heartRate ]
heartRateVariability(): [ date, heartRateVariability ]
respiratoryRate(): [ date, respiratoryRate ]
scores({ [date] }): object
date is not specified, it tries to return current session. If a session isn't active, it returns nullscoresleepFitnessScore
totalsleepDurationSeconds (Score Object)
currentaveragescoreweightedlatencyAsleepSeconds (Score Object)latencyOutSeconds (Score Object)wakeupConsistency(Score Object)sleepBreakdown({ [date] }): object
{ awake, light, deep, rem } total duration of given sessionpreviousSession(): object
The main class, me, left and right share a cache (actually just an object) to share information and prevent re-requesting information
get(key)
"<userId>.currentSession""<userId>.currentSession"userGet(key)
me, left and right"<userId>.currentSession"<userId> in get callsuserPut(key, value)
me, left and right"<userId>.currentSession"<userId> in put callsmerge(key, value, [mergeKey])
mergeKey is only necessary when merging arrays
date, you would pass 'date' as mergeKeyvalue gets precedence and overwrites pre-existing values"<userId>.currentSession"Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
mochaEnvironment{
"local_name": "mocha",
"alias": false,
"peer_metadata": null
} | ^8.2.1 | runtime |
momentEnvironment{
"local_name": "moment",
"alias": false,
"peer_metadata": null
} | ^2.29.1 | runtime |
moment-timezoneEnvironment{
"local_name": "moment-timezone",
"alias": false,
"peer_metadata": null
} | ^0.5.33 | runtime |
node-fetchEnvironment{
"local_name": "node-fetch",
"alias": false,
"peer_metadata": null
} | ^2.6.1 | runtime |
proxyquireEnvironment{
"local_name": "proxyquire",
"alias": false,
"peer_metadata": null
} | ^2.1.3 | runtime |
sinonEnvironment{
"local_name": "sinon",
"alias": false,
"peer_metadata": null
} | ^9.2.4 | runtime |
tapeEnvironment{
"local_name": "tape",
"alias": false,
"peer_metadata": null
} | ^5.1.1 | runtime |
Source distribution
{
"integrity": "sha512-fQ8Bp1jdGrgxVvyGCVNCHpjcoCktc6q00BTiad+Nbix6gqtXXgPw1E/sMn6jzWsmg3RwA2gJc4zC0SjIUYFIhQ==",
"shasum": "895d1d6f0b303f18b1af9e38f9ae52efa385760a",
"tarball": "https://registry.npmjs.org/8slp/-/8slp-0.1.4.tgz",
"fileCount": 10,
"unpackedSize": 36390,
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEYCIQDLzF51WQJ1h4xWd7IhK0nr8CozCRSHw5nIPseIBAaHSwIhAPTrJ7CqwNSDBRkXIPoVJ1r9v8sKOXmFIQuD9Ey/9mp/"
}
],
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiiWqOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqkLA/9F2LkfOzXeg6+iTT4GXHj8KfjwJTFah0s8zdYwpTW1XmELGe4\r\nxD3ApS5Y4gzb8FeJvIikQX3EJxl+KUYTuNdS4I1VvzpApKp7NA7MS1Cnp0Ag\r\ny0ikhWT5CCqTDOqubxztVIGqWWTWlXZPRPYXJunjA45WZXQd9T6HoQ/sE84G\r\n/rl+LSF6Wa7qtisTuPPMrbDXqrcxowvPQQMrnCxNDy46MPFTekDu3IbC/Sat\r\nr8dKR9J5TfKQFuBIJcHEfjKuZ3KDvg5JKrvuuALsIBnzcsMjT31BUSx3DPjF\r\nYd6vwDF+Qfgpq4ATr8LqvIsTlNhYuaSQDvwgO5KvInDRtAduCIfJ0OWvp2VZ\r\nGp/yh6xL8RJG8UWecl5Lo9wpp8LNqXaL4GLRaFhCvwpv247PVO5lTbf6LuiI\r\n54X3QGUOvQrK4/qW7d0ONhn/lhNvX9YcD0kVSQnZqrxK2YllAwtjq/iNllU1\r\nxlNezqBTL/ZIcYrTTcA0ug7eyL2p6H/GlPDoaLM8J0tEVUZlFpTw8PcwrpNB\r\nDDAYe4eLzeqVYQuV4jUQdl5IOWIrGNQwsWKtuTJnMCZSTHvTBYgbkqjvoYXU\r\nW2Q90CnR52yBKIr2Gm/BQf4jde4vZlVpXQd/c/E2TxBI3zThG60jJUlTLMBQ\r\niio3D69zNOIJ2EMiZs6FhPD4fERkbppnC/s=\r\n=G7lY\r\n-----END PGP SIGNATURE-----\r\n"
}Observed since 20 Oct, 21:25 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:bb112c79a067e33b5e1f7086ecb2f3f14c1295b763405a89bb63bd13efc0b920