I am using "trigger event" with a delay to switch devices on and off for a set length of time.
But sometimes I'd like to be able to cancel such a delayed trigger.
I tried to use "clear pending events", but since the trigger hasn't happened yet, that does not effect the delayed trigger as it is not an event yet.
Is there any other way to do this? Or am I stuck with this delay, and have to wait it out?
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
cancel a delayed "trigger event"
Re: cancel a delayed "trigger event"
OK, never mind. Found a workaround myself.
Instead of using the trigger event I will use a combination of two timer actions: the first to cancel an already running timer, the second to start the timer with the right amount of time.
Now if someone activates the macro (by pushing a button on a remote), and then does it again later on, it will restart the timer and give that second button-push the right amount of time.
Instead of using the trigger event I will use a combination of two timer actions: the first to cancel an already running timer, the second to start the timer with the right amount of time.
Now if someone activates the macro (by pushing a button on a remote), and then does it again later on, it will restart the timer and give that second button-push the right amount of time.
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: cancel a delayed "trigger event"
Hi,
I was thinking about another way that might work too and that would be simpler to maintain (if it works of course, haven't tested it, just a theory at this point...)
When you use the EventGhost action "Trigger Event" with a delay, you are actually scheduling this with the eg.Scheduler
So, if you have the event name, the following should work:
This is how EG schedules your event (when you press Apply or OK in the configuration dialog for the "Trigger Event" action where eventString is the name of your event you just defined
If you would like to cancel this (before it is started) you could try
Best regards, Walter
I was thinking about another way that might work too and that would be simpler to maintain (if it works of course, haven't tested it, just a theory at this point...)
When you use the EventGhost action "Trigger Event" with a delay, you are actually scheduling this with the eg.Scheduler
So, if you have the event name, the following should work:
This is how EG schedules your event (when you press Apply or OK in the configuration dialog for the "Trigger Event" action
Code: Select all
eg.scheduler.AddTask(waitTime, eg.TriggerEvent, eventString)If you would like to cancel this (before it is started) you could try
Code: Select all
eg.scheduler.CancelTask(eventString)Best regards, Walter
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM