Cronplus timer and GPIO

A month ago about a month ago I started a led on/off project. At the end of this project I started another one that concerns a timer (cron-plus) that would guide the gpio but without success. I created my dashboard but I can't connect the gpio to the cron-plus. Someone could kindly show me clearly how to do it.
Below I attach my flow:

[{"id":"f25766af.0d8d98","type":"tab","label":"Flow 5","disabled":false,"info":""},{"id":"7691058b.7e33dc","type":"ui_text","z":"f25766af.0d8d98","group":"37cbcb69.afa304","order":1,"width":"16","height":"2","name":"CRON Description","label":"Expression Description (updates as you type)...","format":"{{msg.payload.result.description}}","layout":"col-center","x":826,"y":403,"wires":[]},{"id":"f629dc09.3a812","type":"comment","z":"f25766af.0d8d98","name":"Demonstrating fixes times as schedule","info":"","x":246,"y":63,"wires":[]},{"id":"971ad14.88f833","type":"cronplus","z":"f25766af.0d8d98","name":"Fixed dates and CRON","outputField":"payload","timeZone":"","options":[{"topic":"fixed dates","payload":"fixed","type":"str","expression":"1609459200000, 2021-12-31 00:00, 2022-12-31 08:00 GMT+8"},{"topic":"cron","payload":"lunch time","type":"str","expression":"0 0 12 * * * 2021-2061"}],"x":466,"y":183,"wires":[["51dab75d.b39918"]]},{"id":"51dab75d.b39918","type":"debug","z":"f25766af.0d8d98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":666,"y":183,"wires":[]},{"id":"49a62e22.d08a2","type":"inject","z":"f25766af.0d8d98","name":"Get status-all","topic":"","payload":"{     \"command\": \"status-all\" }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":186,"y":183,"wires":[["971ad14.88f833","eeae2556.f8cdf8"]]},{"id":"d601259d.256068","type":"inject","z":"f25766af.0d8d98","name":"Add a 2 fixed time entries, 30 sec and 1 min from now","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":316,"y":103,"wires":[["833c1e39.b378a"]]},{"id":"833c1e39.b378a","type":"function","z":"f25766af.0d8d98","name":"create payload to add 2 dates","func":"let nowPlus30s = (new Date()).addSeconds(30);\nlet nowPlus1min = (new Date()).addSeconds(60);\nmsg.payload = {\n    \"command\":\"add\",\n    \"name\":\"dynamic date sequence\",\n    \"expression\" : [nowPlus30s, nowPlus1min],\n    \"payload\":\"dynamic\",\n    \"type\":\"str\"\n}\nreturn msg;","outputs":1,"noerr":0,"x":326,"y":143,"wires":[["971ad14.88f833"]]},{"id":"1d39fe90.eca511","type":"cronplus","z":"f25766af.0d8d98","name":"","outputField":"payload","timeZone":"","options":[],"x":536,"y":403,"wires":[["7691058b.7e33dc"]]},{"id":"c0b50ebd.a08d1","type":"function","z":"f25766af.0d8d98","name":"describe cmd","func":"msg.payload = {\n    \"command\": \"describe\",\n    \"expression\": msg.payload\n}\nreturn msg;","outputs":1,"noerr":0,"x":346,"y":403,"wires":[["1d39fe90.eca511"]]},{"id":"77ab8754.d68788","type":"change","z":"f25766af.0d8d98","name":"","rules":[{"t":"set","p":"ui_add_schedule_name","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":406,"y":283,"wires":[[]]},{"id":"c55844e4.c7d4e8","type":"change","z":"f25766af.0d8d98","name":"","rules":[{"t":"set","p":"ui_add_schedule_payload","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":416,"y":323,"wires":[[]]},{"id":"3aba363.acc78ca","type":"change","z":"f25766af.0d8d98","name":"","rules":[{"t":"set","p":"ui_add_schedule_expression","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":426,"y":363,"wires":[[]]},{"id":"ef0fa054.0939b","type":"change","z":"f25766af.0d8d98","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"payload.payload","pt":"msg","to":"ui_add_schedule_payload","tot":"flow"},{"t":"set","p":"payload.name","pt":"msg","to":"ui_add_schedule_name","tot":"flow"},{"t":"set","p":"payload.expression","pt":"msg","to":"ui_add_schedule_expression","tot":"flow"},{"t":"set","p":"payload.command","pt":"msg","to":"add","tot":"str"},{"t":"set","p":"payload.type","pt":"msg","to":"str","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":356,"y":483,"wires":[["c8ee4a48.cb8fd8","fc5e8cbc.c5e84"]]},{"id":"c8ee4a48.cb8fd8","type":"cronplus","z":"f25766af.0d8d98","name":"","outputField":"payload","timeZone":"","options":[],"x":696,"y":483,"wires":[["dfd76127.32c8e"]]},{"id":"84b05d47.1e98d","type":"ui_toast","z":"f25766af.0d8d98","position":"top right","displayTime":"3","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"","topic":"","name":"","x":646,"y":563,"wires":[]},{"id":"dfd76127.32c8e","type":"switch","z":"f25766af.0d8d98","name":"1=Cron Event   2=List Results ","property":"cronplus.triggerTimestamp","propertyType":"msg","rules":[{"t":"nnull"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":376,"y":583,"wires":[["84b05d47.1e98d"],["f5a719ce.686238"]]},{"id":"5e64b00a.a8df2","type":"catch","z":"f25766af.0d8d98","name":"","scope":null,"uncaught":false,"x":156,"y":703,"wires":[["fc5b4efb.d562e","1334afa7.4f55b"]]},{"id":"fc5b4efb.d562e","type":"ui_toast","z":"f25766af.0d8d98","position":"top right","displayTime":"3","highlight":"red","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"topic":"Error...","name":"","x":366,"y":703,"wires":[]},{"id":"fc5e8cbc.c5e84","type":"ui_button","z":"f25766af.0d8d98","name":"Refresh","group":"37cbcb69.afa304","order":6,"width":"1","height":"1","passthru":true,"label":"","tooltip":"Get status of jobs","color":"","bgcolor":"","icon":"fa-refresh","payload":"{\"command\":\"list-all\"}","payloadType":"json","topic":"","x":536,"y":503,"wires":[["c8ee4a48.cb8fd8"]]},{"id":"90b7b121.d42f","type":"ui_text_input","z":"f25766af.0d8d98","name":"","label":"Expression","tooltip":"CRON expression or date/csv list of dates","group":"37cbcb69.afa304","order":3,"width":"4","height":"1","passthru":true,"mode":"text","delay":"100","topic":"","x":166,"y":363,"wires":[["c0b50ebd.a08d1","3aba363.acc78ca"]]},{"id":"22875e9d.ba2342","type":"ui_text_input","z":"f25766af.0d8d98","name":"","label":"Name","tooltip":"Schedule Name","group":"37cbcb69.afa304","order":2,"width":"4","height":"1","passthru":true,"mode":"text","delay":"100","topic":"","x":146,"y":283,"wires":[["77ab8754.d68788"]]},{"id":"a02c5024.99a0c","type":"ui_button","z":"f25766af.0d8d98","name":"","group":"37cbcb69.afa304","order":5,"width":"3","height":"1","passthru":false,"label":"Add","tooltip":"Add or update named schedule","color":"","bgcolor":"","icon":"send","payload":"","payloadType":"str","topic":"","x":146,"y":483,"wires":[["ef0fa054.0939b"]]},{"id":"272a874b.dc6688","type":"ui_text_input","z":"f25766af.0d8d98","name":"","label":"Payload","tooltip":"Payload to send when schedule fires","group":"37cbcb69.afa304","order":4,"width":"4","height":"1","passthru":true,"mode":"text","delay":"100","topic":"","x":156,"y":323,"wires":[["c55844e4.c7d4e8"]]},{"id":"35a29366.126c6c","type":"ui_template","z":"f25766af.0d8d98","group":"37cbcb69.afa304","name":"","order":7,"width":"16","height":"5","format":"<style type=\"text/css\">\n.t1  {border-collapse:collapse;border-spacing:0;border-color:#ccc;}\n.t1 td{font-family:Arial, sans-serif;font-size:14px;padding:8px 3px;border-style:solid;border-width:0px;overflow:hidden;word-break:normal;border-top-width:1px;border-bottom-width:1px;border-color:#ccc;color:#333;background-color:#fff;}\n.t1 th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#f0f0f0;}\n.t1 .t1-36r9{background-color:#000000;color:#ffffff;text-align:left;vertical-align:top}\n.t1 .t1-x2zo{background-color:#c0c0c0;font-size:small;text-align:left;vertical-align:top}\n.t1 .t1-o73e{background-color:#c0c0c0;font-size:small;text-align:center;vertical-align:top}\n.t1 .t1-5qt9{font-size:small;text-align:left;vertical-align:top}\n.t1 .t1-5qta{font-size:small;text-align:center;vertical-align:middle}\n</style>\n<table class=\"t1\">\n  <tr>\n    <th class=\"t1-36r9\" colspan=\"9\">CRON Schedules</th>\n  </tr>\n  <tr>\n    <td class=\"t1-x2zo\">Name</td>\n    <td class=\"t1-x2zo\">Expression</td>\n    <td class=\"t1-x2zo\">Payload</td>\n    <td class=\"t1-x2zo\">Description</td>\n    <td class=\"t1-x2zo\">Next run</td>\n    <td class=\"t1-x2zo\">State</td>\n    <td class=\"t1-o73e\">Delete</td>\n    <td class=\"t1-o73e\">Pause</td>\n    <td class=\"t1-o73e\">Resume</td>\n  </tr>\n  <tr  ng-repeat=\"item in msg.payload\">\n    <td class=\"t1-5qt9\">{{item.config.name}}</td>\n    <td class=\"t1-5qt9\" style=\"white-space: nowrap\" nowrap>{{item.config.expression}}</td>\n    <td class=\"t1-5qt9\">{{item.config.payload}}</td>\n    <td class=\"t1-5qt9\">{{item.status.description}}</td>\n    <td class=\"t1-5qt9\">{{item.status.nextDescription}}</td>\n    <td class=\"t1-5qta\"><i class=\"fa fa-{{item.status.isRunning ? 'play' : 'pause'}}\"> </i></td>\n\n   <td class=\"t1-5qta\">\n       <md-button class=\"md-raised\"\n        ng-click=\"send([[{payload:{command:'remove', name: item.config.name}}, {payload:{command:'list-all'}}]]);\"> <i class=\"fa fa-trash\"> </i></md-button>\n   </td>\n   <td class=\"t1-5qta\">\n       <md-button class=\"button\" \n       ng-click=\"send([[{payload:{command:'pause', name: item.config.name}}, {payload:{command:'list-all'}}]]);\"> <i class=\"fa fa-pause\"> </i></md-button>\n   </td>\n   <td class=\"t1-5qta\">\n       <md-button class=\"button\" \n       ng-click=\"send([[{payload:{command:'start', name: item.config.name}}, {payload:{command:'list-all'}}]]);\"> <i class=\"fa fa-play\"> </i></md-button>\n   </td>\n\n  </tr>\n\n </tbody>\n</table>\n\n<!--<table id=\"table\" class=\"table table-striped table-responsive-md btn-table\" >-->\n<!--     <tr>-->\n<!--        <th>Name</th> -->\n<!--        <th>Expression</th> -->\n<!--        <th>Payload</th> -->\n<!--        <th>Description</th>-->\n<!--        <th>Next run</th>-->\n<!--        <th>State</th>-->\n<!--        <th>Delete</th>-->\n<!--        <th>Pause</th>-->\n<!--        <th>Resume</th>-->\n<!-- </tr>-->\n<!-- <tbody>-->\n<!-- <tr ng-repeat=\"item in msg.payload\">-->\n<!--   <td >{{item.config.name}}</td>-->\n<!--   <td style=\"white-space: nowrap\" nowrap>{{item.config.expression}}</td>-->\n<!--   <td >{{item.config.payload}}</td>-->\n<!--   <td >{{item.status.description}}</td>-->\n<!--   <td >{{item.status.nextDescription}}</td>-->\n<!--   <td >{{item.status.isRunning ? 'Running' : 'Paused'}}</td>-->\n<!--   <td>-->\n<!--       <md-button class=\"md-raised\"-->\n<!--        ng-click=\"send([[{payload:{command:'remove', name: item.config.name}}, {payload:{command:'list-all'}}]]);\"> <i class=\"fa fa-trash\"> </i></md-button>-->\n<!--   </td>-->\n<!--   <td>-->\n<!--       <md-button class=\"button\" -->\n<!--       ng-click=\"send([[{payload:{command:'pause', name: item.config.name}}, {payload:{command:'list-all'}}]]);\"> <i class=\"fa fa-pause\"> </i></md-button>-->\n<!--   </td>-->\n<!--   <td>-->\n<!--       <md-button class=\"button\" -->\n<!--       ng-click=\"send([[{payload:{command:'start', name: item.config.name}}, {payload:{command:'list-all'}}]]);\"> <i class=\"fa fa-play\"> </i></md-button>-->\n<!--   </td>-->\n<!-- </tr>-->\n<!-- </tbody>-->\n<!--</table>-->\n\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":796,"y":603,"wires":[["e1d6d80e.a86378"]]},{"id":"f5a719ce.686238","type":"function","z":"f25766af.0d8d98","name":"Make table data","func":"if(!msg.payload || !msg.payload.result || !msg.payload.result.length){\n    msg.payload = [];\n    return msg;\n}\n\nmsg.payload = msg.payload.result;\nreturn msg;","outputs":1,"noerr":0,"x":636,"y":603,"wires":[["35a29366.126c6c"]]},{"id":"1334afa7.4f55b","type":"debug","z":"f25766af.0d8d98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":326,"y":743,"wires":[]},{"id":"e1d6d80e.a86378","type":"link out","z":"f25766af.0d8d98","name":"","links":["e127a07b.a09f8"],"x":931,"y":603,"wires":[]},{"id":"3d31f5a0.6ac4fa","type":"ui_template","z":"f25766af.0d8d98","group":"37cbcb69.afa304","name":"CRON Info","order":8,"width":"16","height":"12","format":"<div>\n<pre>CRON Format...\n\n    s  m  h  md m  wd y\n    |  |  |  |  |  |  |\n    *  *  *  *  *  *  *    Field              Allowed values    Special symbols\n    |  |  |  |  |  |  |    -----------------  ---------------   ---------------\n    `--|--|--|--|--|--|->  Second (optional)  0-59              * / , -\n       `--|--|--|--|--|->  Minute             0-59              * / , -\n          `--|--|--|--|->  Hour               0-23              * / , -\n             `--|--|--|->  Day of Month       1-31              * / , - L W\n                `--|--|->  Month              1-12 or JAN-DEC   * / , -\n                   `--|->  Day of Week        0-7 or SUN-SAT    * / , - L #\n                      `->  Year (optional)    1970-2099         * / , -\n                \n</pre>    \n</div>\n\n<style type=\"text/css\">\n.t2  {border-collapse:collapse;border-spacing:0;border-color:#ccc;}\n.t2 td{font-family:Arial, sans-serif;font-size:14px;padding:2px 2px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;}\n.t2 th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#f0f0f0;}\n.t2 .t2-dg6o{background-color:#000000;color:#ffffff;text-align:left;vertical-align:top}\n.t2 .t2-6e8n{font-weight:bold;background-color:#c0c0c0;border-color:inherit;text-align:left;vertical-align:top}\n.t2 .t2-0pky{border-color:inherit;text-align:left;vertical-align:top}\n</style>\n<table class=\"t2\">\n  <tr>\n    <th class=\"t2-dg6o\" colspan=\"2\">Example CRON Expressions</th>\n  </tr>\n  <tr>\n    <td class=\"t2-6e8n\">Expression</td>\n    <td class=\"t2-6e8n\">Description</td>\n  </tr>\n  <tr>\n    <td class=\"t2-0pky\">* * * * * *</td>\n    <td class=\"t2-0pky\">Every Second</td>\n  </tr>\n  <tr>\n    <td class=\"t2-0pky\">0 * * * * *</td>\n    <td class=\"t2-0pky\">Every minute</td>\n  </tr>\n  <tr>\n    <td class=\"t2-0pky\">0 */10 * * * *</td>\n    <td class=\"t2-0pky\">Every 10 minutes</td>\n  </tr>\n  <tr>\n    <td class=\"t2-0pky\">0 */20 1 * * *</td>\n    <td class=\"t2-0pky\">Every 20 minutes, between 01:00 AM and 01:59 AM</td>\n  </tr>\n  <tr>\n    <td class=\"t2-0pky\">0 15,30,45 * * * *</td>\n    <td class=\"t2-0pky\">At 15, 30, and 45 minutes past the hour</td>\n  </tr>\n  <tr>\n    <td class=\"t2-0pky\">0 0 12 * * *</td>\n    <td class=\"t2-0pky\">Every day at noon - 12pm</td>\n  </tr>\n  <tr>\n    <td class=\"t2-0pky\">0 0 2 29 FEB * 2020-2040</td>\n    <td class=\"t2-0pky\">At 02:00 AM, on day 29 of the month, only in February, every 4 years, 2020 through 2040</td>\n  </tr>\n  <tr>\n    <td class=\"t2-0pky\">0 0 7 * *</td>\n    <td class=\"t2-0pky\">MON#1 * At 07:00 AM, on the first Monday of the month</td>\n  </tr>\n  <tr>\n    <td class=\"t2-0pky\">0 0 12 * JAN,FEB,MAR,APR *</td>\n    <td class=\"t2-0pky\">Every day at noon in January, February, March and April</td>\n  </tr>\n  <tr>\n    <td class=\"t2-0pky\">* * 1W * *</td>\n    <td class=\"t2-0pky\">Every minute, on the first weekday of the month</td>\n  </tr>\n  <tr>\n    <td class=\"t2-0pky\">* * * * Tue#3</td>\n    <td class=\"t2-0pky\">Every minute, on the third Tuesday of the month</td>\n  </tr>\n  <tr>\n    <td class=\"t2-0pky\">0 12 * * MONL</td>\n    <td class=\"t2-0pky\">At 12:00 PM, on the last Monday of the month</td>\n  </tr>\n</table>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":806,"y":663,"wires":[[]]},{"id":"e127a07b.a09f8","type":"link in","z":"f25766af.0d8d98","name":"","links":["e1d6d80e.a86378","dde0b2cf.76d48"],"x":491,"y":463,"wires":[["c8ee4a48.cb8fd8"]]},{"id":"e517da9b.d5f1c8","type":"inject","z":"f25766af.0d8d98","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":819.5,"y":157,"wires":[["eeae2556.f8cdf8"]]},{"id":"eeae2556.f8cdf8","type":"rpi-gpio out","z":"f25766af.0d8d98","name":"","pin":"40","set":"","level":"0","freq":"","out":"out","x":636.5,"y":266,"wires":[]},{"id":"37cbcb69.afa304","type":"ui_group","z":"","name":"Default","tab":"8420f543.424728","disp":false,"width":"16","collapse":false},{"id":"8420f543.424728","type":"ui_tab","z":"","name":"CRON","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

Is there a reason to start a new topic for this rather than continue in the old one where you already asked this very same question?

So you have inject working to fire gpio?

In simple terms ...

  • Set the cronplus payload output to exactly the same as your inject node
  • Remove the inject and replace with the Cron node.

Edited title to something more related to your topic.

As @afelix pointed out its a duplicate of the other thread. Discussion should be continued there...

Could Steve actually show me how to do it? Actually, I want to close this project, but I can't. Could you kindly solve my problem?I swear I'm going to disappear :gioia:

Hopefully not on the thread, please keep discussion to you original thread

I don't have a raspberry pi to hand so can't help.

All I can say is...

If you can make an inject operate GPIO you can enter the EXACT same payload (as the inject has) into the Cron item then link the output of the Cron node to the GPIO.

When the Cron entry fires - it's just like you pressed the inject. The same thing happens, a msg is sent containing a payload!

It really couldn't be any simpler. I honestly can't understand where your issue is?

Further more, if you add just one entry to the Cron node and deploy it, you get a trigger button just like the inject. So in essence, you said in the other thread you can get gpio to work via an inject node - this would be exactly the same.


Hi Steve, what did I do wrong?
@Steve-Mcl

What are you seeing in the debug node?
Is it what is needed to drive the pin?

1 Like

And why do you never answer the questions asked?

1 Like

What do you mean "what is needed to drive a pin"? I didn't set it, I just placed it.

In the original thread (I'm looking for help with my project) you said that you were already successfully driving the LED. I presumed that the LED is connected to the pin you are trying to drive here. In that flow you must have sent messages to the gpio node to switch it on and off. You need to generate similar messages from the timer node to drive the pin. I expect it is just a matter of putting 1 or 0 in msg.payload.

Oh, I get it. Thank you so much for your help