0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Ruby implementation of Sense's private API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 9.0.0, ~> 9.0
>= 11.0.0, ~> 11.0
>= 3.6.0, ~> 3.6
>= 3.6.0, ~> 3.6
>= 0.48.0, ~> 0.48
>= 0.9.0, ~> 0.9
 Project Readme

hello-sense

Installation

gem install hello-sense

Usage

Authentication

The Sense API relies on an OAuth 2 access token.

(Note: the client_id and client_secret shown here are taken from the official Sense app's source code.)

# Create a session using email and password.
client = Sense::Client.new(client_id: '8d3c1664-05ae-47e4-bcdb-477489590aa4',
                           client_secret: '4f771f6f-5c10-4104-bbc6-3333f5b11bf9',
                           username: 'drisha.wabudeya@example.org',
                           password: 'My super secure password!')
# Create a session using an existing access token.
client = Sense::Client.new(access_token: '2.fded667b9e9143f591de258ac1fee9c2')
# Get the timeline for the sleep session from the night of 31 December 2016.
client.timeline('2017-01-01')

# Get the current conditions reported by the device's sensors.
client.sensors
# Invalidate the session's access token.
client.destroy_token
# Pull in ~38 days of sensor data, sampled at 5 minute intervals.
data = client.sensors_historical(hours: 920)
File.open('sense_sensor_data.json', 'w') { |f| f.write(JSON.dump(data) }

Contributing

To contribute to the hello-sense gem, please see CONTRIBUTING.

References