Benjamin Kraus
Benjamin Kraus

Reputation: 31

Does anyone have the Nest API ETA feature working?

I am trying to write a simple JavaScript based website that can read and write ETA values to my Nest. I am using the code below.

I think I have been able to set the ETA, but I don't see any indication that anything changed. The thermostat does not turn on at the specified time, and the ETA field does not show up in subsequent data requests.

I'm pretty sure setting the value is successful, but I could be wrong. If I intentionally mistype the date strings, I get an error message. But when I use the code below to set the ETA, I see no error messages (or any output at all). I am taking the lack of output as success (I see similar behavior when setting the home/away state, which I am able to verify worked as expected).

I am setting the value like this:

var nest = new Firebase('wss://developer-api.nest.com');
// Authentication and connection code omitted.
function setETA(structureID, minutes) {
    var structureNode = nest.child("structures/" + structureID + "/eta");
    var d = new Date();

    d.setTime(d.getTime() + (minutes*60*1000));
    var estimated_arrival_window_begin = d.toISOString();

    d.setTime(d.getTime() + (60*60*1000));
    var estimated_arrival_window_end = d.toISOString();

    console.log(estimated_arrival_window_begin);
    console.log(estimated_arrival_window_end);
    console.log('Structre ID: ' + structureID);

    structureNode.set({
        "trip_id":"sample-trip-id",
        "estimated_arrival_window_begin": estimated_arrival_window_begin,
        "estimated_arrival_window_end": estimated_arrival_window_end
    });
}

Even after running that code, there is no "eta" field in the structures object. I tried the code above with 2 minutes, and then waited a few minutes, and the thermostat did not automatically change back to home. Should this happen? Or is it assumed that whatever application is creating the ETA will be setting the Nest to "home" once the time has elapsed?

My main purpose for trying to use the ETA is to get the Nest to start warming up in anticipation of my arrival home. My goal is to be able to say "I'll be home in 3 hours", and have my Nest automatically turn on the heat not immediately, but early enough to have my house warm when I arrive.

Has anybody else had any success using the ETA feature of the Nest API? Any guesses as to why I cannot read the ETA value?

Upvotes: 3

Views: 761

Answers (1)

Owen Johnson
Owen Johnson

Reputation: 2526

When you send ETA data to the API, the thermostat uses it as one of many inputs to decide whether or not to activate the hvac equipment. Over time, it will try to determine whether the ETA data from your application is accurate. If it thinks it is accurate, it will use it to activate the heating/cooling system.

To use it successfully, you need to put ETA objects like you did above (multiple over time works better). If your ETA estimates are accurate, nest will use them.

As for reading the ETA data, they have intentionally disabled that and haven't specified a reason. My guess is privacy.

I've got a successful example here in my windows phone app.

Upvotes: 0

Related Questions