My point of view of Openhab2, stability and a few good to know stuff

I have been working with openhab2.5 testing and openhab2.5-SNAPSHOT. And I have to say it is really stable for me. And I’m also using a bunch of bindings and other services (See lists below)

My “production” server are running openhab2.5-testing and has been running for the past 8 days with no issues. But I think it has had over a month uptime
My “development” server are running openhab2.5-SNAPSHOT and are getting restarted often. But 2 - 3 days has not been any problem

But I do not like to use the PaperUI. So I spend some time in the documentation and wrote all my configs in files and only using UI to check if icons and links was looking correct

But it is a really good idea to restart and clear the cache while configuring as some things could get a but strange after too many changes.

I made a small script to easy restart openhab2 (restart_openhab.sh)

About java, I did start using openjdk-11-jre-headless . But I got alot of errors in the log. But after switching to openjdk-8-jre-headless everything was great

And the community is also a great place to get help if you can’t find the answer you are looking for

Hope some of you can use this, else feel free to send me a message and I will try to help if you have any issues with stability or with the bindings/service I’m using :slight_smile:

restart_openhab.sh [soft | hard]:

#!/bin/bash
timeStamp=$(date +"%Y-%m-%d %H:%M:%S")
logFile="/tmp/restart_openhab.log"
logString=""

action=${1}

service openhab2 stop
case ${action} in
        hard | HARD)
                rm -rf /var/lib/openhab2/cache/*
                rm -rf /var/lib/openhab2/tmp/*
                echo "y" | openhab-cli clean-cache
                echo ""
                sleep 5
        ;;

        soft | SOFT)
                sleep 5
        ;;

        *)
                action="Default"
                sleep 2
        ;;
esac

logString="${timeStamp} - Restarting Openhab ${action}"
echo ${logString}
echo ${logString} >> ${logFile}

chown -R openhab. /etc/openhab2/*
service openhab2 start

System (VM):

  • Ubuntu server 18.04 LTS
  • 4 core
  • 4 GB ram
  • 20 GB SSD

Extra packages:

  • openjdk-8-jdk-headless
  • openjdk-8-jre-headless
  • mosquitto
  • mosquitto-clients
  • mono-complete
  • unzip
  • zip
  • nut-snmp
  • python-nut
  • nut-xml
  • nut-monitor
  • nut-ipmi
  • nut-cgi
  • python-pip
  • python-dev
  • build-essential
  • python-setuptools
  • python3-pip
  • mysql-common
  • php7.2-cli
  • php7.2-mysql
  • php7.2-curl
  • mysql-client-core-5.7
  • libmysql-java

Bindings:

  • networkupstools1
  • unifi
  • chromecast
  • mqtt
  • openweathermap
  • http1
  • sonyaudio
  • astro
  • mihome
  • systeminfo
  • kodi
  • ihc
  • verisure
  • pushbullet

Other services:

  • openhabcloud
  • restdocs
  • jdbc-mysql (separate server)
  • influxdb (separate server)
  • mapDB (localhost)
  • map
  • javascript
  • jsonpath
  • regex
  • exec
  • googletts
5 Likes

An update if you use mysql/JDBC persistence

Some item tables won’t be created if you are using mysql and your database is created with utf8 character set. I altered my database to latin1 character set and then every thing was much better :slight_smile:

I don’t know if this is of any help?

alter database openhab character set=latin1;

The error I got was something like this:

java.sql.SQLException: Column length too big for column 'value' (max = 21845); use BLOB or TEXT instead Query: CREATE TABLE IF NOT EXISTS verisure_user_email_00333 (time TIMESTAMP(3) NOT NULL, value VARCHAR(65500), PRIMARY KEY(time)) Parameters: []
1 Like

How did I miss your first post 9 days ago? very excellent assessment and thank you

Yes, I agree, when I am hacking away at the setup, sometimes after multiple changes, things get a little sideways and a restart brings everything back to being in order

Also very useful list of services and bindings you use. Thanks for reporting and I also agree and find OpenHAB real stable.

If I could ask one little favor, I have a ups and am familiar with using nut but that was a while back and I’ve never tried to write a OH1 thing file. Is there anyway I could take a look at your nut thing file?

1 Like

Hi Andrew

I’m happy you like it and glad I can help. And sure I will share my nut config.

First off the networkupstools binding does not have the need for a .thing file. It is really simple to configure :slight_smile:

services/networkupstools.cfg:

# Refresh interval for state updates in milliseconds (optional)
refresh=60000

# UPS device name
<ups_name>.device=ups

# UPS server hostname (optional)
<ups_name>.host=localhost

# UPS server port (optional)
#<ups_name>.port=3493

# UPS server login (optional)
<ups_name>.login=admin

# UPS server pass (optional)
<ups_name>.pass=admin

You proberly all ready know, but you can get a list of properties for your ups with the command: upsc <ups_name>
items/nut.items:

Number                                  // type
        Ups_Battery_Charge              // item
        "Ups Battery Charge"            // label
        <energy>                        // icon
        (ups)                           // groups
        {
                networkupstools="<ups_name>:battery.charge"
        }

Number                                  // type
        Ups_Battery_Current             // item
        "Ups Battery Current"           // label
        <energy>                        // icon
        (ups)                           // groups
        {
                networkupstools="<ups_name>:battery.current"
        }

Number                                  // type
        Ups_Battery_Runtime             // item
        "Ups Battery Runtime"           // label
        <digital_clock_256>             // icon
        (ups)                           // groups
        {
                networkupstools="<ups_name>:battery.runtime"
        }
...

I hope this helps you to get it working :slight_smile:

1 Like

Adding a small script to check if all items in sitemaps/* are found under items/*
It’s not pretty, but might help someone :slight_smile:

Why? I find it useful because if an item is used in an sitemap, but has not been configured in an item file. It could give errors in the log. So to have a more clean log, I’m using it to check if my sitemaps are ok :slight_smile:

check_sitemaps.sh:

 #!/bin/bash

openhab_dir="/etc/openhab2"

for item in $(grep -r item= ${openhab_dir}/sitemaps/* | awk '{print $3}' | tr '=' ' ' | awk '{print $2}'); do
#       echo "Looking for ${item}"
        item_found=""
        item_found=$(grep -r ${item} ${openhab_dir}/items/* | awk '{print $1}' | grep -v "//")

        if [ -z "${item_found}" ]; then
                echo "${item} not found!"
                echo ""
#       else
#               echo "Item found: ${item} in ${item_found}"
#               echo ""
        fi
done

Oh, to having script to work, my item files look like this:

DateTime                                // type
        sunrise_time                    // item
        "Sunrise [%1$tH:%1$tM]"         // label
        <weather_clear_256>             // icon
        {
                channel="astro:sun:home:rise#start"
        }

Here are somethings that might could help after upgrading OH 2.5 M1 to OH 2.5 M2

About my installation

Please see my first post here: My point of view of Openhab2, stability and a few good to know stuff

Openhab in general

First, to update the APT repo you should check here: The APT/RPM 'testing' (Milestone) repository has moved

After upgrading and reconfigurating Openhab I got some errors like cannot be resolved to an item or type
It got fixed after I set the rights for all files in '/etc/openhab2/'

/bin/chown -R openhab. /etc/openhab2/*

Don’t forget to check the output after upgrading:

[openHAB] Listing important changes for version 2.5.0:
  Warning:  senseBox Binding: The senseBox binding is now using Units of Measurements, and the channel name for Illuminance has changed. The Items must be reconfigured.
  Warning:  Vitotronic Binding: The following channels have been renamed: 'outsite_temp' to 'outside_temp', 'pelletburner:power' to 'pelletburner:powerlevel', 'party_temp' to 'party_temp_setpoint' and 'save_temp' to 'save_temp_setpoint'
  Warning:  OneWire Binding: Some thing types have changed and need to be updated in textual configurations. See documentation for further information.
  Warning:  REST Docs: This add-on is now part of the UIs. When installing it using textual configuration, update 'services/addons.cfg' by removing 'restdocs' from 'misc' and add it to 'ui' instead.
  Warning:  EnOcean Binding: Channel 'receivingState' has been removed, because this was a string containing many information. For this, there are three new channels: 'rssi', 'repeatCount' and 'lastReceived'.
  Warning:  Mail Action: The mail action has been replaced by a new mail binding.
  Warning:  Homekit: Some tags have been renamed. Old names will not be supported in future versions. Please check documentation.
  Warning:  Pushbullet Action: The pushbullet action has been replaced by a new pushbullet binding.
  Warning:  DarkSky Binding: The item type of `rain` and `snow` channels have been changed to `Number:Speed`.

Pushbullet:

Usage has changed so please checkout the documentation: https://www.openhab.org/addons/bindings/pushbullet/

Error message:

2019-08-10 15:19:20.679 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-action-pushbullet'

When moving pushbullet from action-addons to binding-addons in: '/etc/openhab2/services/runtime.cfg'

org.openhab.addons:binding=pushbullet,<other bindings>,...
org.openhab.addons:action=<other actions>,...

The action configuration line in: '/var/lib/openhab2/config/org/openhab/addons.config'

action="pushbullet"

Is not cleaned up. Also after an cache/tmp cleanup it is still there
I removed the line and Pushbullet got installed and it works again (Don’t forget the new usage)

Restdocs

Rest API has been moved from misc addons to ui addons.

When moving restdocs from misc-addons to ui-addons in: '/etc/openhab2/services/runtime.cfg'

org.openhab.addons:ui=restdocs,<other bindings>,...
org.openhab.addons:misc=<other actions>,...

If you installed the restdocs using the UI. This should fix it: openHAB Milestone builds

Last observation

When I upgrading one of my openhab 2.5 M1 installations my log got spammed with errors like:

2019-08-11 00:44:51.558 [ERROR] [xbase.resource.BatchLinkableResource] - resolution of uriFragment '|::0.2.0.2.0.0.6.1.1.0.1.0::0::/1' failed.
2019-08-11 00:44:51.748 [ERROR] [xbase.resource.BatchLinkableResource] - resolution of uriFragment '|::0.2.0.2.0.0.6.1.1.0.1.0.7::0::/1' failed.
2019-08-11 00:44:51.939 [ERROR] [xbase.resource.BatchLinkableResource] - resolution of uriFragment '|::0.2.0.2.0.0.6.1.1.0.1.0.7::0::/1' failed.
2019-08-11 00:44:52.137 [ERROR] [xbase.resource.BatchLinkableResource] - resolution of uriFragment '|::0.2.0.2.0.0.6.1.1.0.1.0.7.7::0::/1' failed.

I had to purge the openhab2 package(s) and reinstall it (Remomber to backup your configuration, uuid and secret)

apt purge openhab2 [openhab2-addons]
apt install openhab2 [openhab2-addons]

When purging the package(s) all OH configurations and OH files are removed without warning. So again remember to backup your config

I saved:

  • '/etc/openhab2/*'
  • '/var/lib/openhab2/uuid'
  • '/var/lib/openhab2/openhabcloud/secret'

If you used the PaperUI to configure your OH. You should use:

openhab-cli backup [--full] [filename]
...
<purge/reinstall package(s)>
...
openhab-cli restore filename

I don’t know if this backup could contain something that could break the new installation?

And last but not least, clearing the cache could do wonders :innocent:

Hope this helps :slight_smile:

4 Likes

Nice writeup, small typo.

1 Like

Thank you :slight_smile:

And fixed :+1:

Hi, I posted a link here of my home cinema I just finished :slight_smile:

Is this really needed?
I have upgraded many times but only needed to delete cache and tmp files.
Unfortunately I got the same errors you’ve mentioned (uriFragment).

But I am scared to proceed and lose my config…
(backup did not work one time already somehow)

Hi, my upgrade did not go so well. So I removed the packages and installed them again. All my config is in files, so it was no problem just to remove openhab and start over. And just copy all files into /etc/openhab2 :slight_smile:
I never use the OH-backup function, I use git to keep track of my config files

Thanks.

I am working mostly with config files as well, because I think it’s easier.
However, I started once from scratch and thought that I have all the config files…
I learned that the Things (created by PaperUI) are somewhere else.

Anyway.
I solved the “uriFragment”- mass error by starting up OH first and then copy back in the rules like here: