Fire a Rule when Thing goes OffLine or change its status

Hi,
is possible to fire a rule when Thing goes offline or change their status? I need to run a batch when Thing goes offline.

Thanks

2 Likes

I’m using this rule, but it was not fired when Thing change its status:

rule "Zoneminder Restart"
	when 
		Thing "zoneminder:server:74e9b984" changed
	then
		var status = ThingAction.getThingStatusInfo("zoneminder:server:74e9b984").getStatus()
        logInfo("Monitor-ZM","Stato: "+status.toString())
   
	end	

The general idea works for me, example

Make sure you are asking for a Thing that really does change. Not everything in a thing hierarchy goes offline when one part does. Look in the logs.

Hi,
I just monitor this thing via API with Zabbix, so I’m sure that thing change its status.

Marco

This is error I got into the logs:

[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Zoneminder Restart': The name 'ThingAction' cannot be resolved to an item or type; line 11, column 16, length 11

Oh. An error when the rule runs, not that “it was not fired”. Makes it hard to help.

Just take ThingAction out of your rule, like in my working example

var status = getThingStatusInfo("zoneminder:server:74e9b984").getStatus
2 Likes

Removing ThingAction it works
very Thanks

Marco