Nest binding in 2.0?

I don’t have a Home for openhab in my OH2 instance. Is this a Karaf location instead of a true home directory? I tried creating these in my install directory /opt/openhab2/.java/.userPrefs without luck.

What am I missing here?

pi@openhab2:/opt/openhab2 $ sudo service openhab status
● openhab.service - Starts and stops the openHAB Home Automation Bus
   Loaded: loaded (/usr/lib/systemd/system/openhab.service; enabled)
   Active: active (running) since Tue 2016-12-20 17:00:57 EST; 1min 16s ago
     Docs: http://www.openhab.org
 Main PID: 524 (karaf)
   CGroup: /system.slice/openhab.service
           ├─524 /bin/sh /opt/openhab2/runtime/bin/karaf
           └─707 /usr/bin/java -Dopenhab.home=/opt/openhab2 -Dopenhab.conf=/opt/openhab2/conf -Dopenhab.runtime=/opt/openhab2/runtime -Dopenhab.userdata=/opt/openhab2/use...

OK, whichever user under which the openHAB runtime is started will be the correct home (~) directory, below which there should be .java/.userPrefs.

You can change this in your startup script by passing

-Djava.util.prefs.userRoot=/path/to/writeable/directory

and so the Java Preferences files will be read and written there.

Now just need to find where the start.sh picks the others up from. Off to search for all the -Djava parameters.

You could edit runtime/bin/setenv or you might be able to change that system property by starting like

EXTRA_JAVA_OPTS=-Djava.util.prefs.userRoot=/path/to/writeable/directory ./start.sh
1 Like

I came across the setenv about the same time that you posted.

I went ahead and put it in the other OPTIONS section. I didn’t have luck with the EXTRA JAVA OPTS, probably because I didn’t put a return in the string.

#
# set java options
#

export JAVA_OPTS="${JAVA_OPTS}
  -Djava.util.prefs.userRoot=/opt/openhab2/.java/.userPrefs
  -Dopenhab.home=${OPENHAB_HOME}
  -Dopenhab.conf=${OPENHAB_CONF}

Errors have been eliminated!

Thanks!

1 Like

To avoid having to authorize a new PIN after upgrades, make sure that /opt/openhab2/.java/.userPrefs survives the upgrade unharmed!

1 Like