Project Home‎ > ‎Documentation‎ > ‎Attributes‎ > ‎

Time

Time is used to change the state of a device at a specified time of day. If you wanted a light to turn on at 6:00pm and off at 10:45pm, you would use "time" to do it. All time is valued in hours and minutes and either AM or PM or in crontab format.

Syntax:

time={
	Attribute.COMMAND:  Command.<State>,
	Attribute.TIME:	    <time in HH:MMam|pm> or (sec,min,hr,dom,mon,dow)
},



Example:

Turn a device on at 10:00am and off at 5:20pm

time=({
	Attribute.COMMAND:	Command.ON
	Attribute.TIME:	'10:00am',
},
{
	Attribute.COMMAND:	Command.OFF
	Attribute.TIME:	'5:20pm',
},),


Unix Crontab example, On at 8:30pm Saturday

time={
	Attribute.COMMAND:	Command.ON
	Attribute.TIME:	(0,30,20,'*','*',6),
},


Crontab on every even minute, off every odd minute, only Saturday and Sunday
time=({ Attribute.TIME: (0,range(0,60,2),'*','*','*',[6,7]), Attribute.COMMAND: Command.ON }, { Attribute.TIME: (0,range(1,60,2),'*','*','*',[6,7]), Attribute.COMMAND: Command.OFF } ),

Comments