more G-Labs products

Author Topic: Scheduler Time Range  (Read 698 times)

November 01, 2016, 04:50:04 PM
Read 698 times

claton

  • *
  • Information
  • Newbie
  • Posts: 10
I have setup an event in scheduler to turn off A10 during a time range of 25 minutes.  I'm confused if this will switch it off just once randomly in the range or every minute in the range?

November 01, 2016, 07:44:11 PM
Reply #1

mchias13

  • **
  • Information
  • Jr. Member
  • Posts: 45
so you did (1000 > 1025) [just as an example not exact code] for the light to turn off during that kind of time range?  if so then anytime between 1000 and 1025 if the light is detected to be on it will turn off.

i had set up a light to turn on from (sunset > sunrise) and found i couldn't turn the light off manually.  as soon as it was polled it would turn back on.

November 01, 2016, 08:27:55 PM
Reply #2

claton

  • *
  • Information
  • Newbie
  • Posts: 10
I'm using the latest version scheduler from r525.  You don't need to input in cron syntax.  I was hoping the time range, in my case 10:17pm to 10:43pm, would act like the security feature of HomeSeer. ie, A10 would be turned off only once at some random point within this range.  This would give the appearance someone was home because the light doesn't go out at the exact same time each night. This event is my vacation setting and A10 OFF activates a wizard script that turns lights off in a sequence that gives the appearance you're walking around shutting lights off to go to bed.

If it's as you describe in the post above, I can't see much usefulness for this feature.
« Last Edit: November 02, 2016, 03:12:28 AM by claton »

November 02, 2016, 02:52:24 AM
Reply #3

kevinvinv

  • ****
  • Information
  • Sr. Member
  • Posts: 196
The scheduler doesn't act as you are hoping from what I can tell.  I have not seen any auto-randomizing feature in it so far.

I use X10 though... so things are Random all on their own!!!

November 02, 2016, 04:13:06 PM
Reply #4

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I use the old scheduler so the new one may act different.  In the old version, the scheduler code was run at 30 second intervals so if your event triggered at 10:25, it would fire at 10:25:00 and 10:25:30.  In the old version, you could change the APP to only run 1x per minute, but that is dangerous because if something happened and it ran at 10:24:59 and then at 10:26:01 you would miss your event.

I am not familiar with the new scheduler so I don't know if it works the same.

November 03, 2016, 05:50:53 PM
Reply #5

Michel

  • **
  • Information
  • Jr. Member
  • Posts: 42
In your event scheduler, Set time at 10:17 PM - Select your module (in this case it is A10) and in the script window, enter the following :

// Get a random number between 1 and 25
var delay = Math.floor(Math.random() * 25) + 1;

// Pause that number of minutes
  hg.Pause(delay * 60);

// turn off all selected modules
$$.boundModules.off();



Save this event and that"s it.

November 03, 2016, 09:30:06 PM
Reply #6

kevinvinv

  • ****
  • Information
  • Sr. Member
  • Posts: 196
OK THIS is cool!

I've been trying to find out what sort of code could be put in that code box.

May I ask this question?   Do you have any more information on what is available there?  I would like to be able to query the state of another module and enable the bound modules or not based on the state of the other module.

Do you know if anything like that could be done?

Or - another thing... could one call a C# HG program from it?

So many questions   :)

November 04, 2016, 12:01:12 PM
Reply #7

Michel

  • **
  • Information
  • Jr. Member
  • Posts: 42
I'm not a programmer, so I don't have answers to your questions. It is mentioned in the script window that we have to enter javaScript commands, Gene said he is at writing the new documentation. We will probably have more information when it will be done.

November 13, 2016, 01:11:44 PM
Reply #8

claton

  • *
  • Information
  • Newbie
  • Posts: 10
Thank you all for the help, special thanks to Michel for the script.