Hi there. Super new to OH, but am enjoying building my config out.
Hoping someone can help me out with the Nest binding. I am fairly certain I’ve gone about following the Nest binding Wiki section correctly, but when I go to set Away mode my log spits this out:
2015-11-22 21:29:11.557 TRACE o.o.b.n.internal.NestBinding[:256]- internalReceiveCommand(item='home_away', command='away')
2015-11-22 21:29:11.560 DEBUG o.o.b.n.internal.NestBinding[:322]- About to set property 'structures(Home).away' to 'away'
2015-11-22 21:29:11.598 ERROR o.o.b.n.internal.NestBinding[:355]- Unable to update data model
java.lang.NullPointerException: null
at org.openhab.binding.nest.internal.NestBinding.updateNest(NestBinding.java:325)
at org.openhab.binding.nest.internal.NestBinding.commandNest(NestBinding.java:281)
at org.openhab.binding.nest.internal.NestBinding.internalReceiveCommand(NestBinding.java:257)
at org.openhab.core.binding.AbstractBinding.receiveCommand(AbstractBinding.java:96)
at org.openhab.core.events.AbstractEventSubscriber.handleEvent(AbstractEventSubscriber.java:42)
at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
I am running OH 1.70 on an RPI2 Raspbian wheezy - java is 1.8.0
To clarify, it appears to be that everything Nest related is not functioning. The last check-in shown is just blank, and I am not getting a humidity reading off of the thermostat, either.
The exception is caused by not having successfully polled the Nest API earlier, which is where the problem lies. Please turn on TRACE logging per the wiki to help identify the root cause.
The binding can’t set “away” mode until it has completed at least one polling cycle, because it uses the name of the structure “Home” to identify the specific structure to send the command to. The binding learns all the names of structures, thermostats, smoke+CO detectors and cameras after it’s performed its first polling cycle, which usually happens very soon after the binding starts. You attempted to send the “away” command almost three minutes after the binding started, but there is no evidence that the binding attempted to perform a poll in that period of time, which I don’t have an explanation for yet.
Could you share the lines in your openhab.cfg file that start with nest: (but scramble some of the letters to the right of the = sign for security’s sake)?
Did the initial setup process of creating a “product” at nest.com appear to follow the wiki instructions, and then were you presented with a PIN that you added to openhab.cfg?
Thanks so much for helping me out. The Wiki was pretty much spot-on from what I recall. Client ID was populated with the Product ID, Client Secret was populated with Product Secret, and for the PIN I visited the Authorization URL. Here is my openhab.cfg - thanks for the reminder to use bogus values
# Data refresh interval in ms (optional, defaults to 60000)
nest:refresh=60000
# the Nest Client ID needed to use the API, must be supplied (this is Product ID)
nest:client_id=08daghfoasdfhsaldfadasdfdbe
# the Nest Client Secret needed to use the API, must be supplied (Product Secret)
nest:client_secret=qOMS9KSaksldjfha098sd7f2
# the PIN code that Nest presented when you authorized the above client, must be supplied
nest:pin_code=asdiufhoaisdf902834
I’ve never put spaces before a config choice before. I don’t know it to be wrong, but could you remove the leading spaces? Also, your PIN code is how many letters long? Lastly, what OS are you running on and if you type
ls -al ~/.java
Do you see a .userPrefs directory? If you remove it and restart openHAB, does it make a difference?
Spaces removed, but same symptom.
PIN is 8 characters long.
Running Raspbian wheezy on an RPi2.
ls -al ~/.java doesn’t return anything, but I can run java -version:
java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode)
I deleted the .userPrefs directory, and now I seem to have lots of new messages in nest.log:
2015-11-25 16:27:39.080 TRACE o.o.b.n.internal.NestBinding[:128]- Querying Nest API
2015-11-25 16:27:39.082 TRACE o.o.b.n.internal.NestBinding[:570]- Retrieving access token in order to access the Nest API.
2015-11-25 16:27:39.084 TRACE o.o.b.n.internal.NestBinding[:573]- Request: AccessTokenRequest[pinCode=xxxxxxxx,clientId=xxxx,clientSecret=xxxx]
2015-11-25 16:27:39.086 TRACE o.o.b.n.i.m.AbstractRequest[:125]- About to execute 'https://api.home.nest.com/oauth2/access_token?code=xxxxxxxx&client_id=xxxxxclient_secret=xxxxgrant_type=authorization_code'
2015-11-25 16:27:39.527 WARN o.o.b.n.i.m.AbstractRequest[:147]- Method failed: HTTP/1.1 400 Bad Request
2015-11-25 16:27:39.529 TRACE o.o.b.n.i.m.AbstractRequest[:166]- {"error":"oauth2_error","error_description":"authorization code not found","instance_id":"xxxxxx"}
2015-11-25 16:27:39.530 TRACE o.o.b.n.internal.NestBinding[:576]- Response: AccessTokenResponse[accessToken=<null>,expiresIn=<null>,error=oauth2_error,errorDescription=authorization code not found]
2015-11-25 16:27:39.531 ERROR o.o.b.n.internal.NestBinding[:579]- Error retrieving access token: AccessTokenResponse[accessToken=<null>,expiresIn=<null>,error=oauth2_error,errorDescription=authorization code not found]'
2015-11-25 16:27:39.532 WARN o.o.b.n.internal.NestBinding[:136]- Periodic poll skipped.
OK, that suggests that the client_id, client_secret and/or pin_code are not consistent with a valid “Product” as defined at developer.nest.com and authorized to use your normal nest.com account. Could you re-check those values, and possibly create a new “Product” (previously referred to as “Client” before Nest changed the nomenclature)?