forked from FlorianZ/hadashboard
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'nest_thermostat' | ||
|
||
nest_user = ENV['NEST_USER'] | ||
nest_password = ENV['NEST_PASSWORD'] | ||
|
||
use_metric_system = false | ||
|
||
SCHEDULER.every '1m', :first_in => 0 do |job| | ||
nest = NestThermostat::Nest.new({email: nest_user,password: nest_password}) | ||
first_nest = nest.status["shared"][nest.device_id] | ||
temp = nest.temperature.to_i; | ||
if (use_metric_system) | ||
temp = f_to_c(temp) | ||
end | ||
away = nest.away | ||
state = "off" | ||
leaf_src = "" | ||
|
||
if(first_nest['hvac_ac_state']) | ||
state = "cooling" | ||
elsif (first_nest['hvac_heater_state']) | ||
state = "heating" | ||
end | ||
|
||
if(nest.leaf) | ||
leaf_src = "assets/nest_leaf.png" | ||
else | ||
leaf_src = "assets/nest_leaf_trans.png" | ||
end | ||
|
||
if(away) | ||
temp = "Away" | ||
end | ||
|
||
send_event('nest', { temp: temp , state: state, away: away, leaf: leaf_src }) | ||
end | ||
|
||
# Converts fahrenheit to celcius. | ||
def f_to_c(temp) | ||
return (((input - 32) * 5) / 9) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Dashing.Nest extends Dashing.Widget | ||
|
||
onData: (data) -> | ||
@setBackgroundClassBy data.state | ||
|
||
setBackgroundClassBy:(state) -> | ||
@removeBackgroundClass() | ||
$(@node).addClass "nest-state-#{state}" | ||
|
||
removeBackgroundClass: -> | ||
classNames = $(@node).attr("class").split " " | ||
for className in classNames | ||
match = /nest-state-(.*)/.exec className | ||
$(@node).removeClass match[0] if match | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<img src="assets/nest_logo.png"/> | ||
<h1 data-bind="temp"></h1> | ||
<img data-bind-src="leaf" data-bind-width="width"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.widget-nest { | ||
background: linear-gradient(to bottom, #3b4248 0%,#2a2f34 40%,#222529 100%); | ||
transition: background-color 2s linear; | ||
-moz-transition: background-color 2s linear; | ||
-o-transition: background-color 2s linear; | ||
-webkit-transition: background-color 2s linear; | ||
|
||
h1{ | ||
vertical-align: middle; | ||
font-size: 80px; | ||
font-family: Helvetica; | ||
} | ||
|
||
h3{ | ||
margin-top: -5px; | ||
} | ||
} | ||
|
||
.nest-state-cooling { | ||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1b96ff), color-stop(40%,#0c7bfb), color-stop(100%,#0259f0)); /* Chrome,Safari4+ */ | ||
background: -webkit-linear-gradient(top, #1b96ff 0%,#0c7bfb 40%,#0259f0 100%); /* Chrome10+,Safari5.1+ */ | ||
background: linear-gradient(to bottom, #1b96ff 0%,#0c7bfb 40%,#0259f0 100%); /* W3C */ | ||
} | ||
|
||
.nest-state-heating { | ||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ff7c0a), color-stop(40%,#f94c00), color-stop(100%,#f32800)); /* Chrome,Safari4+ */ | ||
background: -webkit-linear-gradient(top, #ff7c0a 0%,#f94c00 40%,#f32800 100%); /* Chrome10+,Safari5.1+ */ | ||
background: linear-gradient(to bottom, #ff7c0a 0%,#f94c00 40%,#f32800 100%); /* W3C */ | ||
} | ||
|
||
.nest-state-off { | ||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3b4248), color-stop(40%,#2a2f34), color-stop(100%,#222529)); /* Chrome,Safari4+ */ | ||
background: -webkit-linear-gradient(top, #3b4248 0%,#2a2f34 40%,#222529 100%); /* Chrome10+,Safari5.1+ */ | ||
background: linear-gradient(to bottom, #3b4248 0%,#2a2f34 40%,#222529 100%); /* W3C */ | ||
} |