Most recent event

Hi all,
Is there a simple method to get the most recent event of a given type from a device?

Scenario: I'd like to check the last time a motion sensor was active. I can subscribe to it's events and record it in my application's state, but I'm curious if there's a simpler way (e.g. query the device events and pull the date/time of the most recent "motion:active" events.

thx!

This should work ...

device.events([max:num]).find{ it.name == "motion" && it.value == "active"}

where device holds the Device or DeviceWrapper object, and num == 2 (unless the events have duplicate entries, in which case you can increase it).