Difference between revisions of "Trigger: Regular Interval"

m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<pre style="background-color: #EEEEEE; color: Black; border-radius: 10px; padding: 10px;">
+
<pre class="header-style">This trigger will fire at a regular interval (e.g. every hour). You can specify a reference start time that the interval should be relative to. For instance if you want a regular interval to occur exactly on the hour, you should specify a reference start time on the hour.</pre>
The regular interval is used to make a macro trigger regularly after a fixed period of time. If you want the trigger to fire on a specific time boundary (such as on the hour) you should enable the option use a reference time.
 
  
It is necessary on many devices to use the alarm option if you require the trigger to fire exactly at the correct time. Without this option enabled many devices will prevent the device waking up at the exact desired time.
+
''' Options '''
</pre>
 
  
'''Example Usage'''<br/>
+
* '''Interval Time''' - The time period between each trigger fire, specified in hours, minutes, and seconds. Can also use a dictionary variable containing hours, minutes, and seconds keys.
 +
* '''Reference Start Time''' - An optional time of day that the interval should align to. When enabled, the trigger will fire at times that are synchronized to this reference. Can also use a dictionary variable containing hour and minute keys.
 +
* '''Ignore Reference Start Time''' - When enabled, the interval starts counting from when the macro was last saved rather than aligning to a specific time.
 +
* '''Use Alarm''' - When enabled, uses Android's alarm functionality to ensure precise timing. This is recommended for most devices to ensure the trigger fires at the correct time, especially when the device is in deep sleep.
  
<pre style="background-color: #AC2424; color: white; border-radius: 10px; padding: 10px;">
+
''' Variable Support '''
Triggers
 
  
 +
The interval and reference start time can be set using dictionary variables:
 +
* '''Interval Variable''' - Dictionary with keys: hours, minutes, seconds
 +
* '''Reference Time Variable''' - Dictionary with keys: hour, minute
  
</pre><br>
+
When variables are used, the trigger will automatically reschedule if the variable values change.
<pre style="background-color: #1665B0; color: white; border-radius: 10px; padding: 10px;">
 
Actions
 
  
 +
''' Requirements '''
  
</pre><br>
+
* Schedule Exact Alarm permission (Android 12+)
<pre style="background-color: green; color: white; border-radius: 10px; padding: 10px;">
 
Constrains
 
  
 +
''' Examples '''
  
</pre><br>
+
'''Example 1: Hourly reminder'''
<pre style="background-color: teal; color: white; border-radius: 10px; padding: 10px;">
 
Local variables
 
  
 +
Send a notification every hour:
  
</pre><br>
+
  <pre class="trigger-style">Triggers
 +
 
 +
Regular Interval: 01:00:00</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Display Notification: "Hourly Reminder"</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
Time of Day: 9:00 AM - 6:00 PM</pre>
 +
 
 +
'''Example 2: Periodic data sync'''
 +
 
 +
Sync data every 30 minutes, aligned to the hour:
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Regular Interval: 00:30:00 (Reference Start Time: 00:00)</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
HTTP Request: POST to sync endpoint
 +
Set Variable: [last_sync] = [hour]:[minute]</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
WiFi Connected</pre>
 +
 
 +
''' Notes '''
 +
 
 +
* For intervals longer than 24 hours, the trigger will first align to the reference time before applying the full interval
 +
* The trigger persists its next scheduled time to a database, so it can continue from where it left off if the macro is temporarily disabled and re-enabled
 +
* It is recommended to enable the "Use Alarm" option if you require the trigger to fire exactly at the correct time, as many devices block precise wake-ups without it
 +
* When using variable-based intervals, changes to the variable will cause the trigger to reschedule automatically
 +
* Legacy macros that used minutes will be automatically converted to seconds internally
 +
 
 +
''' See Also '''
 +
 
 +
* [[Trigger: Day/Time Trigger|Day/Time Trigger]]
 +
* [[Trigger:_Stopwatch|Stopwatch]]
 +
* [[Action:_Wait_Before_Next_Action|Wait Before Next Action]]

Latest revision as of 21:36, 6 January 2026

This trigger will fire at a regular interval (e.g. every hour). You can specify a reference start time that the interval should be relative to. For instance if you want a regular interval to occur exactly on the hour, you should specify a reference start time on the hour.

Options

  • Interval Time - The time period between each trigger fire, specified in hours, minutes, and seconds. Can also use a dictionary variable containing hours, minutes, and seconds keys.
  • Reference Start Time - An optional time of day that the interval should align to. When enabled, the trigger will fire at times that are synchronized to this reference. Can also use a dictionary variable containing hour and minute keys.
  • Ignore Reference Start Time - When enabled, the interval starts counting from when the macro was last saved rather than aligning to a specific time.
  • Use Alarm - When enabled, uses Android's alarm functionality to ensure precise timing. This is recommended for most devices to ensure the trigger fires at the correct time, especially when the device is in deep sleep.

Variable Support

The interval and reference start time can be set using dictionary variables:

  • Interval Variable - Dictionary with keys: hours, minutes, seconds
  • Reference Time Variable - Dictionary with keys: hour, minute

When variables are used, the trigger will automatically reschedule if the variable values change.

Requirements

  • Schedule Exact Alarm permission (Android 12+)

Examples

Example 1: Hourly reminder

Send a notification every hour:

Triggers

Regular Interval: 01:00:00
Actions

Display Notification: "Hourly Reminder"
Constraints

Time of Day: 9:00 AM - 6:00 PM

Example 2: Periodic data sync

Sync data every 30 minutes, aligned to the hour:

Triggers

Regular Interval: 00:30:00 (Reference Start Time: 00:00)
Actions

HTTP Request: POST to sync endpoint
Set Variable: [last_sync] = [hour]:[minute]
Constraints

WiFi Connected

Notes

  • For intervals longer than 24 hours, the trigger will first align to the reference time before applying the full interval
  • The trigger persists its next scheduled time to a database, so it can continue from where it left off if the macro is temporarily disabled and re-enabled
  • It is recommended to enable the "Use Alarm" option if you require the trigger to fire exactly at the correct time, as many devices block precise wake-ups without it
  • When using variable-based intervals, changes to the variable will cause the trigger to reschedule automatically
  • Legacy macros that used minutes will be automatically converted to seconds internally

See Also