Hourly, Daily and Monthly Payload

I realise this thread has a solution but as an alternative, no code solution, this is my contribution.

Screenshot...

The flow...

[{"id":"941d531a.9ebc3","type":"cronplus","z":"a39bd3b0.60173","name":"","outputField":"payload","timeZone":"","options":[{"topic":"Every1m","payload":"true","type":"bool","expression":"0 * * * * *"},{"topic":"EveryHour","payload":"true","type":"bool","expression":"0 0 * * * *"},{"topic":"Midnight","payload":"true","type":"bool","expression":"0 0 0 * * *"}],"x":80,"y":120,"wires":[["11814df4.399852"]]},{"id":"11814df4.399852","type":"debug","z":"a39bd3b0.60173","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":230,"y":120,"wires":[]}]

Disclaimer: I am the author of node-red-contrib-cron-plus

node-red-contrib-cron-plus - A flexible scheduler node for Node-RED (incl dynamic control and Timezone support)

FEATURES

  • Schedule by CRON, date and date sequences
    • Human readable descriptions of your CRON expression are provided as you type.
  • Send timestamp, string, number, boolean, flow variable, global variable, JSON, Buffer or Env variable as the output.
  • Settable output variable (normally msg.payload but it is up to you)
  • Multiple schedules can be entered by the UI
  • Additional info about the triggered scedule is always send in msg.cronplus
  • Ability to add, remove, list, stop, start, pause schedules by a payload input permitting full flexability & dynamic control
  • Full demo flow provided in node-red editors menu > import > examples.
  • Optional timezone setting suppoting UTC and Region/Area (e.g. Europe/London)

Info for anyone not familiar with CRON...

CRON Format...

    s  m  h  md m  wd y
    |  |  |  |  |  |  |
    *  *  *  *  *  *  *    Field              Allowed values    Special symbols
    |  |  |  |  |  |  |    -----------------  ---------------   ---------------
    `--|--|--|--|--|--|->  Second (optional)  0-59              * / , -
       `--|--|--|--|--|->  Minute             0-59              * / , -
          `--|--|--|--|->  Hour               0-23              * / , -
             `--|--|--|->  Day of Month       1-31              * / , - L W
                `--|--|->  Month              1-12 or JAN-DEC   * / , -
                   `--|->  Day of Week        0-7 or SUN-SAT    * / , - L #
                      `->  Year (optional)    1970-2099         * / , -

Examples...

  • * * * * * * Every Second
  • 0 * * * * * Every minute
  • 0 */10 * * * * Every 10 minutes
  • 0 */20 1 * * * Every 20 minutes, between 01:00 AM and 01:59 AM
  • 0 15,30,45 * * * * At 15, 30, and 45 minutes past the hour
  • 0 0 12 * * * Every day at noon - 12pm
  • 0 0 2 29 FEB * 2020-2040 At 02:00 AM, on day 29 of the month, only in February, every 4 years, 2020 through 2040
  • 0 0 7 * * MON#1 * At 07:00 AM, on the first Monday of the month
  • 0 0 12 * JAN,FEB,MAR,APR * Every day at noon in January, February, March and April
  • * * 1W * * Every minute, on the first weekday of the month
  • * * * * Tue#3 Every minute, on the third Tuesday of the month
  • 0 12 * * MONL At 12:00 PM, on the last Monday of the month

All of this info is present in the nodes built in help on the info panel.

6 Likes