Author Topic: Date and Time based rules  (Read 1582 times)

DaveB

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Date and Time based rules
« on: April 14, 2010, 05:48:05 pm »
John;  I am playing around with Date and Time based rules.  Is there the ability to have an interval based Rule also fire off in relation to sunset or sunrise?  Also, with intervals, is there the ability to choose every other or every x days as an interval?

Lets say I wanted to implement an irrigation screen set and that I use either Elk or HAI as the control source for the irrigation valves.  You then need the ability to fire off on ODD or EVEN days or every 3 days and so on at something like 10 minuets after sunrise.  So in combination; an interval tied to a sunrise offset or sunset offset time.  This prevents the irrigation from running when the sun is not up and changes astronomically. 

Ah, always more to do!
Thanks!
Dave

John Hughes

  • Administrator
  • Hero Member
  • *****
  • Posts: 2852
    • View Profile
    • Codecore Technologies
Re: Date and Time based rules
« Reply #1 on: April 14, 2010, 10:15:31 pm »
Yes can do all that you are asking.

Create a new rule, choose the date & time device, then choose the appropriate event.  There are events for sunrise, sunset, # of hours, etc. You can also filter by certain days of the week. In order to filter by every X days you would need to add some script to your rule since there is not simple filter... but there should be. Please post that as a feature request.

In your script you could add an if statement to determine if the current day of the year is an even number for example.
John Hughes
Codecore Technologies

DaveB

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: Date and Time based rules
« Reply #2 on: April 16, 2010, 04:57:56 pm »
Thanks.  I will add the request.  The If statement is how I previously did this prior to the release of HAI 3.0.  Now they have the ability to do as above without complicated code. 
Thanks!
Dave

John Hughes

  • Administrator
  • Hero Member
  • *****
  • Posts: 2852
    • View Profile
    • Codecore Technologies
Re: Date and Time based rules
« Reply #3 on: July 18, 2010, 12:23:27 pm »
This feature will be available in v0.25. 

You can now set any property to a value for a specified duration of time and then have it set to another value. 
There are also specialized methods for lighting and outputs.

The associated methods are named:

* SetLightLevelForDuration
* TurnOnLightForDuration
* TurnOnOutputForDuration
* SetPropertyForDuration <- this can be used for any property.
« Last Edit: July 18, 2010, 12:38:20 pm by John Hughes »
John Hughes
Codecore Technologies

DaveB

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: Date and Time based rules
« Reply #4 on: August 08, 2010, 05:41:46 am »
....Or "Turn Irrigation valve on for duration"....That actually was my original intent for the change and it works great.  Good job and thanks! 
Thanks!
Dave