# Help with cronplus node

**URL:** <https://discourse.nodered.org/t/help-with-cronplus-node/100534>\
**Category:** General\
**Created:** [10 March 2026 20:22 UTC](https://discourse.nodered.org/t/help-with-cronplus-node/100534 "2026-03-10T20:22:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [10 March 2026 20:22 UTC](https://discourse.nodered.org/t/help-with-cronplus-node/100534/1 "2026-03-10T20:22:31Z")

</div>

I'm wanting to add schedules via injections and need to specify more than what I have so far.

As is this is an exert from what the flow is:

```auto
[
    {
        "id": "c54780ea787c649c",
        "type": "link out",
        "z": "26262ba1.62dcbc",
        "name": "Start",
        "mode": "link",
        "links": [
            "acc270c1bcd7d96c",
            "6a1a5b0be6b0ddb0"
        ],
        "x": 655,
        "y": 6820,
        "wires": []
    },
    {
        "id": "86d37c82b96d5dbd",
        "type": "change",
        "z": "26262ba1.62dcbc",
        "name": "SET/Start",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "add",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "[{\"command\":\"add\",\"name\":\"Charging when away\",\"expression\":\"0 0 10 * * Wed\",\"payloadType\":\"default\",\"payload\":\"\",\"type\":\"str\"}]",
                "tot": "json"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 520,
        "y": 6820,
        "wires": [
            [
                "c54780ea787c649c"
            ]
        ]
    },
    {
        "id": "6a1a5b0be6b0ddb0",
        "type": "link in",
        "z": "26262ba1.62dcbc",
        "name": "Schedule input",
        "links": [
            "c54780ea787c649c",
            "87b618aa689ab36c"
        ],
        "x": 655,
        "y": 6890,
        "wires": [
            [
                "30db0e7b74e0fa99"
            ]
        ]
    },
    {
        "id": "30db0e7b74e0fa99",
        "type": "cronplus",
        "z": "26262ba1.62dcbc",
        "name": "Away Charger control",
        "outputField": "payload",
        "timeZone": "",
        "storeName": "",
        "commandResponseMsgOutput": "output2",
        "defaultLocation": "",
        "defaultLocationType": "default",
        "outputs": 2,
        "options": [],
        "x": 830,
        "y": 6890,
        "wires": [
            [
                "5b96290ecb9a7a02"
            ],
            [
                "e5eeee3e0ca6ba2b"
            ]
        ]
    }
]

```

The _important part_ is this in the `change` node:  
`[{"command":"add","name":"Charging when away","expression":"0 0 10 * * Wed","payloadType":"default","payload":"","type":"str"}]`

I am needing to add more to the output.

I need a `topic` set too.

_Indulge the village idiot_ and help me with how to set a topic.

This is just the first step of a somewhat complicated flow I'm making.

I won't dump it all on you here, as I think this is all that is needed.

Oh, for now it is set to daily - testing.  
But I will need it to trigger weekly rather than daily.  
Doesn't matter what day/time.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![kitori](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kitori](https://discourse.nodered.org/u/kitori)\
**Post date:** [11 March 2026 08:34 UTC](https://discourse.nodered.org/t/help-with-cronplus-node/100534/2 "2026-03-11T08:34:57Z")

</div>

adding this to the change node json ...

```auto
[
    {
        "command": "add",
        "name": "Charging when away",
        "expression": "*/10 * * * * Wed",
        "payloadType": "default",
        "payload": "",
        "type": "str",
        "topic": "I_am_the_topic"
    }
]

```

.. result in sending this output:

```auto
{
	"topic": "I_am_the_topic",
	"scheduledEvent": true,
	"payload": {
		"triggerTimestamp": 1773217940000,
		"status": {
			"type": "dynamic",
			"modified": false,
			"isRunning": true,
			"count": 30,
			"limit": 0,
			"nextDescription": "in 9 seconds",
			"nextDate": "2026-03-11T08:32:30.000Z",
			"nextDateTZ": "11. März 2026, 09:32:30 MEZ",
			"timeZone": "Europe/Berlin",
			"serverTime": "2026-03-11T08:32:20.002Z",
			"serverTimeZone": "Europe/Berlin",
			"description": "Every 10 seconds, only on Wednesday"
		},
		"config": {
			"topic": "I_am_the_topic",
			"name": "Charging when away",
			"index": 0,
			"payloadType": "default",
			"payload": "",
			"limit": null,
			"expressionType": "cron",
			"expression": "*/10 * * * * Wed"
		}
	},
	"_msgid": "eafd5acccea54c0b"
}

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [11 March 2026 09:06 UTC](https://discourse.nodered.org/t/help-with-cronplus-node/100534/3 "2026-03-11T09:06:59Z")

</div>

> [@Trying\_to\_learn](#):
>
> I am needing to add more to the output.

From the built in help

> Adding a CRON expression
> 
> - Multiple schedules can be added if the payload is an array of objects
> - command: (string|required) The operation to perform - in this case "add"
> - name: (string|required) This will identify schedule
> - topic: (string|required) This will be used as the topic when the schedule triggers
> - expression: (string|required) A CRON expression, a date, a comma separated list of dates or an array of dates
> - expressionType: (string|optional) specify the schedule type. (if omitted, "cron" is the default)
> - payloadType: (string|optional) The payload type (e.g. 'default', 'flow', 'global', 'str', 'num', 'bool', 'json', 'bin', 'date' or 'env')
> - payload: (any|optional) What to send when schedule triggers
> - limit: (number|optional) Maximum number of times the schedule should trigger

Set `payloadType` to "json" and set `payload` to an object `{ }` and you will _"add more to the output"_ when it fires

e.g.

```auto
[ 
  {
    "command":"add",
    "name":"Charging when away",
    "expression":"0 0 10 * * Wed",
    "payloadType":"json",
    "topic": "The topic to send in the msg",
    "payload": {
      "info": "I am the payload that will be sent in the msg",
      "a_number": 123,
      "a_string": "hello",
      "a_nested_object": {
        "a_boolean": true
      }
    }
  }
]

```

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [11 March 2026 18:46 UTC](https://discourse.nodered.org/t/help-with-cronplus-node/100534/4 "2026-03-11T18:46:15Z")

</div>

Thanks both.

This code is to control a TASMOTA device via MQTT.

I am sending many schedules (`5`) from different `function` nodes.

(Excuse the digression)  
_ORIGINALLY_ I had `5` `cronplus`nodes and the block of code was fairly complicated.

As I am learning more and more I am rationalising the code/flow/nodes to ge better use.

The output is then sent to another `function` node that _tweaks_ things then sends the message into a `trigger` node.  
That then sends a _Pulse_ output that goes into a `switch` node that sorts the message on the `topic` and then to the `MQTT OUT`` node. I now think that the `switch` node isn't needed.

So there are up to `5` schedules which could be running.

As each is started the posted code is run to start the respective schedule.  
Obviously certain things are changed. 😉

Then when device is `offline` the schedule is removed.  
(That was fun getting that bit working)

I'd post the code but I think that is not really needed - only to show he _bigger picture_ and how I've optimised it.

It seems to be working now.  
Again: Thanks.

Ah, just for the fun of it, here is a picture of that part of the code:  
And yeah, there is a bit of `old code` in there.  
This code is on my testing machine.

 ![Screenshot from 2026-03-12 05-49-50](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/7/675528fc1a2a3ebd1be62ca15f00a9948a2f8fbe.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [25 March 2026 18:46 UTC](https://discourse.nodered.org/t/help-with-cronplus-node/100534/5 "2026-03-25T18:46:38Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
