[Solved] Nest Binding and Protect Home/Away Status

So I only have Nest Protects in my house. I see that the Nest app does show home/away but when I try to pull in the Nest status through the binding (and yes, I use “Home” in the Nest app):

String Sensor_Nest_Mode "Home Mode [%s]" {nest="=[structures(Home).away]"}

I only get an empty value in my Sitemap

Text item=Sensor_Nest_Mode

Any suggestions would be greatly appreciated

Does anything appear in openhab.log? If not, could you turn on TRACE logging for org.openhab.binding.nest ?

@watou Only a couple of warnings, the most recent one 2 days ago:

[WARN ] [ab.binding.nest.internal.NestBinding] - Exception reading from Nest: Could not get data model.

I’ll give TRACE logging a try.

@watou Here you go:

Thanks for the trace log. (I recommend you delete it from your Drive account now and/or create a new Product and PIN to invalidate the access token.)

The away state was not given in the JSON payload, and my theory is that the product you defined does not have the “Away read/write” permission defined, so it was not included. Example of permissions I’m talking about:

Please make sure you have enabled all the permissions you might use in the product including Away read/write, and log in to the main Nest web interface to accept the update of the product. This ought to cause the next JSON payloads to include the away state, and allow you to change it from openHAB.

Please let me know if this works for you.

Regards, John

Thanks @watou. Weird, I ran a search to make sure the pin wasn’t in the file, not sure why it didn’t see it. Will reset, thanks.

I’ll try redefining the product this weekend. Thanks for the guidance.

The PIN isn’t in the log, but the access token is. Probably too hard to use without the product id and key, but I’ll leave it to you. I hope my advice sorts out the issue with .away not appearing the JSON!

@watou Ah, didn’t think about that. It’s ok, redoing the product required an update.

So I added the Away permissions:

Then reauthorized the product and put the new pin in my Nest binding config (through Paper UI). Even restarted OpenHab. Trace is still showing Away=Null in the logs and the values are empty.

Any other ideas (could do a full binding uninstall / reinstall)? Maybe because it’s a Protect I should set the Away as read only?

Thanks again.

If you are certain that the Product that the binding is now using has the Away permission, my reading of the API documentation is that it ought to be delivered in the JSON payload it returns to the binding. I don’t see how uninstalling and re-installing the binding would make any difference. The only remaining suggestions I can offer are:

  1. Completely delete the Product at developers.nest.com, create a new Product with all the permissions you could ever use, enter the key, secret and PIN in the binding configuration, and see if structures(Home).away returns a value.
  2. Send a “home” or “away” command to the item bound to `nest=“=[structures(Home).away]” and see if the API accepts it or if an error is logged.
  3. Have a thorough read of the API documentation to see if I’ve somehow misread the conditions under which which the .away value should be returned in the situation where there is no thermostat in the structure, only Protects.
  4. See if there is a way to report a problem to Nest regarding either a bug or a lack of documentation.

I have two Nest structures but neither doesn’t have a thermostat, and I’m not in a situation to remove the thermostat to see if that makes a difference.

@watou Now we are good to go.

I think the issue might have been that I had an old nest.cfg file in my conf/services with an old pin so that might have been not letting the new permissions through. Either way, I deleted and setup a new product (I did Read Only on Away) and now we are getting data.

Thanks for all the help and the work on the binding. Now if Nest/Google will just expose the individual protect occupancy status I could get even more value from my Protects on a room by room basis :wink:

1 Like