I don't know how relevant this is to the M1 or not but here is how I code such functionality in C-Max for the Ocelot:
0478 - IF X10 A/1, OFF Command Pair // if command is received
0479 - AND Timer #1 = 0 // and timer is not running
0480 - THEN Timer #1 = 1 // then start timer to look for second press
0481 - THEN Skip to line 488 // and skip rest of routine for this pass
0482 - IF X10 A/1, OFF Command Pair // if command is received
0483 - AND Timer #1 is > 0 // and the timer *is* running
0484 - THEN Timer #1 = 0 // stop the timer
0485 - THEN X10, B/1 Turn OFF // do the secondary function
0486 - IF Timer #1 becomes > 6 // if 6 seconds have gone by
0487 - THEN Timer #1 = 0 // then just stop the timer
Essentially, the Ocelot watches the power line for a command that is usually done directly by the user, such as a minicontroller to turn off a light. Upon seeing that, it starts a timer to create a timing window during which if it sees a second repeat of the command, it performs a secondary function and closes the timing window immediately. If the time expires (after a set interval, like 6 seconds in this example) then the timing window is simply closed to reset the routine.
If you can translate this into M1-ese, then you should be able to do your routine.