OpenHAB version in sitemap?

I’m new to openHAB and I’m wondering if there is a way to display the openhab version number (e.g., v1.8.3) in the web (via sitemap)? Is there an item or something similar? I don’t always know what version I’m running and it would be nice if it was displayed at the bottom of the website (in addition to the © opyright notice), but if not, just having an Item that I can use as a Text would be helpful.

Is there some way to do this?

There is no way I know of to do this.

That’s actually a good idea. I don’t know an “official” way either. What you can do: you can use the exec binding to query the version of the installed package. That however might depend on your kind of setup. OH1 through apt? what does “dpkg – list | grep openhab” tell you?

Thom,

My installation is on OSX and so not through dpkg. I could probably just come up with a grep against openhab.log to pull the version number from that file. I haven’t used the exec binding yet, but will take a look and see what I can do.

Thx

In OH 1.x you are looking for this line:

openHAB runtime has been started (v1.8.3).

I see nothing in the OH 2 logs indicating the version. You could ssh to the Karaf console and pull the version number from there.

Not the most elegant solution but that gets the job done:

OHVERSION=`awk '/Build/ {print $4}' /usr/share/openhab2/runtime/karaf/etc/branding.properties`

Hello
I am interested in showing the version as well in my Overview page
I looked in the SystemInfo binding but it doesn’t have the version # available as a channel
Was wondering if there is another binding I am missing
Thanks

This is a six year old thread. A lot has changed in that to the systeminfo binding in that time. I know of no other binding available.

Note that the version information is available one click away from the main page under “Help and About”. Otherwise, you’ll need to use the Exec binding or executeCommandLine to pull the version info from somewhere else, such as the logs or that awk command Thom posted (only the path to the file has long since changed to /var/lib/openhab/etc/version.properties).

The following is working for me in OH3.2. There is one String item for each of the versions listed in the version.properties file. The Exec and Regex addons are required. The items are populated once per day (every 86400 seconds).

Note that my OpenHab is running in a Docker container - you may need to adjust to paths in the exec.whitelist and .things files to match your installation.

The first step is to add these awk commands to the /conf/misc/exec.whitelist file.

awk '{if($1=="openhab-distro"){print $3}}' /openhab/userdata/etc/version.properties
awk '{if($1=="openhab-core"){print $3}}' /openhab/userdata/etc/version.properties
awk '{if($1=="openhab-addons"){print $3}}' /openhab/userdata/etc/version.properties
awk '{if($1=="karaf"){print $3}}' /openhab/userdata/etc/version.properties

Then add the .things file:

Thing exec:command:distro [command="awk '{if($1==\"openhab-distro\"){print $3}}' /openhab/userdata/etc/version.properties", interval=86400, timeout=5, autorun=false]
Thing exec:command:core   [command="awk '{if($1==\"openhab-core\"){print $3}}' /openhab/userdata/etc/version.properties",   interval=86400, timeout=5, autorun=false]
Thing exec:command:addons [command="awk '{if($1==\"openhab-addons\"){print $3}}' /openhab/userdata/etc/version.properties", interval=86400, timeout=5, autorun=false]
Thing exec:command:karaf  [command="awk '{if($1==\"karaf\"){print $3}}' /openhab/userdata/etc/version.properties",          interval=86400, timeout=5, autorun=false]

And the .items file:

String OpenHabVersionDistro "OpenHab Distro Version [%s]"  {channel="exec:command:distro:output"}
String OpenHabVersionCore   "OpenHab Core Version [%s]"    {channel="exec:command:core:output"}
String OpenHabVersionAddOns "OpenHab AddOns Version [%s]"  {channel="exec:command:addons:output"}
String OpenHabVersionKaraf  "OpenHab Karaf Version [%s]"   {channel="exec:command:karaf:output"}

I’m sure there are more elegant ways to accomplish this and others are welcome to improve it, but all four versions are displayed on my sitemap now :slight_smile:

HTH
Jim