Skip to content

Time Unit Entities

Feature Since Version Notes
Basic Units (SECONDS, MINUTES, HOURS, DAYS) >v1.4.1 Basic time units for ON EVERY
Extended Units (WEEKS, MONTHS, YEARS) >v1.4.1 Extended time units for ON EVERY

These entities represent units of time and are used exclusively with the ON EVERY functional keyword to define time-based triggers for ACTION definitions.

Usage

Used to specify the frequency of a time-based trigger.

Syntax

ON EVERY <number> <timeUnit> DO
  • <number>: A positive integer specifying the interval count.
  • <timeUnit>: One of the time unit entities listed below.

Available Time Units (All since >v1.4.1)

  • SECOND / SECONDS
  • MINUTE / MINUTES
  • HOUR / HOURS
  • DAY / DAYS
  • WEEK / WEEKS
  • MONTH / MONTHS
  • YEAR / YEARS

Note: Both singular and plural forms are accepted (e.g., 1 SECOND is equivalent to 1 SECONDS).

Examples

1. Trigger every 30 seconds:

DEFINE ACTION FrequentUpdate
ON EVERY 30 SECONDS DO
    PUBLISH TOPIC "system/heartbeat" WITH "pulse"

2. Trigger every 5 minutes:

DEFINE ACTION CheckDeviceStatus
ON EVERY 5 MINUTES DO
    // ... statements to check status ...

3. Trigger once a day:

DEFINE ACTION DailyReport
ON EVERY 1 DAY DO
    PUBLISH TOPIC "reports/daily/generate" WITH "trigger"

4. Trigger every week:

DEFINE ACTION WeeklyMaintenance
ON EVERY 1 WEEK DO
    PUBLISH TOPIC "maintenance/schedule" WITH "start"

Related Documentation