How to access the Nest?

Hi,

I feel like a right herbert…

I cannot for the life of me work out how to connect my actual, physical (screwed onto my wall) nest thermostat to my nest developers account. It seems like I’m missing something major here. And I like to think of myself as being OK with this stuff.

I emailed their support over a week ago, because this is a nest issue more than anything else. But I haven’t had any response. I thought you guys might have some insights!?

openHAB may be able to connect, but how the hell does it know where my device is? It doesn’t…

I even reset my Thermostat to factory settings and registered it with a new developer only account (about 20 mins ago!)

Have you connected your Nest to a regular user’s account? For example, can you use the Nest App from your phone or the web to control it?

Your physical device doesn’t actually show up anywhere in your Product config on the Nest Developer Site. Once you have your Product created, you need to authorize your Nest as described on the binding’s wiki page. On the right of your Product config page is a column labeled Keys. One of the items is the authorization URL. Paste that into a new tab and it will take you to log into your users Nest account. This is what connects your Nest User’s Account to your Nest Developers Product.

Put the Product ID, Product Secret, and PIN (generated when you authorized) into your openhab.cfg (find the nest section). This is what connects openHAB to yoiur Nest Product.

Finally, in your Items binding config you specify the name of your physical device as it appears at Nest.com. This is what connects a specific Item to a specific value or setting on a specific physical device.

1 Like

Hi @rlkoshak,

Yeah, I have the nest connected fine with my online and iPhone.

I’ve triple checked the Product ID, secret and PIN in openhab.cfg

I’ve only got one item in the .items file and one entry in the sitemap (copy and pasted the item name etc to avoid spelling errors). But I never get a connection.

When I open the authorization URL, I get the pop-up asking to accept the access through the API, but I don’t get asked to enter any new account information. It feels to me that it’s this bit that is causing the headache.

I emailed nest support about a week ago, but I’ve not heard anything from them.

Chris

If you are already logged in to your regular Nest.com account in that browser this is expected behavior. It doesn’t need your login info as you are already logged in so it goes straight to asking for the authorization.

What do you see in the logs?

Perhaps @watou can give some recommendations.

Also, make sure you are using the right name from Nest.com. You want the name of the Nest device, not the name of the structure for most things (except Away/Home when you want the structure).

Given above, my temperature item looks like:

Number N_V_NestCurrTemp "Main Floor Ambient Temp [%d °F]" <temperature> { nest="<[thermostats(Entryway).ambient_temperature_f]" }

If you add this line to logback.xml:

<logger name="org.openhab.binding.nest" level="TRACE"/>

right after the line:

<logger name="org.openhab" level="INFO"/>

Your openhab.log should shortly start to log TRACE and DEBUG statements from the Nest binding. Hopefully they can help shed light on the situation. If the lines don’t start appearing, stop and restart your openHAB server. Could you paste in all the uncommented nest lines in your openhab.cfg file, but first scramble a few of the characters to the right of the = sign for privacy’s sake?

Hold the front page! It’s working!!

Blimey, that took days… I was trying to debug why my lightwave had stopped working (!) then noticed the nest had populated with data…

So now to work out why the connection between openHAB and the WiFi Link has stopped working.

Thanks @rlkoshak and @watou for your help! I’m going to put the lightwave into TRACE now, so thanks for that.

For completeness here’s the Nest binding section of my opengab.cfg:

> ############################## Nest binding ###########################################
> #
> # Data refresh interval in ms (optional, defaults to 60000)
> nest:refresh=60000
> # the Nest Client ID needed to use the API, must be supplied
> nest:client_id=xxxxxxd3-1d44-43f5-9c2e-xxxxxxxxxxxx
> # the Nest Client Secret needed to use the API, must be supplied
> nest:client_secret=xxxxI23EkqkXfhsrxxxxxxxxx
> # the PIN code that Nest presented when you authorized the above client, must be supplied
> nest:pin_code=xxxxxxxx
1 Like

For the lightwave binding. I’d grab the latest from here: LightwaveRF Binding Updated

I’ve made a lot of changes.

Regards,
Neil

Can I ask what ‘Temperature Scale’ is?

> String Nest_main_temperature_scale "Temperature Scale [%s]" {nest="<[thermostats(main).temperature_scale]"}

I remember seeing it used somewhere, and I included it as an item, but it’s always empty. Am I misusing it?!

I don’t know why it would be blank. It ought to be either “F” or “C”. It’s documented here.

It’s now showing as ‘C’. Not sure what was going on there. Thanks

Does anyone else get kicked out of the API every now and then? I get this a couple of times a day:

> 2015-12-03 22:10:17.016 [ERROR] [b.n.i.messages.AbstractRequest] - Fatal transport error: java.net.UnknownHostException: developer-api.nest.com
> 2015-12-03 22:10:17.028 [ERROR] [.o.b.nest.internal.NestBinding] - Error reading from Nest:
> org.openhab.binding.nest.internal.NestException: Could not get data model.

Doesn’t seem to happen for long, but I’m wondering whether it’s something happening with my router/wifi rather than a Nest thing.

Yes; very rarely I do see that. I just assume there is some occasional DNS outage, possibly with their load balancing, but the root cause could conceivably be elsewhere. It always clears up quickly in my experience.

I’m still getting these errors several times a day. It seems to happen every 2 hours or so…

2016-01-01 21:37:30.671 [ERROR] [b.n.i.messages.AbstractRequest] - Fatal transport error: java.net.SocketTimeoutException: Read timed out
2016-01-01 21:37:30.684 [ERROR] [.o.b.nest.internal.NestBinding] - Error reading from Nest:
org.openhab.binding.nest.internal.NestException: Could not get data model.
    at org.openhab.binding.nest.internal.messages.AbstractRequest.newException(AbstractRequest.java:85) ~[na:na]
    at org.openhab.binding.nest.internal.messages.DataModelRequest.execute(DataModelRequest.java:66) ~[na:na]
    at org.openhab.binding.nest.internal.NestBinding.readNest(NestBinding.java:158) ~[na:na]
    at org.openhab.binding.nest.internal.NestBinding.execute(NestBinding.java:141) ~[na:na]
    at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156) [org.openhab.core_1.7.1.jar:na]
    at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) [org.openhab.core_1.7.1.jar:na]
Caused by: java.lang.NullPointerException: null
    at java.io.StringReader.<init>(StringReader.java:50) ~[na:1.8.0]
    at org.codehaus.jackson.JsonFactory.createJsonParser(JsonFactory.java:636) ~[na:na]
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1854) ~[na:na]
    at org.openhab.binding.nest.internal.messages.DataModelRequest.execute(DataModelRequest.java:56) ~[na:na]
    ... 4 common frames omitted
2016-01-01 21:39:24.215 [ERROR] [b.n.i.messages.AbstractRequest] - Fatal transport error: java.net.SocketTimeoutException: Read timed out
2016-01-01 21:39:24.228 [ERROR] [.o.b.nest.internal.NestBinding] - Error reading from Nest:
org.openhab.binding.nest.internal.NestException: Could not get data model.
    at org.openhab.binding.nest.internal.messages.AbstractRequest.newException(AbstractRequest.java:85) ~[na:na]
    at org.openhab.binding.nest.internal.messages.DataModelRequest.execute(DataModelRequest.java:66) ~[na:na]
    at org.openhab.binding.nest.internal.NestBinding.readNest(NestBinding.java:158) ~[na:na]
    at org.openhab.binding.nest.internal.NestBinding.execute(NestBinding.java:141) ~[na:na]
    at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156) [org.openhab.core_1.7.1.jar:na]
    at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) [org.openhab.core_1.7.1.jar:na]
Caused by: java.lang.NullPointerException: null
    at java.io.StringReader.<init>(StringReader.java:50) ~[na:1.8.0]
    at org.codehaus.jackson.JsonFactory.createJsonParser(JsonFactory.java:636) ~[na:na]
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1854) ~[na:na]
    at org.openhab.binding.nest.internal.messages.DataModelRequest.execute(DataModelRequest.java:56) ~[na:na]
    ... 4 common frames omitted
2016-01-01 21:49:14.707 [ERROR] [b.n.i.messages.AbstractRequest] - Fatal transport error: java.net.SocketTimeoutException: Read timed out
2016-01-01 21:49:14.723 [ERROR] [.o.b.nest.internal.NestBinding] - Error reading from Nest:
org.openhab.binding.nest.internal.NestException: Could not get data model.
    at org.openhab.binding.nest.internal.messages.AbstractRequest.newException(AbstractRequest.java:85) ~[na:na]
    at org.openhab.binding.nest.internal.messages.DataModelRequest.execute(DataModelRequest.java:66) ~[na:na]
    at org.openhab.binding.nest.internal.NestBinding.readNest(NestBinding.java:158) ~[na:na]
    at org.openhab.binding.nest.internal.NestBinding.execute(NestBinding.java:141) ~[na:na]
    at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156) [org.openhab.core_1.7.1.jar:na]
    at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) [org.openhab.core_1.7.1.jar:na]
Caused by: java.lang.NullPointerException: null
    at java.io.StringReader.<init>(StringReader.java:50) ~[na:1.8.0]
    at org.codehaus.jackson.JsonFactory.createJsonParser(JsonFactory.java:636) ~[na:na]
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1854) ~[na:na]
    at org.openhab.binding.nest.internal.messages.DataModelRequest.execute(DataModelRequest.java:56) ~[na:na]
    ... 4 common frames omitted

Those messages suggest that the hard-coded 10-second timeout value is still too short for some attempts to access the Nest API. I imagine lots of people got new thermostats for the holidays and put a bigger burden on their API servers. :smile:

I will have to work up a PR that adds a configurable value for the socket timeout so you can set it higher than 10 seconds, and also improve the logging a bit.

1 Like

Cheers @watou, that would be brilliant.

Maybe Google have started throttling accounts now, or at a tighter threshold than previously. (If they did it previously!)

Hi Chris, I submitted a PR last night that adds an optional nest:timeout config parameter to openhab.cfg (or timeout parameter to nest.cfg if you are running OH2). The default value continues to be 10000 (milliseconds), but you could set it to, say, 20000, and that ought to give the API 20 seconds to respond in order to avoid “Fatal transport error: java.net.SocketTimeoutException: Read timed out”.

You can try a test version of the Nest binding JAR file here. Hopefully this PR makes it into openHAB 1.8, but if not, it will be part of some future release and there would be no harm running the test JAR going forward.

Thanks @watou.

I’ve downloaded that snapshot, and installed it. I added the following to openhab.cfg:

nest:timeout=20000

And I’ll see how it gets on…

Chris, please do let me know if you see any different behaviour. I’ve been running with a 20-second HTTP request timeout since last night, but starting around 10:45 until 11:18 (GMT) today I started seeing a string of Nest API timeouts. It’s impossible to know what the root causes may be (WAN routes, down servers, ISP hiccup, etc.), but at least with the new configurable timeout parameter, we can exert the bit of control we have over the situation.

Thanks and let me know!

John

Will do John. Mines been running since 12:00 GMT and not a peep put of it in terms of errors yet…

Chris

Hey…

Just checked the logs on my Nest Firebase based binding and I’ve had 0 errors since the 4th Dec except for the time that I was setting home/away every minute to test some rules…

Might be a time to see if we can merge the two bindings (the main pain point is I configure mine differently - by serial number not text name) to give the choice of the non-polling version?

Neil