Skip to content

Apache Karaf client in openHAB, and the "Session has been closed" error

Don't you love it when things suddenly stop working?

In my openHAB installation I have a check which verifies that the weather data is up to date. Otherwise it restarts the openhab2 service. And this check stopped working ... Leaving the kitchen display not updated for a longer time. The same display where I expect the entire installation to "just work", and don't create so many different problems. Seems to be a hard problem to have an openHAB installation without any trouble ...

 

The check for up-to-date weather data is a simple "openhab client" call reading the timestamp of the weather data. That was the implementation:

#!/bin/bash

# load environment variables for openhab2
. /etc/profile.d/openhab2.sh

currentts=`/usr/share/openhab2/runtime/bin/client -l 0 "smarthome:status homeCurrentTS" | grep -v "Logging in as openhab"`

That worked fine for a long time, until recently when the cron job was failing. Because the Raspberry has no MTA installed, I couldn't figure out what was going on. One Postfix installation later I was able to see the emails sent by cron:

Session has been closed
Can't extract timestamp!

The first line is from the failing job, the second line my script which is aborting at this point. Yay for proper error handling.

More debugging showed that the Apache Karaf client in openHAB doesn't like me anymore. The "client" logs in, but before processing the command, it is logged out again. On top of that: it only fails in the cron job, if I run the script on the command line, it still works fine. Can't really reproduce the issue.

The help for the "client" shows that the remaining parameters after the options are the command which is send to Karaf. That no longer seems to work in recent versions (openHAB 2.5). However this still works:

#!/bin/bash

# load environment variables for openhab2
. /etc/profile.d/openhab2.sh

currentts=`echo "smarthome:status homeCurrentTS" | /usr/share/openhab2/runtime/bin/client -l 0 -b`

For unknown reasons when piping the command into the client, and adding the "-b" parameter, the client can read data from Apache Karaf. Even in my cron job. Let's see for how long ...

  • Twitter
  • Bookmark Apache Karaf client in openHAB, and the "Session has been closed" error at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Apache Karaf client in openHAB, and the "Session has been closed" error
  • Bloglines Apache Karaf client in openHAB, and the "Session has been closed" error
  • Technorati Apache Karaf client in openHAB, and the "Session has been closed" error
  • Fark this: Apache Karaf client in openHAB, and the "Session has been closed" error
  • Bookmark Apache Karaf client in openHAB, and the "Session has been closed" error at YahooMyWeb
  • Bookmark Apache Karaf client in openHAB, and the "Session has been closed" error at Furl.net
  • Bookmark Apache Karaf client in openHAB, and the "Session has been closed" error at reddit.com
  • Bookmark Apache Karaf client in openHAB, and the "Session has been closed" error at blinklist.com
  • Bookmark Apache Karaf client in openHAB, and the "Session has been closed" error at Spurl.net
  • Bookmark Apache Karaf client in openHAB, and the "Session has been closed" error at Simpy.com
  • Bookmark Apache Karaf client in openHAB, and the "Session has been closed" error at blogmarks
  • Bookmark Apache Karaf client in openHAB, and the "Session has been closed" error with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.
Form options