Casey
Casey

Reputation: 11

When can we get access to nest autoaway status?

Let me stress that I am not a programmer but I like messing around with things. I've been using @ifttt and @nest for years and recently started using @smartthings to do cool things in my house.

I wanted to power off devices such as my lights and water heater based on leaving my house. Rather than having this depend on one device such as a phone or keyfoob, I wanted to use the nest "auto-away" feature.

Auto-away doesn't appear to be exposed to @ifttt or @smartthings. I've asked @nestsupport and they told me to come here :-o.

Does anyone from nest developer team know when developers and other products will be able to consume this from he nest device? Its a real shame that after several years this isn't exposed yet. Not only that but it could be an additional selling point to integrate and turn on/off items in your house.

Thank

Upvotes: 1

Views: 436

Answers (3)

Brandon Miller
Brandon Miller

Reputation: 1

There are a few ways you could go about doing this, but if you're writing up a SmartApp just for your own uses, I'd suggest piggybacking off of one of the existing device types for the Nest on SmartThings. As a quick example, I'll use the one that I use:

https://github.com/bmmiller/device-type.nest/blob/master/nest.devicetype.groovy

After line 96, this is to expose the status to any SmartApp you may write:

attribute "temperatureUnit", "string"
attribute "humiditySetpoint", "number"
attribute "autoAwayStatus", "number"     // New Line

Now, you'll want to take care of getting the data in the existing poll() method, currently starting at line 459.

After line 480, to update the attribute

sendEvent(name: 'humidity', value: humidity)
sendEvent(name: 'humiditySetpoint', value: humiditySetpoint, unit: Humidity)
sendEvent(name: 'thermostatFanMode', value: fanMode)
sendEvent(name: 'thermostatMode', value: temperatureType)
sendEvent(name: 'autoAwayStatus', value: data.shared.auto_away)     // New Line

This will expose a numerical value for the auto_away status.

  • -1 = Auto Away Not Enabled
  • 0 = Auto Away Off
  • 1 = Auto Away On

Then, in your SmartApp you write, where you include an input of type thermostat like this:

section("Choose thermostat... ") {
    input "thermostat", "capability.thermostat"
}

You will be able to access the Auto Away status by referring to

thermostat.autoAwayStatus 

From anywhere in your code where you can do something like

if (thermostat.autoAwayStatus == 1) {
     // Turn off everything
}

Upvotes: 0

urman
urman

Reputation: 596

Auto-Away is and always has been readable https://developer.nest.com/documentation/cloud/api-overview#away

Upvotes: 0

olimortimer
olimortimer

Reputation: 1373

I'm not from the Nest developer team, but I've played around with the Nest API in the past, and use it to plot my energy usage.

The 'auto away' information is already accessible in the API, and looks to be used in a number of IFTTT recipes:

https://ifttt.com/recipes/search?q=auto+away&ac=false

Within the (JSON) data received back in the API, the 'auto away' status is accessible via;

shared->{serial_number}->auto_away

This is set as a boolean (0 or 1).

If you like messing around with code, and know any PHP, then this PHP class for the Nest API is very useful at grabbing all information etc;

https://github.com/gboudreau/nest-api

Upvotes: 1

Related Questions