Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

perform action only if within a specific date range?

If you have a question or need help, this is the place to be.
Post Reply
User avatar
Fiasco
Plugin Developer
Posts: 222
Joined: Fri Jul 24, 2009 5:32 am
Location: St. Louis MO
Contact:

perform action only if within a specific date range?

Post by Fiasco »

Is there a plugin or script to execute a command only if it falls within a time period?

For example, bump back the thermostat when the sleep button is pushed only if it is between april and october?
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: perform action only if within a specific date range?

Post by Pako »

You can use this script:

Code: Select all

#Date Format: month-day
start ="04-01"
stop = "10-31"
now = eg.Utils.time.strftime("%m-%d")
if now < start or now > stop:
    eg.programCounter = None
If the date is within the specified limits, the macro continues.
If the date is outside the specified limits, the macro stops working.

Pako
Post Reply