Code Monkey home page Code Monkey logo

hello-sense's Introduction

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: '[email protected]',
                           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

hello-sense's People

Contributors

stilist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hello-sense's Issues

How to use?

I'm so sorry if this is in improper format or anything, I'm new to GitHub and Source and anything like that. I was wondering how exactly you use this? I recently bought a sense without realizing it wouldn't work. Also, is this a direct link from the sense to the program? Or just a recreation of the entire sense system? Thank you so much.

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.