Detecting offline Things in a less stupid way

This is an interesting topic, and one that I have spent quite some time on pondering since I took my very first steps with OpenHAB several years ago…

To test the “internal monitoring” approach I have had the followig rule running for a while on one of my Z-Wave devices, and it seems to do the job:

rule "B01T010"
when
    Thing "zwave:device:e402b8c8:node26" changed
then
    var Status = ThingAction.getThingStatusInfo("zwave:device:e402b8c8:node26").getStatus()
		logInfo("b_zwave", "Node 26 " + Status)
		if (Status.toString() == "OFFLINE")	{
			B01T010_sOnline.postUpdate(OFF)
		}
		else {
			B01T010_sOnline.postUpdate(ON)
		}
end

I completetly agree that this is not a very elegant way to monitor the status of devices, at least if you have more than one, :slight_smile:

A more conceptual problem with this approach is that I am using the home automation system to monitor itself - something I believe goes against the basic philosphy of system monitoring.

For this reason I am currently playing around with using the REST API, but not from the inside by using OpenHAB rules (as proposed by @rlkoshak above). Instead I am using an external component (a Python script) to monitor this from the outside.

The longtime goal is to feed this into some other monitoring solution, like e.g. Icinga or Nagios.

2 Likes