Author Topic: Does VCSetEventTimer to time of day work?  (Read 5687 times)

0 Members and 1 Guest are viewing this topic.

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Does VCSetEventTimer to time of day work?
« on: April 03, 2014, 05:15:29 PM »
The help for this says
Quote
The parameter <Delay/Time> can use a number of different formats:
-  A time of day such as 3:45 or 16:30 or 4:00 PM or 8:00 AM
but
Code: [Select]
<action actiontype="VC.SetEventTimer" repeat="1" logic="False"><params><param>19:45</param><param>sunset</param></params></action>gives an error can't parse Time/Delay parameter error.

Any ideas?

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Does VCSetEventTimer to time of day work?
« Reply #1 on: April 03, 2014, 05:36:30 PM »
I 've test it with VC1.9.1.9 and it works. I think you have forget to create the event which you want to trigger, then VC create this error because the event doesn't exist.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.1.9-->
<commandGroup open="False" name="event timer" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1421" name="eventtimer" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>22:25</param>
        <param>sunset</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>VC.Rebuild</event>
    <event>VC.Loaded</event>
  </command>
</commandGroup>
« Last Edit: April 03, 2014, 06:48:21 PM by Kalle »
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Does VCSetEventTimer to time of day work?
« Reply #2 on: April 03, 2014, 05:40:51 PM »
I've tested it with 1.919 as well -- following the 24-hour syntax as described without adding "PM" as Kalle did -- and it is working for me as well.

I've compared my action xml to yours and it's identical apart from the time I used:
Code: [Select]
<macro>
<action actiontype="VC.SetEventTimer" repeat="1" logic="False"><params><param>15:35</param><param>doit</param></params></action>
</macro>
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)

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Does VCSetEventTimer to time of day work?
« Reply #3 on: April 03, 2014, 05:50:40 PM »
I can confirm my post above: if you doesn't create the event, it will show the error which you has described.

***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Does VCSetEventTimer to time of day work?
« Reply #4 on: April 03, 2014, 06:31:46 PM »
It should not throw an error though even if no command uses the event.  The action should work, and tell you how long until the event will fire and then it should fire.  If there is no command that uses it, the event will show up in the history window, it just won't cause a macro to run.

I've tested this with VC1 and VC2 and it works perfectly unless I give it invalid params.

By the way Kalle, it doesn't make sense to use a 24 hour format, and also specify PM.  But VC seems to accept it anyway.

Only thing I can think of is that it doesn't like Garry's locale, but I find it surprising, it should still be able to parse time formats the same as for us.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Does VCSetEventTimer to time of day work?
« Reply #5 on: April 03, 2014, 06:52:02 PM »
You're right, AM/PM makes no sense in 24 hour format. Did not thought about, I have it corrected above - sorry.  :bonk
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Does VCSetEventTimer to time of day work?
« Reply #6 on: April 03, 2014, 07:29:12 PM »
I think the error is thrown when you try to set a time that is before the current time.  Anything else I try with a time later than "now" seems to work perfectly.  I could improve the handling of this by automatically adding 24:00 hours when the specified time is earlier than "now".

I had intended to do that, but I guess I was waffling about whether or not I should add 12 hours or 24 hours.  If it is 10:00 AM and you say "set the alarm for 9:00", it is not clear if you want it to be at 9:00 PM today or 9:00 AM tomorrow.  A lot of people (including me) use a 12 hour clock even though it is as stoopid as using feet and miles and Fahrenheit.

I'll just set it to add 24 hrs for now.

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Does VCSetEventTimer to time of day work?
« Reply #7 on: April 03, 2014, 08:09:50 PM »
Hi James and Kalle

Thanks for all the research on this. I am using 24 hour clock and my locale is the United Kingdom. I did have the event I am calling set up.

I think James is spot on with the time being before now my calculation was probably going over midnight.

ajith

  • $upporter
  • Contributor
  • *****
  • Posts: 87
  • Karma: 2
    • View Profile
Re: Does VCSetEventTimer to time of day work?
« Reply #8 on: April 06, 2014, 09:40:13 AM »
I think the error is thrown when you try to set a time that is before the current time.  Anything else I try with a time later than "now" seems to work perfectly.  I could improve the handling of this by automatically adding 24:00 hours when the specified time is earlier than "now".

I had intended to do that, but I guess I was waffling about whether or not I should add 12 hours or 24 hours.  If it is 10:00 AM and you say "set the alarm for 9:00", it is not clear if you want it to be at 9:00 PM today or 9:00 AM tomorrow.  A lot of people (including me) use a 12 hour clock even though it is as stoopid as using feet and miles and Fahrenheit.

I'll just set it to add 24 hrs for now.

I just verified this. I get the error when I set a time (in 24 hr format, without AM/PM, or even in 12 hr format) that is before the current time.
The way I want to use this is to set a timer on VC.Loaded event for 12:30 AM (this is actually 00:30 in 24 hr format) to generate a "TIMER_SHUTDOWN" event. I would then use the TIMER_SHUTDOWN event to shutdown my media center PC automatically. Presently, neither 00:30 nor 12:30 AM works, because both seem to be "before" the current time.

To remove the confusion, can we just stick to the 24 hr format and assume 09:00 means 9 AM and 21:00 means 9 PM?


jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Does VCSetEventTimer to time of day work?
« Reply #9 on: April 06, 2014, 09:54:27 AM »
To remove the confusion, can we just stick to the 24 hr format and assume 09:00 means 9 AM and 21:00 means 9 PM?
I'm not sure what you mean by this.  Are you suggesting we all use the 24 hour convention when talking on the forum, or are you suggesting that the program assume a 24 hour format?

AFAIK VC will assume a 24 hour format if you don't specify AM or PM and so will I.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Does VCSetEventTimer to time of day work?
« Reply #10 on: April 06, 2014, 10:02:15 AM »
It is a different story when you are creating your commands though.  People will use whatever convention they are comfortable with.  Around here if it is 18:00 and I said "Remind me to walk the dog at ten", I would almost certainly mean 10PM and I would not find it natural to say "Remind me to walk the dog at 22 o'clock".  For the sake of getting my message through to the computer I could be compelled to say "remind me to walk the dog at 10 PM" though.  Everyone is different.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Does VCSetEventTimer to time of day work?
« Reply #11 on: April 06, 2014, 11:47:17 AM »
James,

I have a question about how the time delay format for the set event timer functions.

I know you can set a delay of the form 1h 10m in order to trigger an event 1 hour and 10 minutes from now, for example.

My question is: can the minute delay amount be greater than 60?

The reason I ask is because I was trying to come up with a temporary workaround to accomplish what Ajith is trying to do: setting a timer for 00:30.

I have come up with a time delay solution using a python calculation. Initially I had a problem with the minutes, because depending on the current time my calculation would result in negative minutes. So I came up with the following solution instead, but it means that the set event timer function needs to know that 1h 80m is the same as 2h 20m.

Here's what I came up with. ... Maybe I made this overly complicated. :)

My mission was to avoid needing multiple lines of python code so that I could use just the one Py.ExecString action.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.1.9-->
<command id="276" name="SetShutdownTime" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>PY.ExecString</cmdType>
    <params>
      <param>result=str(23-{dtcustom.HH})+"h "+str(90-{dtcustom.mm})+"m"</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.SetEventTimer</cmdType>
    <params>
      <param>{LastResult}</param>
      <param>TIMER_SHUTDOWN</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>VC.Loaded</event>
</command>
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)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Does VCSetEventTimer to time of day work?
« Reply #12 on: April 06, 2014, 11:48:42 AM »
I am a bit confused by your question.  In order to answer it I tried it, and the answer is yes.  But since you got that far, why didn't you just try it yourself?  I guess maybe you are just asking for the sake of others?  I just did a test setting the timer for 1h 90m and in the history window it shows that the timer was set for 2h 30m.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Does VCSetEventTimer to time of day work?
« Reply #13 on: April 06, 2014, 12:02:46 PM »
Ha. I tested it and saw that the math was correct, but didn't think to roll over the result in the history window.

Sorry babe. I have failed you once again. ;)

Here I thought I was being helpful and creative.
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)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Does VCSetEventTimer to time of day work?
« Reply #14 on: April 06, 2014, 12:17:47 PM »
Well, your solution works perfectly, but the next release of VC2 will make it a bit redundant.  Hopefully it will be instructional for others.  It will also come in handy if you want to set an event timer for "2 days from now at 9:45" or something like that.

Also it gave me the chance to point out that the history windows shows you what the event delay has been boiled down to... :D