How to query auto-away status in lua?

Hi folks,

I’m using the auto-away feature of the Nest as a trigger to turn off a power outlet so I can save electricity on due to certain devices being in standby mode. I’ve also got Vera to switch the same outlet off over night, again to save power. However it makes no sense for me to power that outlet back up in the morning if Nest knows we’re away (auto away = AWAY). But how do I get that auto-away status in lua?


The Nest thermostat has two distinct “away” concepts: one is the “auto away” mode which switches the house to “away” mode automatically after some period of time of not detecting movement (either by thermostats or the Protect smoke/CO detector). The other concept is the home vs. away mode, which will either be controlled manually by you from the physical thermostat, web, mobile app, or Vera, and/or set to away automatically as described. So I think you’re interested in the second concept, the simple home vs. away switch trigger and setting.

You can use the trigger for the home device for Nest when the device is set to home or set to away. Or, in Lua you can do something like this:

[code]local HOME_DEVICE = 37 – replace 37 with the device ID of your Nest home/away device
local isHome = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, HOME_DEVICE) == “1”

if isHome then
– do something when the home device is set to home
– do something when the home device is set to away

So if you want to use the changing of the status as the trigger, it’s available in Vera UI. Or, in whatever other Lua code you’re using, you can use something like the snippet above to determine the current state.


Thank you watou, I think that’s just what I wanted :smiley: