Problems connecting to Nest

Hello all!

I am having a problem with my Nest binding and was hoping someone could help me out.

It started very normal…

Added necessary configuration in openhab.cfg and created one item

String nest_home_away "Home/Away" (Nest) { nest="=[structures(Home).away]" }

The problem is, however the URL that is being hit

https://developer-api.nest.com/?auth=c.fdC052iQ0j_blah_blah_blah

only returns the metadata object and nothing related to my devices. So, as a result, I’m getting bunch of

2016-10-05 06:04:22 ERROR - Unable to get state from data model
org.apache.commons.beanutils.NestedNullException: Null property value for 'structures(Home).away' on bean class 'class org.openhab.binding.nest.internal.messages.DataModelResponse'
	at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:755) ~[commons-beanutils-1.8.3.jar:1.8.3]
	at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:846) ~[commons-beanutils-1.8.3.jar:1.8.3]
	at org.openhab.binding.nest.internal.messages.DataModel.getProperty(DataModel.java:339) ~[bundlefile:na]
	at org.openhab.binding.nest.internal.NestBinding.getState(NestBinding.java:238) [bundlefile:na]
	at org.openhab.binding.nest.internal.NestBinding.readNest(NestBinding.java:206) [bundlefile:na]
	at org.openhab.binding.nest.internal.NestBinding.execute(NestBinding.java:168) [bundlefile:na]
	at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156) [org.openhab.core_1.8.3.jar:na]
	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) [org.openhab.core_1.8.3.jar:na]

I have created and re-created nest applications and generated multiple pin codes all to end up at the same place

Oh, I’ve updated the nest binding from 1.8.3 to the latest snapshot build

Thanks for the help!

My suspicion is that the permissions in the Nest product you defined at the developer site are incomplete, particularly missing the ability to read structures. If this is correct, edit the product to have all the permissions you need, create a new PIN for your account and update openHAB.cfg, and restart the openHAB server.

Thanks for the reply!

I am not seeing where to set that permission. As of now, I have every available option enabled with read/write permission. The only options that are not enabled are: Product Data and Camera as they are grayed out.

Am I missing somethign?

P.S. Here’s my permission settings.

The “Away” permission actually refers to the structure, so it looks like you are covered for permissions.

That’s odd that Camera would be unavailable, but perhaps you didn’t set a permission for it when you created/last edited the product. It shouldn’t be related to this issue though.

If you see the JSON payload response and it has nothing about your devices, then all I can think of is that you somehow authorized some other Nest account than the one that contains your devices and structures, or there is some problem at the Nest servers. There had been a report awhile back about bad data coming back from the Nest servers that was eventually made right.

If neither of those are possible, consider defining a totally new Product, update openhab.cfg with the new key, secret and PIN, and restart the openHAB server.

yeah, I’ve already recycled 2 products and generated a dozen of pins…

Here’s the payload I’m getting:

2016-10-05 16:48:03 TRACE - {"metadata":{"access_token":"c.3YAh6XtrRa7c1_blah_blah_blah","client_version":1}}
2016-10-05 16:48:03 TRACE - Retrieved data model: DataModelResponse[devices=<null>,structures=<null>]

As for the permissions for camera and product data, I think that’s for hardware developers. I have to register a device with Nest and they would allow me to access those APIs

By “recycled,” do you mean you created a new Product attempting to resolve this issue? I don’t know if there is anything unexpected about the older Products.

I don’t know why, if you use the Authorization URL against the Nest account where your devices and structures are and produces a PIN you copy into openhab.cfg, that the binding would not have all of your devices and structures in the JSON payload. The only possibility I can think of is a problem on the Nest API side. Perhaps Nest Support should hear about it?

By recycled, I meant that I’ve destroyed the product and created a new one. Brand new set of tokens, keys, codes…

I’ll ping nest and, if they’ll reply, I’ll update this thread.

Thanks for the help.

Quick update…

I chatted with tech support and they told me that I should call them up with my case id…

While I was doing that, I tried curling the whole thing (from getting the bearer token to calling the developer-api.nest.com endpoint) and, after being redirected to firebase, I’m not seeing anything other than the metadata segment.

I’ll call them up later today and will update with my findings.

1 Like

Back with another update…

After spending 40 minutes with Nest tech support, I was told that they cannot help me and referred me to their forum… After a LOT of searching for the developer portal, I ended up on the stack overflow with a nest-api tag. I’m still waiting for my question to be answered there. Once it’s answered, I’ll post another update here.

If you are interested, here’s the link to my OS question.

I know it would be very tedious to do, but if you created a new Nest account and associated one or more of your devices with it and authorised the app with it with a new PIN, would the devices show up via the API?

Same results, sadly…

I don’t see why this would be a problem, BUT…

I’m currently in the middle of switching from a full blown PC to a Raspberry Pi and I’m gradually moving bindings over. As of now, I have Nest on both computers and, my original machine has nest binding that is performing as it should…

What are the odds of Nest prohibiting multiple “products” talking to the same structure and device?

I’ve not seen that in my setups. But are your “Max users” settings not high enough?

At https://developers.nest.com/products

Oh yeah, I have 50 user limit with 1-2 users on a product.

Regards,

dimaj

The symptoms of this problem make no sense, as I understand them. You have a perfectly functioning Nest binding on a PC, but you’ve tried just about every possible change to make it work on a Raspberry Pi, and even completely outside of openHAB, you only get the “metadata” message in the JSON payload.

All I have left to suggest is to go back over your changes and check the “science” of your tests and observations to make sure you’re seeing what you believe you are. This is certainly a weird one…

what do you mean by:

All I have left to suggest is to go back over your changes and check the “science” of your tests and observations to make sure you’re seeing what you believe you are.

Oh, I should also mention, that my very first attempt was to copy nest binding configuration exactly as it appeared on my PC.

It’s just such a strange situation that, unless there is some obscure detail we missed, the problem has to be on the Nest API side. So my comment was just a suggestion to step through everything you did as an additional check.

The Nest binding saves its tokens using the Java Preferences API. On Linux, this is kept by default under the ~/.java/.userPrefs directory, under further directories with irritatingly difficult directory names (I press TAB at a Linux command prompt to help expand the directory name). You could delete part or all of the .userPrefs directory tree and restart openHAB, just to see if some bit of configuration is stuck somehow (but I’ve tested this in the past and it wasn’t needed).

So that’s the sum total of my advice on sorting this out. I hope you have a Eureka! moment and get it working!

thanks!

Unfortunately, it would seem that Eureka is on vacation for the time being…

One more question… after performing GET request on

https://developer-api.nest.com/blah.blah.blah

I end up on:

https://firebase-apiserver03-tah01-iad01.dapi.production.nest.com:9553/blah.blah.blah

Does that sound about right?

Yes: the API does 307 redirects to edge servers.

cool.
just making sure.

so, this is a hack and it’s working for me for the time being (but I don’t like it and I’m hoping I’ll get some answers from Nest as to what’s going on)…
I’ve basically copied the prefs.xml file from my working PC onto my Raspberry Pi and I’m able to get some data.

Thank you @watou for all your help with this! Much appreciated!