Added support for simple cron style date/times

2 views
Skip to first unread message

George Farris

unread,
Jan 19, 2016, 11:30:18 PM1/19/16
to pytom...@googlegroups.com
Greetings all,

Just commit on git. https://github.com/king-dopey/pytomation

Added support for simple cron style date/times for Trigger and Ignore

Simple cron style date and times were added to commands that have START
and END attributes such as Trigger, Ignore and Restriction.

The cron style is a follows:
  (seconds, minutes, hours, day-of-month, month, day-of-week)

Entries must be integers except you may use '*' to denote any time or
date.  Ranges are not supported yet.  

An example is below:

trigger={
        Attribute.COMMAND: Command.ON,
        Attribute.MAPPED:  (Command.LEVEL, 50),
        Attribute.SOURCE: somebutton,
        Attribute.SECS: 300,
        Attribute.START: ('*',25,16,8,12,'*'),
        Attribute.END: ('*','*','*',7,1,'*')
},

So an ON command from "somebutton" will turn the light on at 50%
brightness after 300 seconds starting December 8th at 4:25pm and
lasting until January 7th.

Mixed dates are allowed so you can use a start or end date in cron
style and the other in 'HH:MM' or 'HH:MM:SS'.

It is best to stick with 24 hour clocks but you can use "am" or "pm" in
a time as in '7:24am' or '4:30pm'.  DO NOT add an "am" or "pm" to 24
hour clocks.  Not only does  it not make sense, it doesn't work. 

Remember that times in clock style are strings and must be enclosed in
quotes.

Cheers all and enjoy.

George


Reply all
Reply to author
Forward
0 new messages