How to catch "Thing 'zwave:device:xxx:node3' has been updated." in rule

I get this message in log:

2018-03-09 19:32:56.211 [me.event.ThingUpdatedEvent] - Thing 'zwave:device:xxx:node3' has been updated.

Is there a way to catch this in a rule?

This is not firing the rule:

rule "Z-Wave Node3 received update"
    when
        Thing 'zwave:device:xxx:node3' received update
    then
        logInfo("Info", "zwave:device:xxx:node3: updated")
end

What I’m doing wrong?

I can see no obvious errors.

Maybe there is another error within the file, which prevents the file for being loaded. This would be stated by a log line in openhab.log similar to

... has errors. therefore ignoring it...

It’s also possible that you have to use double quotes

Thing "zwave:device:xxx:node3" received update

And another idea:

What’s the (exact) name of the rules file? (has to be ./rules/something.rules, where something would be some meaningful name)

There are a lot of other rules in this file and all other rules are working. only this one not.

Did you already restart openHAB or the whole Computer?

Two things.

  1. I believe you want to reference the Item not Thing.

  2. You can also try changed for your when trigger.

The following works for me.

rule "Reset Garage States"

when

   Item Door_Garage changed or
   System started

then

Hmm… I don’t think so…

https://docs.openhab.org/configuration/rules-dsl.html#thing-based-triggers

Well then maybe his “thing” didn’t receive an update.

Thank you all for the hints.

I have some experience with OH and most of what you told me I’ve tested before open this post.

What I want to do:
I need an information which of my 70 z-wave devices do no longer report anything. For mostly all of them I created a group and a rule to trigger about reporting battery state. If there is no update within 3 days I get an message to care about the device. Only one manifactor does not report battery updates in a reliable time slot. But in the z-wave log I see this “Thing ‘zwave:device:xxx:node3’ has been updated” for this devcies

So I thought that for only this devices I create dedicated rules to update timestamp of last seen by this trigger. But I never get this rule to work. I see it in the log but rule keeps silent. I tried “changed” too. But there is not change on the thing. Only if it will change from ONLINE to OFFLINE, But this will happen only on startup of OH.

If I compare it with my astro rules. the syntax should be correct. But it is a Channel not a Thing in that case.

Channel 'astro:sun:home:set#event' triggered START

And a second thing I discovered, triggeringItem is not available for this kind of rule. It is clear because there is no underlying Item related to. I have to create a rule for every of this devices.

As an workaround, you could try monitoring events.log from a shell script and, when a line with the pattern you want is found, trigger an update of an item with rest api.
That is, if you’re using Linux… Doable in Windows also, but more complicated.

This works for me (for online/offline state):

when 
	Thing "zwave:device:15ca6a108b9:node26" changed
then

If you need to catch rules errors, take a look at:

And with LogReader you can catch what ever you want from different logs. And of course filter out anything unwanted.

Thanks for all your additional hints.

The log says nothing special what is wrong. No rule error is here.

Due to that the state is not chaned the rule tirgger “changed” is not working. I will try to implemnt the work around and monitor the event.log from a script.

I come back to my old post.

In the doc of OH - rule - trigger there is a hint what to do:

Thing <thingUID> received update [<status>]
For example, one z-wave device can be "zwave:device:c5155aa4:node14"

But this is not working. Is this a bug?

No, it is still working fine like I described above:

Full rule:

rule "zwave node 26"
	when 
		Thing "zwave:device:uzb:node26" changed
	then
		var status = ThingAction.getThingStatusInfo("zwave:device:uzb:node26").getStatus()
		//logError("Debug", "Library Rules | " + status)
		
		if (status.toString()=='OFFLINE')
		{
			//logError("Debug", "Attempting to turn off light")
			logInfo("EXTRA","ON_OFFLINE: node 26 offline")			
		}
		else {
			logInfo("EXTRA","ON_OFFLINE: node 26 online")	
		}
end

Thanks, is it working for update too?

Thing "zwave:device:xxx:node3" received update

instead of

Thing "zwave:device:uzb:node26" changed

Just try it :rofl:

I cannot try it, my things send only update notification, no change notification. I can see this in the log.

The question is, can you test it on your side. Because you have a running rule which is triggered by change and have a device which causes this. The update rule should be triggered too. If this is working on your side, I know that something is wrong on my side.

My z-wave items send only update messages no change in the log. Therefore my rule “changed” will never triggered.

I get no update events on the nodes, but changed events on openHAB restart.
So I guess you need to find something else for your usecase.

Do you only need this for number items? I’m using an expire binding function and a group for some of my temperature devices which works pretty well:

Group:Number:OR(UNDEF,NULL) gCheckSensorStates 
Number Temperature (gCheckSensorStates) { mqtt="<[mosquitto:/esp8266three/temperature/rainwater:state:default]",expire="60m" }

rule "check sensor state"
when
	Item gCheckSensorStates changed
then
	if (gCheckSensorStates.state==UNDEF) {
	val triggerItem = gCheckSensorStates.members.filter[ i|i.state==UNDEF ]
	logInfo("EXTRA","No more data from: "+triggerItem)
	}
end

I have some z-wave devices which do not send any updates without a trigger. For them I search for something to know if they are connected/active and not dead.

Most of my devices send a battery update within 4 hours. I catch thsi and update the corresponding last_update item. Some not. But I see

Thing 'zwave:device:xxx:node3' has been updated.

in the log for them. I tried to catch this message and update the last_update state of these device.