Complex motion/presense rule/s?

You can get this information through Persistence. When you call MyItem.previousState(true) it will return a HistoricState Object which includes a timestamp (.getTimestamp) and the state (.state). By passing true to the call it will return the previous state that is different from the current state. You can then check the timestamp to see how long ago it is. This works great as long as your “since” is greater than half a second or so. It takes time to save the states to the database.

Except when sleeping one would presume. As Markus indicated, this is one of the more difficult problems to solve in home automation.