News:

HOT TIP! Commands and groups can be copied and pasted directly from your command editor to the forum, and vice versa. This makes sharing command XML on the forum much easier!

Main Menu

Question about timer delay

Started by Haddood, July 02, 2014, 06:20:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Haddood

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

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

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

#3
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.

Haddood

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

#5
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.

<?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>
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

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

#7
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)
When Voice command gets tough, use hand gestures

jitterjames

#8
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

nime5ter

#9
Quote from: Haddood 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

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
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

#10
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
When Voice command gets tough, use hand gestures

nime5ter

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

 :-X :-X :-X I mean speechless ... you guys give ultimate customer care a new definition...
When Voice command gets tough, use hand gestures

nime5ter

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)