Environment variable $OPENHAB_CONF


I tried creating sitemap like is discribed in documentation. I try to create file items :
console response :
-bash: /items/default.items: No such file or directory

i realize that environment variable $OPENHAB_CONF is empty.

Is it normale ?


Yes, correct. The variable is only used in the documentation to make a difference in the different installations (eg windows, Linux, openHABian, manual, etc)
In the documentation https://www.openhab.org/docs/installation/linux.html#file-locations you can find the Linux locations.
Here are the windows locations: https://www.openhab.org/docs/installation/windows.html#file-locations

Replace $OPENHAB_CONF with “Site configuration” from the links above (according to your installation. )

It is a Linux environment variable. When logged in, you can “cd $OPENHAB_CONF” to move quickly to the configuration folder.

Hello, thanks for responses.
Inded, i 'm in a linux environment ( DEBIAN Jessie).
When i do cd $OPENHAB_CONF then ls i have :
html icons items persistence rules scripts services sitemaps sounds things transform

So, i must created files default.items. Do i use make ?


Cd to the items directory. There should be a README file there with instructions. Basically use your text editor of choice to make a file ending in “.items”.
The log should show either it was updated or there was a syntax error.

But if this is true, the variable is empty, why does this works:

I thought it was used only in the docs

It is not a normal variable and it is not empty.
Depending on your Linux shell, you can type wither set or env to see it and others.

How did you install OH?

It’s a real variable. Whether and how it is set depends on how you installed OH, even on Windows (I think).
Find below the openHABian default setting taken from /etc/default/openhab2. I think that’s what OH uses even if you don’t set it in your install method.


1 Like

Except the slashes are backward on that backward OS :rofl:

I’ve inalled OH2 with Package Repository Installation

That should be the same as openHABian.

I am running openhab base on the repo available on openhab.jfrog.io.
The OPENHAB_ environment variables are set via /etc/profile.d/openhab2.sh which is source via /etc/profile.

This shows the $OPENHAB_CONF environment variable is set correctly to the configuration directory (as was to be expected when doing a package install :sunglasses:).

As stated before, to create files you have to select the correct folder inside the folder pointed at by $OPENHAB_CONF. So, an items file must be created in $OPENHAB_CONF/items and sitemap files in $OPENHAB_CONF/sitemaps.
For instance, to create a new items file type:

nano $OPENHAB_CONF/items/mynew.items

or any other file name you choose, as long as the extension is .items).

1 Like

nano is a Linux command. Linux directories use slashes / not backslashes \ The backslash is used as an escape character in quoted strings or usually ignored.

1 Like

That’s what you get when working with Windows for too long… :grinning:
Edited my post.

1 Like