"use strict";
var Cylon = require("cylon");
Cylon.robot({
connections: {
nest: { adaptor: "nest", accessToken: "MY_ACCESS_TOKEN" }
},
devices: {
thermostat: { driver: "nest-thermostat", deviceId: "DEVICE_ID" }
},
work: function(my) {
my.thermostat.on("status", function(data) {
console.log("The Thermostat at a glance--->", data);
});
every((30).seconds(), function() {
console.log("NEST ambient temp C:", my.thermostat.ambientTemperatureC());
console.log("NEST ambient temp F:", my.thermostat.ambientTemperatureF());
console.log("NEST target temp F:", my.thermostat.targetTemperatureC());
console.log("NEST target temp F:", my.thermostat.targetTemperatureF());
my.thermostat.read("away_temperature_high_c", function(data) {
console.log("Away Temp High C on read callback -->", data);
});
});
}
}).start();