HomeGenie Forum

General Category => Troubleshooting and Support => Topic started by: kevinvinv on July 19, 2016, 03:37:38 PM

Title: The New Scheduler
Post by: kevinvinv on July 19, 2016, 03:37:38 PM
Hello,  I am on the latest beta (525 I think) and playing with the new scheduler which is pretty nice.

Does anyone know more about the java code that can be put into the Script section?  I know there are a few pre-set examples but I'd like to go beyond those just a bit... and I am not sure of the syntax and available constructs etc.

Just checking to see if anyone has pushed the limits more on that.

Thanks!!
Title: Re: The New Scheduler
Post by: kevinvinv on July 22, 2016, 12:20:01 AM
For example,   I'd like to be able to turn on the lights every 10 minutes between sunset and sunrise and turn OFF the lights every 10 minutes between sunrise and sunset.

I've done this sort of thing with a program (somewhat successfully) but am wondering if anyone has insite on how to do it with the new scheduler maybe...
Title: Re: The New Scheduler
Post by: mchias13 on July 22, 2016, 05:26:18 PM
I would think this would work for what you want.  You need to create two separate schedules.  Then go to your light setup and tell it the ON and OFF schedules.

For lights on:
(@Sunset > @Sunrise) ; (0/10 * * * *)

For lights off:
(@Sunrise > @Sunset) ; (0/10 * * * *)


Gene added a good bit of explanation here: http://genielabs.github.io/HomeGenie/scheduler.html (http://genielabs.github.io/HomeGenie/scheduler.html)
Title: Re: The New Scheduler
Post by: kevinvinv on July 23, 2016, 02:34:02 AM
Yes...  WHY didn't I think of that?  I was trying to do the anding with 0/10 a different way...  I bet your way will work great!  Thanks!
Title: Re: The New Scheduler
Post by: kevinvinv on July 25, 2016, 06:08:27 PM
Yes this works.  I must say I am pretty happy with the new scheduler!  A very nice improvement!!!
Title: Re: The New Scheduler
Post by: bkenobi on July 25, 2016, 10:36:43 PM
If the new scheduler is working out well, are there any other changes that I should consider prior to updating?  I'm thinking I should flash a backup and try updating to see the new setup, but potentially breaking my working install keeps me from jumping.   8)
Title: Re: The New Scheduler
Post by: kevinvinv on July 25, 2016, 11:03:32 PM
I've seen some strange issues with the scheduler GUI where it seems to forget what lights/switches I had selected... this only seems to happen when I open the gui to change something... and if you just double check that the proper modules are selected before you close the scheduler gui it seems to be just fine.

That is the only bug I've come across so far but YMMV!!
Title: Re: The New Scheduler
Post by: petediscrete on July 27, 2016, 02:13:47 AM
One thing I've noticed on the RPI. Switching screens between different groups causes the icons on the next group to disappear. Just returns the group name and nothing else. I solve this by restarting the service.
Title: Re: The New Scheduler
Post by: kevinvinv on July 29, 2016, 05:00:56 AM
OK-   looking for an idea.

I am using R525 which I think is about the latest.  It has the new scheduler.

I am using X10 and to make it reliable enough I have OVER DESIGNED my DUSK to DAWN timer such that it sends an A1-ON command EVERY 10 minutes between DUSK and DAWN.

Now it works great EXCEPT when my wife wants to watch a movie... in this case... she wants to shut some of those A1 lights off temporarily but my timer just turns them back on every 10 minutes!   :)  Ha... not happy wife.

So I am wondering if anyone has an idea for temporarily suspending this timer code if a flag is set somewhere...  is this what a "Virtual Module" would be for?

I guess if so... I would need to figure out how to access the state of a virtual module from within the JAVA code of the timer script.

Any ideas?

Thanks!!
Title: Re: The New Scheduler
Post by: bkenobi on July 29, 2016, 05:43:47 AM
I have override code in the Advanced Smart Lights code using other modules.  It's complicated and C#, but it might help.
Title: Re: The New Scheduler
Post by: Peter1977 on July 30, 2016, 12:15:44 PM
Are there more options available then only "Sunrise" and "Sunset"?

In the older Sheduler with SolarAltitude there were many options to choose from (eg. evening.goldenhour.start, evening.goldenhour.end, night.start, etc etc)

Is there a list available ?
Title: Re: The New Scheduler
Post by: kevinvinv on July 30, 2016, 09:02:37 PM
you can now do  @sunset+30    for a 30 minute offset.  SO NICE!

Here is what I have for sending an ON command every 20 minutes between sunset and sunrise

 ( (@SolarTimes.Sunset)  > (@SolarTimes.Sunrise ) ) ; (0/20 * * * *)
Title: Re: The New Scheduler
Post by: Peter1977 on July 31, 2016, 11:19:00 AM
Is there a list available with all SolarTimes.* variables?

So far I see there is: SolarTimes.Sunset, SolarTimes.Sunrise, SolarTimes.SolarNoon.
Title: Re: The New Scheduler
Post by: kevinvinv on July 31, 2016, 06:53:44 PM
I haven't seen it published.   I think we'd have to look through the code to decipher it yet.  I assume you want more than just a certain offset in minutes then right?
Title: Re: The New Scheduler
Post by: Peter1977 on July 31, 2016, 07:15:45 PM
yes, i liked the options for goldenhour, etc

Also I don't know if its posible now to see how cloudy it is or if it's raining
Title: Re: The New Scheduler
Post by: bkenobi on August 01, 2016, 05:09:49 PM
Are you asking for a way to use the ambient light level for something?  If you want to do that, I would not rely on a web server (weather underground for example) to determine the cloud cover at a location.  In my area, it could be raining all day in one area and relatively clear just a few miles away.  I doubt the server would be capable of getting it right for exact locations.  If you want to know light levels, you'd be better off setting up a luminescence meter of some kind.
Title: Re: The New Scheduler
Post by: Michel on September 06, 2016, 09:53:58 PM
I like the new scheduler, but I'm wondering where are the Sunset and Sunrise times in the scheduler coming from ? WU says that my Sunset time for today is 19:21,  but in the scheduler it is 19:34. If I create an Expression for a module let's say @Sunset-15 minutes, and I place my cursor on the Expression, it reports 19:07 which is correct by WU time. I have the correct Longitude and Latitude for my location in the maintenace screen.
Title: Re: The New Scheduler
Post by: bkenobi on September 06, 2016, 11:14:07 PM
I don't know how Gene incorporated the feature, but sunrise/sunset are calculations that anyone can do.  They are not simple, but they break down to the latitude and longitude of the position you are interested in.  The equation uses this position to determine angle of sun on a given date that will result in the specified sunrise/sunset time.  If you really want to know about the equations (outside the scope of what you were asking about), check out the wikipedia and NOAA pages.

https://en.wikipedia.org/wiki/Sunrise_equation (https://en.wikipedia.org/wiki/Sunrise_equation)
http://www.esrl.noaa.gov/gmd/grad/solcalc/sunrise.html (http://www.esrl.noaa.gov/gmd/grad/solcalc/sunrise.html)

Without knowing anything else, I'd guess that WU is reporting a different definition for sunrise/sunset than Gene is using in the scheduler.
Title: Re: The New Scheduler
Post by: codedmind on September 17, 2016, 12:00:03 PM
I there.
With the lastest version beta 525 i'm missing shutter on and off ... before i set in each module to turn on and off in sunrise and sunset.

How this can be done now?
Title: Re: The New Scheduler
Post by: mchias13 on September 17, 2016, 01:48:50 PM
If you are doing one thing then it's quite simple. I think this is what you are looking for:

Instructions:. (hope easy to follow)
1) go to scheduler page
2) click add new event (bottom right of screen)
3) name event.  For a light I would do Lights.<description of light>.On
(The "Lights." will put it in the group for lights)
4) click on the clock icon on the end of your new event
5) in pull down menu select "custom script"
6)
For a light to turn on once
@Solartimes.Sunset
7) go to modules (I think that's the wording between code>xxx>script)
8 ) select your light or whatever module you are controlling
9) go to script and from pull down select "turn on"
10) repeat all steps for a new event to turn light off using @Solartimes.Sunrise to turn light off
Title: Re: The New Scheduler
Post by: codedmind on September 17, 2016, 03:09:15 PM
The thing is... the x10 shutter module only have option to sensor zone... don't have options to schedule...

Is that i don't understand
Title: Re: The New Scheduler
Post by: mchias13 on September 17, 2016, 06:15:55 PM
http://www.homegenie.it/forum/index.php?topic=1688.0 (http://www.homegenie.it/forum/index.php?topic=1688.0)

You can follow what Gene says here at the bottom of the thread.  Follow the steps I wrote but instead of selecting a module you'd call a separate program to turn control your shutters.