Skip to content
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.

shaunhey/sensi-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sensi-client

sensi-client is an unofficial Node.js module for interacting with the Sensi thermostat API. Note: sensi-client is still under active development and should be considered alpha-quality.

Note: as of June 4th, 2018, this module no longer works. Emerson has reworked their API to use an OAuth token and a websocket. There are currently no plans to update this module to support the new API.

Requirements

request for Sensi API connectivity

tough-cookie for http cookie handling

Example

var SensiClient = require("./sensi-client.js");

var options = {
    username: process.env.SENSI_USERNAME,
    password: process.env.SENSI_PASSWORD,
    pollingRetryCount: 5
};

client = new SensiClient(options);
client.on("online", function(data) {
    console.log("Thermostat is online");
    console.dir(data);
});

client.on("update", function(data) {
    console.log("Thermostat update received");
    console.dir(data);
});

client.on("systemModeChanged", function(modeChange) {
    console.log("System mode has changed from " +
        modeChange.oldMode +
        " to " +
        modeChange.newMode);
});

client.on("coolSetpointChanged", function(setpointChange) {
    console.log("Cool setpoint has changed from " +
        setpointChange.oldSetpoint +
        " to " +
        setpointChange.newSetpoint);
});

client.on("heatSetpointChanged", function(setpointChange) {
    console.log("Heat setpoint has changed from " +
        setpointChange.oldSetpoint +
        " to " +
        setpointChange.newSetpoint);
});

client.connect(function(err, thermostats) {
    if (err) {
        console.error("Encountered an error during connect.");
        console.error(err);
        process.exit(1);
    }
    
    if (!thermostats) {
        console.error("The Sensi API did not return any thermostats!");
        process.exit(2);
    }
  
    client.subscribe(thermostats[0].ICD, function(err) {
        if (err) {
            console.error("Encountered an error while subscribing.");
            console.error(err);  
            process.exit(3);
        }
    });
});

Todo

  • Add support for changing temperature, schedule, etc.

About

Sensi thermostat client module for Node.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published