Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nest Thermostat temperature not getting updated

I am trying to change the temperature of my Nest programmatically (Android), without any luck. Requests work maybe 1 in 30-50 tries.

I have tried doing it through the Firebase Nest SDK, and the NestAPI.CompletionListener doesn't get called at all. Seeing how that doesn't work, I tried it with the REST api, where it worked twice, and then again 1 in 30 tries. I also tried it with curl from the command line, with the same results, until I finally got "blocked" because of the rate limiting. Before being blocked, requests were returning the full thermostat object, just like doing a GET request instead of PUT.

When the temperature actually did get updated, the response contained just the new target_temperature_high_c and target_temperature_high_c values.

Has anyone else seen similar behavior ?

Edit: added some code below

Here's my code using the Nest Android API (based on Firebase):

NestAPI.CompletionListener completionListener = new NestAPI.CompletionListener() {
    public void onComplete() {
        Debug.d("NEST", "request complete");
    }
    public void onError(int errorCode) {
        Debug.e("NEST", "error: "+errorCode);
    }
};
NestAPI.getInstance().setTargetTemperatureHighC(myNest.getDeviceID(), 25, completionListener);

This only works if I make that call once an hour. If I even try to do it twice, the second try doesn't work.

Next, I tried with the REST interface. This seems work more often (worked 5-6 times, after which it the API started acting like I was doing GET requests instead of PUT.

JSONObject dataToSend = new JSONObject();
dataToSend.put("target_temperature_low_c", 23);
dataToSend.put("target_temperature_high_c", 26);

HttpPut httpost = new HttpPut("https://developer-api.nest.com/devices/thermostats/"+myNest.getDeviceID()+"?auth="+myAuthToken);
httpost.setHeader("Content-type", "application/json");

httpost.setEntity(new StringEntity(dataToSend.toString()));
HttpResponse response = defaultHttpClient.execute(httpost);
HttpEntity entity = response.getEntity();

String response = convertStreamToString(entity.getContent());

Edit 2: Just tested this with the Nest Home Simulator, and it works perfectly fine. The real hardware is problematic though

like image 960
zrgiu Avatar asked Dec 14 '15 00:12

zrgiu


People also ask

Why is my Nest thermostat not updating?

If your thermostat isn't connected to a Google Account, it can't download updates. Someone may have manually disconnected the account in the thermostat settings, or there could be another issue. Account. If it's not connected to an account, remove your thermostat from the Home app.

Why is my Nest not reaching target temperature?

It's normal for your home's temperature to vary slightly above or below the temperature set on your thermostat for a short while. This is often due to the built-in delay for turning on your system. This delay is commonly called the maintenance band, deadband, differential, or temperature swing.

How do I refresh my Nest thermostat?

Press your thermostat ring and hold it down until the screen turns off (about 10 seconds). Then let go of the ring. Press and release the ring to turn it back on and complete the restart process. The Nest logo will appear when it begins to start up.


1 Answers

From the javadocs for setTargetTemperatureHighC it says https://github.com/nestlabs/android-NestDK/blob/master/NestLib/src/main/java/com/nestapi/lib/API/NestAPI.java#L111

This value is only relevant when in "Heat and Cool" mode. Otherwise, see {@link #setTargetTemperatureC(String, Long, com.nestapi.lib.API.NestAPI.CompletionListener)}

You can check the mode using Thermostat.getHVACMode()

and if it is not in Heat and Cool mode you should use:

NestAPI.setTargetTemperatureC

i.e. if you where telling the Nest device to go to a temperature of 50deg's when it's current temp was 30deg and it was in "cool" mode - it would ignore you.

(This maybe why it worked once, as you asked it to warm up, when it was in heat mode - once it hits this temperature it could go into cool mode and asking it to heat more will be ignored.)

like image 143
Blundell Avatar answered Sep 26 '22 07:09

Blundell