Skip to main content

schedule

Advanced cron-based scheduling with timezone support for complex timing requirements.

schedule
input v1.0.0

Advanced scheduler with 6-field cron expressions, timezone support, and active time windows. Perfect for complex scheduling requirements.

cron timer schedule timezone
Inputs
0
Outputs
1

Overview

The schedule node provides advanced scheduling capabilities beyond what the basic inject node offers. Key features include:

  • 6-field cron expressions - Including seconds for precise timing
  • Timezone support - Schedule in any timezone worldwide
  • Active time windows - Only trigger between specific hours
  • Day filtering - Restrict to specific days of the week
  • Human-readable preview - See when the next trigger will occur

Use this node when you need precise control over when your flows execute, especially for business hours, international time zones, or second-precision timing.

Properties

Property Type Required Default Description
name string - - Display name for this node in the editor.
cron string - Cron expression defining the schedule (6 fields: second minute hour day month weekday).
timezone string - UTC Timezone for the schedule (e.g., "America/New_York", "Europe/London", "Asia/Tehran").
payload any - timestamp The payload to send when the schedule triggers.
payloadType string - date Type of payload: date, str, num, bool, json, flow, global.
topic string - - The msg.topic value to set on outgoing messages.
startTime string - - Time after which the schedule becomes active (HH:MM format).
endTime string - - Time after which the schedule becomes inactive (HH:MM format).
activeDays array - [0,1,2,3,4,5,6] Days of the week when the schedule is active (0=Sunday, 6=Saturday).

Cron Syntax

The schedule node uses a 6-field cron expression (including seconds):

Cron Expression Format

┌────────────── second (0-59)
│ ┌──────────── minute (0-59)
│ │ ┌────────── hour (0-23)
│ │ │ ┌──────── day of month (1-31)
│ │ │ │ ┌────── month (1-12)
│ │ │ │ │ ┌──── day of week (0-7, 0 or 7 is Sunday)
│ │ │ │ │ │
* * * * * *

Common Patterns

Expression Description
0 * * * * * Every minute (at second 0)
0 0 * * * * Every hour (at minute 0)
0 0 9 * * * Every day at 9:00 AM
0 0 9 * * 1-5 Weekdays at 9:00 AM
0 */15 * * * * Every 15 minutes
0 0 0 1 * * First day of every month at midnight
30 0 9 * * * Every day at 9:00:30 AM
Tip

Use tools like crontab.guru to build and validate your cron expressions. Note that EdgeFlow uses 6 fields (with seconds), while most online tools use 5 fields.

Timezone Support

The schedule node supports all IANA timezone identifiers. This is crucial for IoT deployments that need to respect local time regardless of server location.

Common Timezones

America/New_York
America/Los_Angeles
Europe/London
Europe/Berlin
Asia/Tehran
Asia/Tokyo
Asia/Dubai
Australia/Sydney
UTC

Outputs

When the schedule triggers, it sends a message with the configured payload:

Output Message Format

{`{
  "payload": ,
  "topic": "",
  "scheduledTime": "2024-01-15T09:00:00.000Z",
  "timezone": "America/New_York",
  "_msgid": ""
}`}

The scheduledTime property contains the exact time the trigger was scheduled for (useful for debugging timing issues).

Examples

Hourly Report Generation

Generate a report at the top of every hour during business hours.

Hourly Business Report

Triggers every hour from 9 AM to 5 PM, Monday through Friday.

View Flow JSON
[
  {
    "id": "schedule1",
    "type": "schedule",
    "name": "Business Hours",
    "cron": "0 0 9-17 * * 1-5",
    "timezone": "America/New_York",
    "payload": "generate_report",
    "payloadType": "str",
    "wires": [["function1"]]
  },
  {
    "id": "function1",
    "type": "function",
    "name": "Build Report",
    "func": "msg.payload = {\n  type: 'hourly',\n  timestamp: new Date().toISOString()\n};\nreturn msg;"
  }
]

Workday Morning Notification

Send a Telegram notification every workday morning at 8:30 AM local time.

Morning Briefing

Daily notification at 8:30 AM on weekdays in Tehran timezone.

View Flow JSON
[
  {
    "id": "schedule2",
    "type": "schedule",
    "name": "Morning Alert",
    "cron": "0 30 8 * * 0-4",
    "timezone": "Asia/Tehran",
    "payload": "Good morning! Here's your daily briefing.",
    "payloadType": "str",
    "topic": "briefing",
    "wires": [["telegram1"]]
  },
  {
    "id": "telegram1",
    "type": "telegram",
    "name": "Send Alert",
    "chatId": "123456789"
  }
]

Active Time Window

Poll sensors every 5 minutes, but only during daylight hours (6 AM to 8 PM).

Daylight Sensor Polling

Every 5 minutes between 6 AM and 8 PM.

View Flow JSON
[
  {
    "id": "schedule3",
    "type": "schedule",
    "name": "Daylight Poll",
    "cron": "0 */5 * * * *",
    "timezone": "UTC",
    "startTime": "06:00",
    "endTime": "20:00",
    "payload": "poll",
    "payloadType": "str",
    "wires": [["sensor1"]]
  },
  {
    "id": "sensor1",
    "type": "bh1750",
    "name": "Light Sensor"
  }
]

Troubleshooting

Schedule triggers at wrong time

Check the following:

  1. Verify the timezone is set correctly (not defaulting to UTC)
  2. Ensure your server's system clock is accurate
  3. Remember that cron uses 24-hour format (9 PM = 21)
  4. Check if DST (Daylight Saving Time) affects your timezone
Schedule doesn't trigger at all
  1. Make sure the flow is deployed
  2. Verify the cron expression is valid (use an online validator)
  3. Check if startTime/endTime are blocking the trigger
  4. Ensure activeDays includes the current day
  5. Look for errors in the EdgeFlow log
Invalid timezone error

Use IANA timezone identifiers (e.g., "America/New_York"), not abbreviations like "EST" or "PST". You can find the full list at Wikipedia's TZ database.

Seconds field not working

Make sure you're using a 6-field cron expression. If you copied a 5-field expression from another source, add 0 at the beginning for the seconds field.

5-field: * * * * * (minute hour day month weekday)

6-field: 0 * * * * * (second minute hour day month weekday)