Skip to content

Commit

Permalink
Merge branch 'readme-improvements'
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Petryk committed Dec 17, 2014
2 parents 4abae8b + 5bd7555 commit e85b007
Showing 1 changed file with 28 additions and 60 deletions.
88 changes: 28 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Nest Thermostat

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.
This gem allows you to get and set the temperature of your [Nest Thermostat](https://nest.com/thermostat). You can also get and set the away status and get the current temperature and target temperature time.


## Installation

Expand All @@ -18,91 +17,60 @@ Or install it yourself as:

$ gem install nest_thermostat


## Usage

Get some useful info:
```ruby
@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.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
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.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:
```ruby
puts @nest.temperature # => 73.0
puts @nest.temperature = 74.0
puts @nest.temperature # => 74.0
puts nest.temperature # => 73.0
puts nest.temperature = 74.0
puts nest.temperature # => 74.0

puts @nest.away? # => false
puts @nest.away = true
puts @nest.away? # => true
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`.
By default, temperatures are in `:fahrenheit`, but you can change this to `:celsius` or `:kelvin`:
```ruby
@nest = NestThermostat::Nest.new(..., temperature_scale: :celsius)
nest = NestThermostat::Nest.new(..., temperature_scale: :celsius)

# -- OR --

@nest.temperature_scale = :kelvin
nest.temperature_scale = :kelvin
```

And of course if you want to get LOTS of other goodies like (schedule and every diag piece of info you'd ever want):
And of course if you want to get *lots* of other goodies, like scheduling and every diag piece of info you'd ever want:
```ruby
p @nest.status
p nest.status

# -- OR --

require 'yaml'
yaml @nest.status
yaml nest.status

# -- OR my favorite --

require 'ap' # gem install awesome_print
ap @nest.status
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.


## Alfred Extension

If you use Alfred.app for OS X you may be interested in an extension.
[Download it](http://erc.bz/HtOe). You'll need ruby 1.9+ and this gem
installed. Then just enter your nest email/pass as the arguments in the
alfred extension (after you import it).

![Screenshot of Alfred Extension](http://erc.bz/H9Hm/Image%202012.06.05%202:18:56%20PM.png) ![Screenshot of Alfred Extension Growl Output](http://erc.bz/H97m/Image%202012.06.05%202:34:49%20PM.png)
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.


Here are the commands it supports:
```
nest # => Your Nest is set to 73°F
nest 72 # => Your Nest was set to 72°F
nest current # => The current temperature is currently 71.51°F
nest leaf # => The leaf is off; you can fix that! (or: The leaf is on; you are energy efficient!)
nest away # => Your Nest is now set to away (or: Your Nest is now set to home.)
nest home # => Your Nest is now set to home
nest humidity # => The relative humidity is currently 53%
nest until # => Your home will reach it's target temperature at 7:30pm
nest ip # => The current ip address is 5.68.127.16. I placed it in your clipboard.
```

There are some aliases as well:
```
nest current | current temp | current temperature
nest home | back
nest leaf | green
nest until | til | time
```

## Contributing

1. Fork it
Expand Down

0 comments on commit e85b007

Please sign in to comment.