Routine Execution, detect if manual or scheduled

I would like to find out if a routine has been run by a scheduled event or that a user has selected it from the app and runs it on demand. Is this possible?
I would like to implement the possibilty of keeping devices on or off when a mode change fires on-demand, e.g. my TV off at when i press good night on demand, but not when it is scheduled.