Item update only if was triggered by timer

Hi

I’m using some rules to trigger / control my sprinkler system for gardening.

One part is this auto-stop timer.

// STOPS AFTER x MIN OF AUTO=OFF
pi2_sp_timer = createTimer(now.plusSeconds(duration), [|
	logInfo("pi2_sp timer.rules", "Timer expired and set " + triggeringItem.name.toString() + " to OFF")
	triggeringItem.sendCommand(OFF)
])

Now I want to get and store the information when this “switch” was last used /stopped by timer.

I don’t want to get the lastUpdate if it’s manually stopped. In this case I can use the lastUpdate parameter, since I’m using OH 2.5

Is there an easy way to manage this? Or it’s needed to create virtual items, one per valve, to store it?

Thx, markus

I’ve now created all items with “_lastUpdate” suffix. Using the rule I do the update…

	// STOPS AFTER x MIN OF AUTO=OFF
	pi2_sp_timer = createTimer(now.plusSeconds(duration), [|
		logInfo("pi2_sp timer.rules", "Timer expired and set " + triggeringItem.name.toString() + " to OFF")
		triggeringItem.sendCommand(OFF)
		postUpdate( triggeringItem.name + "_lastUpdate", new DateTimeType().toString )
	])
1 Like