Skip to content

Time Actions

  • AT EVERY <time_interval>: Triggers at consistent intervals.
  • AT TIME <HH:MM>: Triggers once a day at a specified time.
  • AFTER <time_duration> DO <action>: Initiates an action after a specified duration.

Example

Example 1: Execute an action every minute.

AT EVERY 1 MINUTE
    PUBLISH /heartbeat WITH "alive"

Explanation
  1. Publish Heartbeat A message "alive" is published to the /heartbeat MQTT topic every 1 minute.

    AT EVERY 1 MINUTE
        PUBLISH /heartbeat WITH "alive"
    

    This could be used, for example, to let other systems know that this device is still online and operational.

Example 2: Execute an action at a specific time.

AT TIME 14:00
    PUBLISH /reminder WITH "It's 2 PM!"

Explanation
  1. Publish Reminder A message "It's 2 PM!" is published to the /reminder MQTT topic at 14:00.

    AT TIME 14:00
        PUBLISH /reminder WITH "It's 2 PM!"
    

    This could be used, for example, to send a reminder to other systems or devices at a specific time of the day.

FAQ

Can I schedule multiple actions at the same time?

Yes, you can schedule multiple actions to execute at the same time or at different times using the AT TIME and AT EVERY commands.

Is it possible to cancel a scheduled action?

Currently, Flux does not provide a command to cancel scheduled actions. Once an action is scheduled, it will execute at the specified time.

Can I schedule an action to execute only once?

Yes, you can use the AT TIME command to schedule an action to execute only once at a specified time.

What is the time format used for scheduling actions?

The time format used for scheduling actions is HH:MM:SS.