Rule implicit variables

Is there a variable pointing back to the item that caused the event. I only found “receivedCommand”…

This would greatly improve “boilerplate code” like

rule "first"
	when
		Item wbf1_roomR_switch1_down received command
	then
		logInfo("Shutter", "{} received command {}", wbf1_roomR_switch1_down, receivedCommand)
end

where you have to repeat the full name of the item…

1 Like

This is a much requested feature but not possible in OH 1.X. However I believe it will highly likely to be added to in the rules engine rewrite in OH 2.

There are some tricks one can use to get to it if your items are in a group (I.e. sort on lastUpdate and get the last item) but that is about it.

thx alot, Rich.

You’re a great enrichment for this forum.

1 Like