node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


A node.js client for controlling BAYweb Internet thermostats.

Build Status


Simply create a new Thermostat using the ID and Key from your BAYweb Cloud EMS account. The callback is optional. If you provide one, then the thermostat data will be immediately fetched from Cloud EMS.

var Thermostat = require('bayweb');
var stat = new Thermostat('ID', 'APIKEY', function(err) {
  if (err)
    console.log('Error fetching data from BAYweb server: ' + err);
    console.log('Loaded data from BAYweb server!');

Once data is fetched, you can access the following properties...

stat.insideTemp;       // integer indoor temperature 
stat.insideHum;        // integer humidity reading 
stat.activitySetPoint; // integer set point of current activity 
stat.outsideTemp;      // integer outdoor temperature (provided by outdoor sensor or Cloud EMS) 
stat.outsideHum;       // integer outdoor humidity (provided by Cloud EMS) 
stat.windMph;          // integer wind speed (provided by Cloud EMS) 
stat.solarIndex;       // integer solar index (provided by Cloud EMS) 
stat.doorOpen;         // boolean is the door open? 
stat.relay1;           // boolean is relay 1 (w2) open? 
stat.relay2;           // boolean is relay 2 (y2) open? 
stat.input1;           // if digital, boolean is input open? otherwise, integer temperature 
stat.input2;           // if digital, boolean is input open? otherwise, integer temperature 
stat.input3;           // if digital, boolean is input open? otherwise, integer temperature 

In addition, the following properties can be accessed and modified...

stat.activity;         // string 'occupied', 'away 1', 'away 2', or 'sleep' 
stat.mode;             // string 'off', 'heat', or 'cool' 
stat.hold;             // boolean true to hold temperature;              // string 'auto' or 'on' 
stat.setPoint;         // integer value of the desired temperature set point 

Make changes and save them to Cloud EMS...

// set thermostat 
stat.mode = 'cool';
stat.activity = 'occupied';
stat.setPoint = 76;
// save settings {
  if (err)
    return console.err(err)

Refresh data from Cloud EMS...

stat.fetch(function(err) {
  if (err)
    console.log('Error fetching data from BAYweb server: ' + err);
    console.log('Loaded data from BAYweb server!');