Zwave Offline Alert

Spent a few hours reading through posts and still confused. Actually more confused. So many ways to alert. I just want a simple alert that will ping the zwave device every XX minutes and if its OFFLINE then report as such. Not on and off, but OFFLINE.

This is what I have tried:

rule "Tower One Check"
when
	Time cron "0 0/30 * 1/1 * ? *"
	or
	Thing "zwave:device:e06c6069:node5" changed from ONLINE to OFFLINE
then
   if (Thing "zwave:device:e06c6069:node5" == OFFLINE)
    logInfo("Tower One Offline", "Tower One is OFFLINE!")
    //and do other things
end

I get this:

has errors, therefore ignoring it: [18,8]: no viable alternative at input 'Thing'

[18,14]: missing ')' at '"zwave:device:e06c6069:node5"'

[18,47]: no viable alternative at input 'OFFLINE'

In the logs, when the device goes offline it reports at “OFFLINE”

Something simple I am sure…

Thanks!

I don’t think you can do the following:

My rules for doing what you are doing looks like this:

rule "b_zwave.rules - 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
1 Like

I agree with the proposed solution, however you will get a lot in return if you decide to use Items instead of Things.

In the code below I asume you’re running OH2.4 or 0H2.5, and Item ZWaveNode26 is associated to Thing "zwave:device:e06c6069:node5":

rule "b_zwave.rules - B01T010"
when
    Item ZWaveNode26 changed
then
	logInfo("b_zwave", "{} {}", triggeringItem.getName, triggeringItem.state.toString)
		B01T010_sOnline.postUpdate(OFF)
	}
	switch(triggeringItem.state.toString) {
		case "OFFLINE": {
			B01T010_sOnline.postUpdate(OFF)
		}
		case "ONLINE": {
			B01T010_sOnline.postUpdate(ON)
		}
	}
end

You could add additional case statements that match other states that you’d like to act upon.

By the way, since you’re not reassigning Status, you could also use val instead of var.

thanks guys, i will work through those. can that be triggered by time? ie, i want to check every XX minutes?

Thanks!

Yes, see here:

Hi Shutterfreak. following up on this. when my zwave device goes offline this is what i get. How do i alert on this?

'zwave:device:e06c6069:node5' changed from OFFLINE (COMMUNICATION_ERROR): Node is not communicating with controller to ONLINE

i was trying to follow what you had in the last line of your response but not sure how it matches up?

Here’s the what you can do in a rule to test for an OFFLINE state (irrespective of the type of OFFLINE state):

var Status = ThingAction.getThingStatusInfo("zwave:device:e06c6069:node5").getStatus()

if status.startsWith("OFFLINE") {
	// Do something if the status changed to one of the OFFLINE states
}