Does anyone have the Nest API ETA feature working?


#1

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?


#2

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


#3

ok thanks! That really helps


#4

I’m trying to use the ETA APIs without success. I have a HTTP bad request error whenever I send the ETA structure even though I follow the syntax from the documentation:

https://developer-api.nest.com/structures/structure_id/eta

Example: “myTripID1024”, “2014-10-31T22:42:00.000Z”, "2016-12-31T23:59:59.000Z"
Parameters

trip_id A user-defined string identifying the trip
estimated_arrival_window_begin A timestamp in ISO 8601 format
estimated_arrival_window_end A timestamp in ISO 8601 format

Here is the request that I send to Nest(I’ve obfuscated some info,and removed the structureId):

doRequest>exception groovyx.net.http.HttpResponseException: Bad Request for https://firebase-apiserverxxxxxxxxxxxxxxxxxxx/structures/structureId/eta
15:52:53: debug doRequest>about to put with uri https://firebase-apiserverxxxxxxxxxxxxxxxxxxx/structures/structureId/eta", (unencoded)args= {“trip_id”:“sample-trip-id”,“estimated_arrival_window_begin”:“2018-01-30T18:00:00.000Z”,“estimated_arrival_window_end”:“2018-01-31T18:59:59.000Z”}

There must be something obvious, but I’m unable to find it…Please help.


#5

Found the issue. The ETA begin time must be few hours/minutes after the current time.


#6

Yeah it’s mentioned in the ETA Guide that it must be greater than NOW, you can’t begin an ETA in the past.

It’s not mentioned in the API Reference, however, so let me get that added there for completeness.


#7

Well, I knew that it shouldn’t be in the past. My point was that the ETA cannot be too far in the future (ex. tomorrow at 8h), it has to be within few minutes/hours of the current time.

The NEST APIs documentation should be clear about that requirement.

Thnx for your time.

Regards.


#8

Ah yes, makes sense. I’ll find out what the exact window is and get it added to the docs as well.