Timers
Timers allow you to automate your device based on time triggers
To control a device locally 16 timers are programmable. They can be configured with the Timer<x>
command followed by a JSON payload with optional parameters. For example:
Timer 1 will ENABLE output of POWER1 at exactly 2:23 every Tue/Wed and Sat
Timer1 {"Enable":1,"Time":"02:23","Window":0,"Days":"--TW--S","Repeat":1,"Output":1,"Action":1}
Timer 4 will TOGGLE output of POWER2 within a 30 minute window centered around 16:23 each Sunday, Monday, Thursday and Friday and will disable (disarm) after executing.
Timer4 {"Enable":1,"Time":"16:23","Window":15,"Days":"SM00TF0","Repeat":0,"Output":2,"Action":2}
When Mode 1
or Mode 2
is used, Latitude
and Longitude
are required. In that case the Time
value is always used as an offset from sunrise or sunset, so make sure to set it to 00:00
if no offset is wanted. Timer 1 will ENABLE output of POWER1 2 hours and 23 minutes before sunset every day of the week.
Timer1 {"Enable":1,"Mode":2,"Time":"-2:23","Window":0,"Days":"11TW11S","Repeat":1,"Output":1,"Action":1}
Commands~
JSON Payload Anatomy~
JSON Name | JSON Value |
---|---|
Enable | 0 = disarm or disable timer1 = arm or enable timer |
Mode | 0 = use clock time1 = Use local sunrise time using Longitude , Latitude and Time offset2 = use local sunset time using Longitude , Latitude and Time offset |
Time | When Mode 0 is active> hh:mm = set time in hours 0 .. 23 and minutes 0 .. 59 When Mode 1 or Mode 2 is active> +hh:mm or -hh:mm = set offset in hours 0 .. 11 and minutes 0 .. 59 from the time defined by sunrise/sunset. |
Window | 0..15 = add or subtract a random number of minutes to Time |
Days | SMTWTFS = set day of weeks mask where 0 or - = OFF and any different character = ON |
Repeat | 0 = allow timer only once1 = repeat timer execution |
Output | 1..16 = select an output to be used if no rule is enabled |
Action | 0 = turn output OFF1 = turn output ON2 = TOGGLE output3 = RULE/BLINKIf the Tasmota Rules feature has been activated by compiling the code (activated by default in all pre-compiled Tasmota binaries), a rule with Clock#Timer=<timer> will be triggered if written and turned on by the user.If Rules are not compiled, BLINK output using BlinkCount parameters. |
Sunrise~
In order to set a timer to use the automatically calculated sunrise or sunset time, the latitude and longitude of the location as decimal degrees needs to be entered using the respective commands.
By default, Tasmota calculates the times of the actual sunrise and sunset. Starting with version 12.1.1.5, it is possible instead to use the beginning and ending times of civil, nautical or astronomical twilight. In particular, civil twilight is the period of time when the sun is below the horizon, but artificial lighting is not yet needed.