Plugin to turn any switch into a scene controller

Scenario; In a room, I have 3 switches and 1 Zwave outlet.

I wanted to be able to control the outlet without the use of a scene controller.

The only logical way I could think of controlling that outlet without it requiring something else to be on or off would be to create a countdown timer and 2 scenes (a bit clunky);

Countdown timer = 3 Seconds duration
Scene 1: Trigger (light switch turned on) - Executes (Restart Countdown Timer)
Scene 2: Trigger (Countdown timer Restarted) - Executes (Toggle switch power using simple luup to check status and toggle status)

So if the light is turned on/off/on within 3 seconds, the outlet will toggle it’s power status.

This is working reliable with the exception of it requiring roughly a half second between the last off / on for Vera to catch it (using GE On/Off switch). Not a problem, but still not perfect.

I got to thinking that a plugin to do this may be very simple to make, unfortunately i’m not savvy enough to create this, but maybe someone has already done this, or can do this easily for the community.

So my question; Can someone create a Plugin that works similarly to what I’ve described and you can input the following variables?

1 = Source light that will be toggled
2 = Duration of time to allow for toggle to be completed
3 = Device(s) or Scenes to executed (on and off) upon successful toggle

This may be an easy task for some, and i’m still learning the very basics, but I believe this would be a great plugin as it would essentially turn any switch that doesn’t already allow a toggle or double press to control scenes.

Thanks in advance for anyone’s time on this.

Pseudo code:

source_light    = 11 -- device no.
last_on         = 0  -- unix timestamp
toggle_interval = 3  --  seconds

watch current state of source_light, callback: handle_toggle

handle_toggle:

 if switched on 
  then

   current_time = current time

   if current_time - last_on < toggle_interval
    then

     <whatever has to be done ...>

    end

   last_on = current_time

  end