thing-it-device-radio-thermostat
Version:
[thing-it-node] Device Plugin for Radio Thermostat WiFi Edition
82 lines (66 loc) • 1.81 kB
JavaScript
/**
* This test file allows to run the basic initiation of the
*
* radioThermostat class. It does not, however, simulate full
* interaction with the node.
*/
var RadioThermostat = require('../radioThermostat');
var radioThermostat = RadioThermostat.create({});
console.log(radioThermostat);
radioThermostat.isSimulated = function () {
return true;
};
radioThermostat.configuration = {
simulated: false,
host: "10.0.1.6",
name: "Thermostat",
updateInterval: "5000"
};
radioThermostat.node = {
options: {dataDirectory: "/Users/Klaus/tin/data"}, isSimulated: function () {
return false
}
};
radioThermostat.publishEvent = function(event, data){
console.log("Event", event);
};
radioThermostat.publishStateChange = function(){
console.log("State Change", this.state);
//console.log("State Change");
};
radioThermostat.logInfo = function () {
if (arguments.length == 1) {
console.log(arguments[0]);
}
else {
console.log(arguments);
}
};
radioThermostat.logDebug = function () {
radioThermostat.logInfo(arguments);
};
radioThermostat.logError = function () {
radioThermostat.logInfo(arguments);
};
console.log("About to start.");
radioThermostat.start();
setTimeout(function () {
console.log("Decrementing setpoint.");
radioThermostat.decrementSetpoint();
}, 7000);
setTimeout(function () {
console.log("Incrementing setpoint.");
radioThermostat.incrementSetpoint();
}, 12000);
setTimeout(function () {
console.log("Toggling hold.");
radioThermostat.holdToggle();
}, 17000);
setTimeout(function () {
console.log("Toggling hold.");
radioThermostat.holdToggle();
}, 22000);
setTimeout(function () {
console.log("Toggling hold.");
radioThermostat.modeCool();
}, 27000);