Getting device events by name/attribute

I have a 4-in-1 temperature/humidity/motion/illuminance sensor, and I want to get the past few temperature events in a smart app. When I do the following I get events for all attributes:

preferences {
	section("Oil heater control:") {
        input "tempSensor", "capability.temperatureMeasurement", required: true, title: "What temperature sensor?"

def initialize() {
	subscribe(tempSensor, "temperature", temperatureHandler)

def temperatureHandler(evt) {	
    def temperatures = 4)

Is there a way I can pass in the name of the event (temperature) into the call? Or do I have to manually track the history of the events (in a global variable or similar) I receive in the handler?

tempSensor is a multi sensor device so it will have all the events reported by the DTH when you read it back. However you should be able to filter the events by name temperature


Thanks for the help. I got it working by reading the temperature directly from the temperatureHandler event, and storing the previous value in the state collection. That should be quicker than querying for all past values too.