Author Topic: Question about timer delay  (Read 3710 times)

0 Members and 1 Guest are viewing this topic.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Question about timer delay
« on: July 02, 2014, 06:20:48 AM »
A quick question:
If event X at 3:00pm triggers a timer with a delay of 3 minutes to trigger event Y
Event X triggers again  at 3:02pm

Will event Y trigger at:
1. 3:03 pm
2. 3.05 pm
3. 3:03 and 3:05 pm

?
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Question about timer delay
« Reply #1 on: July 02, 2014, 08:02:02 AM »
If you are using VC.SetEventTimer then it should create a second timer. So the answer is option 3

If that is not what is happening then please post your xml

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Question about timer delay
« Reply #2 on: July 02, 2014, 07:25:30 PM »
James, will do tests tonight and confirm ...

your answer bring another question  ;D ... is there is a way to make it do number 2 ? in other words if a timer created is there is a way to reset it or cancel it to avoid the event triggering in the wrong moment
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Question about timer delay
« Reply #3 on: July 02, 2014, 08:35:30 PM »
There is no way to modify (or delete) an event timer once it has been created by the VC.SetEventTimer action.

There is probably another reasonable solution depending on the application. Worst case scenario you could create your own timers in Python.
« Last Edit: July 02, 2014, 08:46:46 PM by nime5ter »

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Question about timer delay
« Reply #4 on: July 03, 2014, 12:39:18 AM »
Confirming it is number 3 ...
The scenario is keeping lights on as long as the kinect see a person ...thus it has to reset the timer ... One nobody within range the timer will expire and turn of light automatically

Will look into the python timers

Tx for the feedback
When Voice command gets tough, use hand gestures

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Question about timer delay
« Reply #5 on: July 03, 2014, 08:43:41 AM »
No problem if you prefer to use Python, but here is another method.

*** NOTE: The following VC command concept can be used without any Python to ensure that VC ignores the timers that you want reset, and only reacts to the last timer that you set. ***

If anyone would like more explanation of what's happening, let us know. Basically, it just uses a time stamp variable to keep track of which timer was set last.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.0.0.0-->
<commandGroup open="True" name="validate timer" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="259" name="set timer" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>timestamp</param>
        <param>{DtCustom.H:mm:ss}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>3m</param>
        <param>lights.off</param>
        <param>{var.timestamp}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>timer set</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>set timer</phrase>
  </command>
  <command id="275" name="decide whether lights off" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{var.timestamp}&amp;&amp;{1}</ifParams>
      <then>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Turning out the lights.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Killing this timer.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <event>lights.off</event>
  </command>
</commandGroup>
« Last Edit: January 14, 2015, 09:52:13 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Soda97

  • Contributor
  • ***
  • Posts: 69
  • Karma: 1
    • View Profile
Re: Question about timer delay
« Reply #6 on: January 13, 2015, 06:39:51 PM »
Hadood,

you have a script/code that does this?

"keeping lights on as long as the kinect see a person ... One nobody within range the timer will expire and turn of light automatically "



Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Question about timer delay
« Reply #7 on: January 14, 2015, 03:32:24 AM »
nope .. because one can not cancel the timer once started ... at the time did not feel like using the python I was just starting with VC ... check iSpy to use Kinect as security CAM ... and based motion detection you can trigger events in VC ... then use nime5ter python to create a timer that can be cancelled...

Edit: as James mentioned below use nime5ter method above (I answered from iphone, thought it was Python code)
« Last Edit: January 15, 2015, 09:14:25 PM by Haddood »
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Question about timer delay
« Reply #8 on: January 14, 2015, 09:11:34 AM »
If you look up a just couple of posts you will see that nime5ter offered a simple non-python solution to effectively resetting timers.

http://voxcommando.com/forum/index.php?topic=1642.msg14318#msg14318
« Last Edit: January 14, 2015, 10:53:34 AM by jitterjames »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Question about timer delay
« Reply #9 on: February 03, 2015, 06:28:32 PM »
James, will do tests tonight and confirm ...

your answer bring another question  ;D ... is there is a way to make it do number 2 ? in other words if a timer created is there is a way to reset it or cancel it to avoid the event triggering in the wrong moment

A new core action, VC.StopEventTimer has been added as of VC 2.1.3.8, released today.

http://voxcommando.com/mediawiki/index.php?title=ChangeLog#Version_2.1.3.8
« Last Edit: February 03, 2015, 08:48:16 PM by jitterjames »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Question about timer delay
« Reply #10 on: February 04, 2015, 05:15:27 AM »
I saw it in the change long when I downloaded the new version ...  And I was all like :yay :yay :yay

Thanks guys ... It is a very good addition to VC
« Last Edit: February 04, 2015, 05:18:59 AM by Haddood »
When Voice command gets tough, use hand gestures

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Question about timer delay
« Reply #11 on: February 04, 2015, 08:14:21 AM »
Actually, there's a new feature in the xJson plugin settings that you'll like too. (Sorry, I just added it to the Change Log now -- an oversight.)
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Question about timer delay
« Reply #12 on: February 04, 2015, 08:05:10 PM »
 :-X :-X :-X I mean speechless ... you guys give ultimate customer care a new definition...
When Voice command gets tough, use hand gestures

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Question about timer delay
« Reply #13 on: February 04, 2015, 09:22:29 PM »
Ha ha. Yes, indeed. Just imagine if you only had to buy your supper once, and then, every day for the rest of your life the chef came to your home to cook you something new!

(That's why we're living the lifestyle of the Rich & Famous! ;-P)

Enjoy.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)