Hllo i'm using inject node to send data every 10 minutes for my chart but i'd prefered to add a cron to send data at specific minutes like 00,10,20,30,40,50 but i don't know hoxw to set it.
Can you help me.
Thanks
Use the node-red-contrib-cron-plus node
Configure it to
From the inject help notes
Note: The "Interval between times" and "at a specific time" options use the standard cron system. This means that 20 minutes will be at the next hour, 20 minutes past and 40 minutes past - not in 20 minutes time.
So if you select Interval Between Times and set times to between 00:00 and 00:00 and interval every 10min it should inject on hour and every 10 mins.
thanks a lot thanks also to UnborN . i was too slowly for test your help
i would try your soluce but it doesn t work. i don't know what to insert for payload outpout. if i just set like you payload doesn't arrived but cron is working
You can select any of the options to determine what Cron+ will output when it triggers.
But in the first instance, try setting the payload to string
It will then output a payload string of "Go"
OR
set the payload to 'Timestamp', which will output a timestamp (similar to the inject node)
Thanks for answering.
i tried all ou told to me .
with string i only have the payload (name) that i said.
with time stamp i only have time stamp
without cron plus
withcronplus
From what is see from your bottom screenshot ... the problem is that you have wired the Cron plus node after your http request node. Usually Cron plus is used at the beginning of a flow to trigger the execution of a flow (In your case to the left of the http request node )
Ofcourse you can trigger flows with the node-red Inject node .. the difference is that Cron plus has more advanced scheduling capabilities (if you need them)
yes but i can change inject node by cron plus but will i can set 1 second cron for one and 10 minute for other one ?
No, Cron+ will send both the 1 second cron AND the 10 minute cron.
There would be no need to use an inject node.
So can i set it ?
Set what exactly?
The inject node and Cron node can both be configured to send a message at a regular interval.
The payload will be whatever you configure the node to send. If you want a different payload each time, you'll need to add a Function node with some logic to set the payload to whatever value you want.
set cron plus to inject to 1second complete msg.payload and also each 10 minutes to inject some msg.payload
what you mean with complete msg.payload ? .. as mentioned the msg when Cron or Inject nodes execute can be configured by you to whatever you want (depending of what you want to send to the next node).
Here is an example with Cron plus .. that you can have two schedules from the same node ..
schedule1 is configured every second
schedule2 is configured every 10 minutes
i have changed the payload for both, from the default, to something custom
and can also changed Cron outputs to Fan out .. so each schedule will output separately
Demo Flow:
[{"id":"7c73ecd0459ce0ac","type":"cronplus","z":"54efb553244c241f","name":"","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"fanOut","outputs":4,"options":[{"name":"schedule1","topic":"everySecond","payloadType":"json","payload":"{\"payload\":\"This is a payload every 1 second\",\"color\":\"blue\",\"age\":12}","expressionType":"cron","expression":"* * * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"name":"schedule2","topic":"every10Min","payloadType":"json","payload":"{\"payload\":\"This is a payload every 10 minutes\",\"color\":\"red\",\"age\":33}","expressionType":"cron","expression":"0 0/10 * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":420,"y":2520,"wires":[["157eecc61d0ec722"],["ab3fc018775141c5"],[],[]]},{"id":"157eecc61d0ec722","type":"debug","z":"54efb553244c241f","name":"schedule1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":2460,"wires":[]},{"id":"ab3fc018775141c5","type":"debug","z":"54efb553244c241f","name":"schedule2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":2500,"wires":[]}]
I m sorry but i have no success
i set this in the json
{"payload":"payload.data.conditions[0].temp"} look the debug.
Why do you have a wire connected to Cron plus ? what is the purpose of that ?
Cron node should be at the start of your flow line (to trigger the next node based on its set schedules)
Cron-plus Nodes to get data for chart Chart node
You havent explained much of your flow but i can see from that image that you have it wired to an http-request. Is that http-request node a GET or a POST request ?
If its a GET then the msg.payload
of the Cron node doesnt really matter .. it could be anything .. just a msg to trigger the actual request.
If its a POST then msg.payload
does matter and it will be the body for the request. In that case you have to configure it to be whatever the request body needs to be.
Topic closed to try and keep conversation in just one topic.