Code Monkey home page Code Monkey logo

nest_thermostat's Introduction

Nest Thermostat

Gitter

This gem allows you to get and set the temperature of your Nest Thermostat. You can also get and set the away status and get the current temperature and target temperature time.

Installation

Add this line to your application's Gemfile:

gem 'nest_thermostat'

And then execute:

$ bundle

Or install it yourself as:

$ gem install nest_thermostat

Usage

Get some useful info:

nest = NestThermostat::Nest.new(email: ENV['NEST_EMAIL'], password: ENV['NEST_PASS'])
puts nest.current_temperature   # => 75.00
puts nest.current_temp          # => 75.00
puts nest.temperature           # => 73.00
puts nest.temp                  # => 73.00
puts nest.temp_high             # => 77.00
puts nest.temp_low              # => 71.00
puts nest.temperature_high      # => 77.00
puts nest.temperature_low       # => 71.00
puts nest.target_temperature_at # => 2012-06-05 14:28:48 +0000 # Ruby date object or false
puts nest.target_temp_at        # => 2012-06-05 14:28:48 +0000 # Ruby date object or false
puts nest.away                  # => false
puts nest.leaf                  # => true # May take a few seconds after a temp change
puts nest.humidity              # => 54 # Relative humidity in percent

Change the temperature or away status:

puts nest.temperature # => 73.0
puts nest.temperature = 74.0
puts nest.temperature # => 74.0

puts nest.temperature_high # => 75.0
puts nest.temperature_high = 74.0
puts nest.temperature_high # => 74.0

puts nest.temperature_low # => 65.0
puts nest.temperature_low = 67.0
puts nest.temperature_low # => 67.0

puts nest.away? # => false
puts nest.away = true
puts nest.away? # => true

By default, temperatures are in :fahrenheit, but you can change this to :celsius or :kelvin:

nest = NestThermostat::Nest.new(..., temperature_scale: :celsius)

# -- OR --

nest.temperature_scale = :kelvin

And of course if you want to get lots of other goodies, like scheduling and every diag piece of info you'd ever want:

p nest.status

# -- OR --

require 'yaml'
yaml nest.status

# -- OR my favorite --

require 'ap' # gem install awesome_print
ap nest.status

Feel free to implement anything you see useful and submit a pull request. I'd love to see other information like scheduling or multiple device/location support added.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

nest_thermostat's People

Contributors

ericboehs avatar dwradcliffe avatar evanscottgray avatar stevenpetryk avatar gitter-badger avatar

Watchers

James Cloos avatar

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.