more G-Labs products

Author Topic: wizard script and scheduler  (Read 652 times)

February 03, 2017, 05:35:03 PM
Read 652 times

mchias13

  • **
  • Information
  • Jr. Member
  • Posts: 45
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.

February 03, 2017, 10:01:32 PM
Reply #1

Bounz

  • ***
  • Information
  • Full Member
  • Posts: 94
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?

February 04, 2017, 12:48:19 AM
Reply #2

mchias13

  • **
  • Information
  • Jr. Member
  • Posts: 45
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
« Last Edit: February 04, 2017, 01:25:19 AM by mchias13 »

February 07, 2017, 04:51:33 PM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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.

February 07, 2017, 08:06:56 PM
Reply #4

mchias13

  • **
  • Information
  • Jr. Member
  • Posts: 45
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)

February 07, 2017, 09:38:23 PM
Reply #5

Bounz

  • ***
  • Information
  • Full Member
  • Posts: 94
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.

February 07, 2017, 10:14:53 PM
Reply #6

mchias13

  • **
  • Information
  • Jr. Member
  • Posts: 45
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.