Clean OSX Install - Nest Binding Not Working

I’m a complete beginner to OpenHAB… would like to eventually get into more complete HA (lights, locks, switches, etc) but figured I’d get my feet wet with one of the few HA items I have: my Nest thermostat. For background, I’m running OSX Mavericks.

Downloaded the latest OpenHAB package and Addons from the OpenHAB website and copied the application folder to my Applications directory. Copied (only) the Nest binding to the addons directory. Signed up as a Nest developer and got all my keys and codes copied into the relevant section of the openhab.cfg (which is a straight copy from openhab_default.cfg).

Here’s my nest.items file:

String home_away "Home/Away [%s]" <present> { nest="=[structures(Home).away]" }
DateTime Nest_last_connection "Last Nest Connection [%1$tm/%1$td %1$tH:%1$tM]" {nest="<[last_connection]"}
String   NestHome_name "Name [%s]"                 {nest="<[structures(Home).name]"}
DateTime NestTStatUpstairs_last_connection "Last Connection [%1$tm/%1$td/%1$tY %1$tH:%1$tM:%1$tS]" <calendar> {nest="<[thermostats(Hallways).last_connection]"}

And here’s my nest.sitemap file:

sitemap nest label="Nest"
{
  Frame label="Home" {
        Switch item=home_away mappings=[home="Home",away="Away"]
        Text item=Nest_last_connection
        Text item=NestTStatUpstairs_last_connection
  }
}

I also copied the logging text from the Nest GitHub page into my logback file.

Started OpenHAB (“sudo sh start.sh” and the terminal showed no errors or anything to suggest something was wrong:

$ sudo sh start.sh 
Launching the openHAB runtime...
osgi> 2015-10-19 10:02:13.573 [INFO ] [.o.core.internal.CoreActivator] - openHAB runtime has been started (v1.7.1).
2015-10-19 10:02:14.601 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - mDNS service has been started
2015-10-19 10:02:14.661 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - Service Discovery initialization completed.
2015-10-19 10:02:16.422 [INFO ] [penhab.io.rest.RESTApplication] - Started REST API at /rest
2015-10-19 10:02:24.125 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'nest.sitemap'
2015-10-19 10:02:24.246 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'nest.items'
2015-10-19 10:02:25.068 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Started Classic UI at /openhab.app

However, when I go to my OpenHAB website, it shows no Nest data:

The terminal window shows no Nest binding updates (or updates of any kind beyond what I pasted above) and the nest.log is empty. No other log files show any Nest binding messages.

I’ve deleted and re-downloaded the OpenHAB and add-on archives and re-created the above setup, being careful not to change anything else from the defaults. Same problem. If I had to guess, the Nest binding either isn’t installed correctly (or isn’t being caught by OpenHAB when run) or it can’t talk to the Nest site… but it’s strange that I’m not even getting an error. I’ve tried changing the name of my Nest structure and devices (in an earlier attempt, when I was also trying to call up Nest device info) to what I know is incorrect and even that’s not throwing up an error, as I would expect.

Any ideas on what I’m doing wrong?

You are correct that there is no evidence that the Nest binding is installed properly so that it is being started. We would need to have more information about how you performed the install, how you obtained the file org.openhab.binding.nest-1.7.1.jar and where it was placed. You should be able to tell that the binding is installed in the proper place when you see

XXXX-XX-XX XX:XX:XX.XXX [INFO ] [.service.AbstractActiveService] - Nest Refresh Service has been started

in the log. Just to see everything possible (once it’s even being started), set the logging level to TRACE in your modifications to logback.xml.

Also, could you paste here exactly what is in openhab.cfg for all nest entries, changing some of the characters for the nest:client_id, nest:client_secret and nest:pin_code for privacy?

After that, you must also make sure that your “structure” is called Home and that your thermostat is called Hallways. With more information, we should be able to track down the cause of why the binding JAR is not starting.

Hi Watou,

Thanks for the quick response! I’m probably just I’m doing something really bone-headed here so I appreciate you walking me through debugging this!

I downloaded the Nest binding from the OpenHAB download page… here’s the link: https://bintray.com/artifact/download/openhab/bin/distribution-1.7.1-addons.zip

To install the binding, I simply moving the Nest binding org.openhab.binding.nest-1.7.1.jar (and just the Nest binding for now… leaving all the rest in the download directory) into my OpenHAB install under /Applications/openhab/addons/

To be certain, I actually JUST re-downloaded the addons package from the link above, deleted the nest binding that was in my OpenHAB directory and replaced it with one from the freshly downloaded package… no dice. Same problem.

Definitely NOT seeing anything like the AbstractActiveService message you posted. In fact, I grep’d my whole log directory for “Abstract” and it didn’t find anything. It appears to not be loading the Nest binding, at all. (I forgot to mention that my logback.xml file was replaced with the logback_debug.xml file provided in the OpenHAB install… and I also copied the Nest logback addition to this file with the level set to TRACE.)

Here’s the nest section of my openhab.cfg (with some characters changed):

 ############################## Nest binding ###########################################
#
# Data refresh interval in ms (optional, defaults to 60000)
#nest:refresh=

# the Nest Client ID needed to use the API, must be supplied
nest:client_id=616aa269-5498-4f6f-b1b1-aaa1a1aa1111

# the Nest Client Secret needed to use the API, must be supplied
nest:client_secret=aa1Hf5x0hijYa1YD5i4keyAaa

# the PIN code that Nest presented when you authorized the above client, must be supplied
nest:pin_code=AA1AAAAA

Pretty sure my structure is called Home… here’s a screengrab from the Nest website when I log in:

I’ve tried a changing my thermostat name on the Nest site to make it a bit easier to match with OpenHAB and have even tried changing the thermostat name in OpenHAB to something I know is wrong (like “akkljdashfkj”) and I don’t get any errors from OpenHAB when I do so.

Any ideas?

It seems like there is something strange about your install on Mac OS X, but I don’t know what it might be.

Could you install the networkhealth binding JAR alongside the nest binding JAR, using the same steps, and configure an item like

Switch MyPhone "My Phone" { nh="192.168.1.10" }

and see if you can get a different binding working? This could help separate the possible causes.

Agreed… something’s funky with my install/setup.

I copied the networkhealth JAR into the addons folder and created a new nethealth.items file as follows:

Switch Network_OpenhabWebsite   "openHAB Web"   (Status, Network)   { nh="openhab.org:80" }
Switch Network_Printer "Printer" (Status, Network) { nh="192.168.1.9" }

When I grep my logs directory for “Printer” I see the following:

2015-10-19 16:36:48 - Network_Printer state updated to OFF
2015-10-19 16:37:48 - Network_Printer state updated to ON
16:36:42.691 [DEBUG] [i.internal.GenericItemProvider:341  ] - Start processing binding configuration of Item 'Network_Printer (Type=SwitchItem, State=Uninitialized)' with 'NetworkHealthGenericBindingProvider' reader.

And when I grep the logs for “Abstract” I get:

16:36:42.693 [INFO ] [.service.AbstractActiveService:169  ] - NetworkHealth Refresh Service has been started

So, unless I’m misinterpreting, it seems like it’s initializing the binding properly and updating the status of the items in my items file, which means it’s just the Nest binding which isn’t starting up properly.

The problem does seem specific to the Nest binding JAR. It shouldn’t matter, but could you remove the nest binding JAR and put this file there instead? It’s a recent build of code that will be in openHAB 1.8. There is nothing about the code differences that should affect whether the binding starts, only small enhancements documented here.

Oh, one other thing. On the machine where you are running the openHAB server, could you run

java -version

to see which version of Java is installed? Could you also verify that start.sh is running that same version of Java?

Done.

java -version returns:

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)

Not sure how I check what version of Java the start script is running… it appears to simply be calling java… which should be running the version returned above, no? Is there some other way of checking this?

In the meantime, I’ve installed habmin, which seems to be running fine… the web interface runs ok and provides some info on my OpenHAB setup (although, admittedly, I can’t make a lot of sense of it as I haven’t read too much on habmin or played with it too much).

I also just got in the mail an Aeotec Z-Stick (Gen5) and set up the zwave binding. Once I got it linked to the correct /dev device it also seems to be running ok: the AbstractActiveService is starting the zwave binding. I have no Z-wave devices so I haven’t gotten any further than this.

A wild guess: I am wondering if there is a Java 7 dependency that has not been reported before. I will research that. In the meantime, you could see which Java versions you have installed with

/usr/libexec/java_home -verbose

and if you could install or upgrade to Java 7 or 8, do so?

Here’s the output when I run that command:

Matching Java Virtual Machines (2):
    1.6.0_65-b14-468, x86_64:	"Java SE 6"	/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    1.6.0_65-b14-468, i386:	"Java SE 6"	/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

I’ll upgrade to Java 7 or 8 now to see if that fixes things.

Yay! She’s working now! Looks like the Java 1.6 was the problem. I had the JRE version 8 installed but it wasn’t what was linked to the /usr/bin/java executable… that was linked back to the older version 6 JRE. Dug around a bit and found the install location of version 8 and changed my start.sh to the following:

...
echo Launching the openHAB runtime...
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java \
...

Instead of just the simple java \ command.

Thanks for all the help watou!

I’m happy you got it working!

I will have to figure out why it fails slightly on the older Java – I did not think the binding had Java 7 dependencies… Hmmm…calls for some more testing.

In hindsight, I think there was more of my OpenHAB install that wasn’t working under Java 6. Specifically, Habmin didn’t have nearly as much information available as it does now, running under Java 8. Although my Z-Stick appeared to initialize correctly in the logs, Habmin didn’t provide any information about the Z-Stick or the Z-wave network/devices. Further, the Z-wave device database that can be listed in the Habmin interface was completely blank. I believed this was because my install or setup was incomplete, but I’m wondering if the Java dependencies reach deeper into OpenHAB than simply the Nest binding.

1 Like

That may well be the case. I doubt that anyone is doing rigorous testing of the core or bindings under Java 6 (I’m certainly not! :confused:) At least you found a very efficient solution–upgrade!