HomeGenie Forum

General Category => General Discussion => Topic started by: mchias13 on February 03, 2017, 05:35:03 PM

Title: wizard script and scheduler
Post by: mchias13 on February 03, 2017, 05:35:03 PM
I created a "night time" event in the scheduler.  Is there a way to access the variable for when it equates to true to be used in the wizard script?

what I'm trying to do:
I have my garage door opener working through my PI.  What I would like to do is turn on my garage light for a few minutes if the door is opened and "night time".  I know how to do everything except reference my "night time" variable.
Title: Re: wizard script and scheduler
Post by: Bounz on February 03, 2017, 10:01:32 PM
Why do you want to use scheduler as a source of "night time" variable? Isn't it easier to declare a variable in script itself? Or you are going to use it in many places?
Title: Re: wizard script and scheduler
Post by: mchias13 on February 04, 2017, 12:48:19 AM
I could just use @solartimes.sunset and @solartimes.sunrise in the wizard script also, but I can't figure out how to do that either


Edit: think I got it working using scheduler.datetime greater than  @solartimes.sunset
Title: Re: wizard script and scheduler
Post by: bkenobi on February 07, 2017, 04:51:33 PM
I haven't used that approach, but I am assuming that if you use it that way,  you will only have night between sunset and midnight.  I think you also need to add in a check for time less than sunrise.
Title: Re: wizard script and scheduler
Post by: mchias13 on February 07, 2017, 08:06:56 PM
I was hoping to only need 1 check to see if the current time was between sunset and sunrise.  I never could get that to work.  So instead I had to do using the weatherunderground times:

Garage door is open
time > sunset
or
garage door is open
time < sunrise


my goal was to do:
garage door is open
time = nighttime  (where nighttime is defined in the scheduler as from sunset->sunrise)
Title: Re: wizard script and scheduler
Post by: Bounz on February 07, 2017, 09:38:23 PM
I think you can take a look at "Outdoor.On" schedule example that is bundled with HG.
I didn't find any documentation on how this work, might have a look into the source code.
Title: Re: wizard script and scheduler
Post by: mchias13 on February 07, 2017, 10:14:53 PM
i do that for some lights that are based on time only.  I haven't seen an example of how to compare it to another sensor and time in the scheduler.