Status Page for bindings?

Problem: sometimes openHab looses (for any reason??) the connection to my KNX bus.

Idea: is it possible to display the status of all my used bindings?

Follow-up question: is it possible to re-start/re-initialize a binding while the OH server is running?

I’m running OH v1.7.1 on a windows machine.

Thx & Rgds.

I don’t think you can see the status of a binding short of looking at the logs. Besides, it isn’t entirely clear what a status would be for certain bindings (e.g. what would be a status for the Astro binding?).

However, I’ve faced a similar issue with some sensors I have that report their readings over MQTT. Sometimes the script I wrote to publish the data gets stuck or crashes. So what I did was to set a timer which goes off if I haven’t received an update after a certain period of time which sends an alert to me to go check it out. Of course this depends on the sensor sending updates at a relatively regular and predictable rate.

At least on Linux or Mac, if you “touch” the jar file in your openhab/addons folder, that binding will be reloaded. I’m not sure whether there is an equivalent to the touch command on Windows. I suspect how well this is handled varies on a binding by binding basis. I can say it works with the Astro binding and the zwave binding. You can do this with a Switch using the Exec binding or the executeCommandLine action from within a rule. Just make sure your openHAB user has permission to edit the files in your addons folder.

Another way to see which bundles are active is to connect to the OSGi container at a command prompt:

telnet localhost 5555

At the osgi> prompt, enter ls to see the active bundles. You could start or stop different bundles by bundle ID (bid=XXX) and enter start "XXX" or stop "XXX". There are many commands which you can see by entering help.

None of this is an officially supported interface and may change in later releases, but it could be helpful to learn what’s happening in the server.

1 Like

Guys, your replies made me thinking about a possible solution. What’s your opinion on that:
a) write batch-file with “copy knx binding from folder XYZ to add-on-folder in openhab”
b) use exec-binding to trigger batch file on missing timestamp of specific group item
c) create group “gTemperature” with all knx temperature sensors
d) if group “gTemperature” doesn’t receive any updates within specific time (e.g. within last 10minutes) --> trigger exec --> trigger batch --> knx binding will be copied and initialized again

Now - how can I use the timestamp of OH bus events?

Thx & Regards

On Windows, the equivalent of the “touch” command on Linux is “copy /b filename.ext +,”. The +, tells the copy command to not actually copy the file and just update the timestamp which cause the OSGi to reload the addon.

Assuming you have persistence configured correctly, Item.lastUpdate will give you the timestamp of the last time Item received an update.

That being said, you don’t really need to mess with that in this case. For your “c)”, create a timer for now.plusMinutes(10) minutes in the future. The body of your timer will execute “d)”. Everytime you receive an update on gTemperature, simple reschedule the timer for now.plusMinutes(10). Just make sure that after you execute “d)” that you recreate the timer again.

At least for the KNX binding there is a much easier solution…RTFM :slight_smile:
In the binding wiki is one parameter described as:

# Seconds between connect retries when KNX link has been lost
# 0 means never retry, it will only reconnect on next write or read request
# Note: without periodic retries all events will be lost up to the next read/write request
# (optional, default is 0)
knx:autoReconnectPeriod=

And this reconnect really works :slight_smile:

Regarding all other bindings I’ll try the proposal with “touching” the appropriate file in add-ons folder and the timer.

Is there a way to get data via script? I could imagine to grep some information from (is KNX or 1wire connected) or send a command (start xxx or stop xxx) to this OSGi console. The result could be sent via REST to an item.
Is OSGi just interactive or is there a CLI as well? In every case it sounds very interesting, so thanks for the hint :slight_smile:

Does OH2 development think about such binding feature? Collect information from a binding …

  • binding is connected/disconnected
  • statistics like for knx, 1wire and many more: how many packets per minute are on the bus
  • last update message from knx or 1wire bus (which could lead to an alarm if updates messages miss since a defined time)
  • last restart time of the binding
  • list all bindings
  • etc.