OH3: Getting TriggeringItemName and PreviousState of Thing changed

I’ve added triggeringThing, previousStatus and newStatus in this pull request which should be included in the next milestone and release.

You’ll then be able to do the following

rule "test" when
	Thing "mqtt:topic:thing1" changed or
	Thing "mqtt:topic:thing2" changed
then
	logInfo("triggeringThing", "Trigger Thing is: " + triggeringThing) // mqtt:topic:thing1
	logInfo("triggeringThing", "Trigger Thing previous Status is:" + previousStatus) //ONLINE
	logInfo("triggeringThing", "Trigger Thing new Status is:" + newStatus) //OFFLINE
	val changedThingStatus = getThingStatusInfo(triggeringThing)
	logInfo("triggeringThing", thingStatusInfo.getStatus.toString) // OFFLINE
	logInfo("triggeringThing", thingStatusInfo.getStatusDetail.toString) // COMMUNICATION_ERROR
	logInfo("triggeringThing", thingStatusInfo.getDescription) // Authentication Failed
end
3 Likes