@JGKK, that looks interesting. Thank you. Nice work!
@JGKK that does look good here's my simple one
Nice Thats actually the first approach i had for the subflow above but i didnât like the repeat inject every minute or 30 seconds to check for the time. That why my scheduler subflow uses setTimeout() and actually calculates how long till the next time that the schedule should be executed and sets the timeout accordingly. It also cancels and reschedules if you change your schedule. The way I went its also guaranteed to execute on the minute which i wanted. And i wanted infinitely schedulable items.
Johannes
@iiLaw, thanks for sharing. I am going to have a play with it. The UI looks really neat!
I am wondering if on a "SAVE" event it could output the config for schedex timer. This would avoid the loop? I am quite new to node red so maybe I am talking rubbish...
Thanks again
Martyn
Quick question. The output that I am seeing is as follows:
"shd-1 enabled - scheduled today?: Yes - run state: null"
Not sure why I always get a run state of null?
Thanks
Martyn
Yes, I have also tried this and get the same result
Hi,
I have modified things a little and made it work directly with schedex. Here is the flow. It works on my setup. I'd be interested to see if anyone else can use it?
[{"id":"de76e056.a3ba7","type":"tab","label":"Scheduler","disabled":false,"info":""},{"id":"cb9fa2c4.12ef5","type":"ui_template","z":"de76e056.a3ba7","group":"e1673405.ab8328","name":"Schedule Item","order":1,"width":"5","height":"10","format":"<div style=\"margin:-5px 0 0 10px; padding:0;\">\n <table>\n <tr><td><input type=\"text\" id=\"shd-tag\" value=\"\" style=\"width: 170px;\"><label class=\"valLable\">Tag</label></td></tr>\n <tr><td><input type=\"time\" class=\"valHour\" id=\"shd-st\" value=\"\" ><label for=\"shd-st\" class=\"valLable\">Start time</label></td></tr>\n\t<tr><td><input type=\"text\" class=\"valMedium\" id=\"shd-st-v\" value=\"\"><label class=\"valLable\">Start Value</label></td></tr>\n\t<tr><td><input type=\"time\" class=\"valHour\" id=\"shd-et\" value=\"\"><label for=\"shd-et\" class=\"valLable\">End time</label></td></tr>\n\t<tr><td><input type=\"text\" class=\"valMedium\" id=\"shd-et-v\" value=\"\"><label class=\"valLable\">End Value</label>\n\t<br>\n\t</td></tr>\n <tr><td>\n <label class=\"yLable\">Day of the week</label><br><br>\n\t\t<input type=\"checkbox\" id=\"shd-dow-1\" class=\"dow\"><label for=\"shd-dow-1\">Mon</label>\t\n\t\t<input type=\"checkbox\" id=\"shd-dow-2\" class=\"dow\"><label for=\"shd-dow-2\" style=\"padding-right:14px !important; margin-left:0px !important;\">Tue</label>\n\t\t<input type=\"checkbox\" id=\"shd-dow-3\" class=\"dow\"><label for=\"shd-dow-3\">Wed</label>\n\t\t<input type=\"checkbox\" id=\"shd-dow-4\" class=\"dow\"><label for=\"shd-dow-4\">Thrs</label>\n\t\t<br><br>\n\t</td></tr>\n\t<tr><td>\n\t\t<input type=\"checkbox\" id=\"shd-dow-5\" class=\"dow\"><label for=\"shd-dow-5\" style=\"padding-right:23px !important;\">Fri</label>\n\t\t<input type=\"checkbox\" id=\"shd-dow-6\" class=\"dow\"><label for=\"shd-dow-6\" style=\"padding-right:17px !important; margin-left:0px !important;\">Sat</label>\n\t <input type=\"checkbox\" id=\"shd-dow-0\" class=\"dow\"><label for=\"shd-dow-0\" style=\"padding-right:14px !important; margin-left:0px !important;\">Sun</label>\n <br>\n </td></tr>\n\t<tr><td>\n\t <br><input type=\"date\" id=\"shd-StartDate\" style=\"width: 145px\" value=\"\"><label class=\"valLable\" >Start</label>\n\t <input type=\"date\" id=\"shd-EndDate\" style=\"width: 145px\" value=\"\"><label class=\"valLable\" >End</label>\n\t <br>\n </td></tr>\n </table>\n <table style=\"margin-top: 10px;\">\n\t<tr>\n\t <td>\n\t <input type=\"checkbox\" id=\"shd-disabled\" class=\"dis\" style=\"width: 110px;\"><label for=\"shd-disabled\">Disable</label>\n </td>\n <td>\n\t <button class=\"md-raised nr-dashboard-form-button md-button md-ink-ripple\" style=\"margin:0 0 0 -1px; width: 73px;\" ng-click=\"send(save())\">SET</button>\n </td></tr>\n\t</table>\n\t<textarea id=\"shdMsg\" rows=\"3\" cols=\"28\" style=\"margin-top: 10px !important; padding: 5px; border:0; background: #24323B; color: #CBC5C5; font-size: 0.8em;\"></textarea>\n\t<input type=\"hidden\" id=\"shd-id\" value=\"\">\n\t<div ng-init=\"init()\" style=\"display: none;\"></div>\n</div>\n<script>\nvar onInit = false; // catch unwanted msg when flow is deployed\n\n(function(scope) {\n\n scope.init = function () {\n console.log('oninit');\n // not used stub\n };\n \n scope.$watch('msg', function(msg) {\n if (msg) {\n console.log('pl:'+msg.payload+' msgtype: '+msg.msgType);\n if(\tmsg.msgType === 'Schedule' && onInit === false){\n\n $('#shd-tag').val(msg.payload.tag);\n $('#shd-st').val(msg.payload.ontime);\n \t $('#shd-st-v').val(msg.payload.onpayload);\n $('#shd-et').val(msg.payload.offtime);\n $('#shd-et-v').val(msg.payload.offpayload);\n \n for (dow = 0; dow < 7; dow++) {\n \t\t\tvar dowUI = '#shd-dow-'+dow;\n \t\t\tif (msg.payload.dofWeek[dow]==1){\n \t\t\t\t$(dowUI).prop( \"checked\", true );\n \t\t\t} else {\n \t\t\t\t$(dowUI).prop( \"checked\", false );\n \t\t\t}\n }\n \n $('#shd-StartDate').val(msg.payload.StartDate);\n $('#shd-st').css({\"background-color\": \"#FFFFFF\"});\n $('#shd-et').css({\"background-color\": \"#FFFFFF\"});\n if(msg.payload.shedState === 1 || msg.payload.shedState === 2){$('#shd-st').css({\"background-color\": \"#E7E7E7\"});}\n $('#shd-EndDate').val(msg.payload.EndDate);\n if(msg.payload.shedState === 2){$('#shd-et').css({\"background-color\": \"#E7E7E7\"});}\n \n if(msg.payload.disabled === true){\n \t $('#shd-disabled').prop( \"checked\", true);\n } else {\n $('#shd-disabled').prop( \"checked\", false); \n }\n \n $('#shd-id').val(msg.payload.id);\n \n } else if (onInit === true){onInit = false;}\n }\n });\n \n this.scope.save = function(){\n var days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];\n var obj = {id:null, tag: null, ontime: null, onpayload: null, offtime: null, offpayload: null, dofWeek: [], StartDate: null, EndDate: null, suspended: null, mon: null, tue: null, wed: null, thu: null, fri: null, sat: null, sun: null};\n// var obj = {id:null, tag: null, ontime: null, onpayload: null, offtime: null, offpayload: null, dofWeek: [], StartDate: null, EndDate: null, suspended: null};\n obj.id = $('#shd-id').val();\n obj.tag = $('#shd-tag').val();\n obj.ontime = $('#shd-st').val();\n\tobj.onpayload = $('#shd-st-v').val();\n obj.offtime = $('#shd-et').val();\n obj.offpayload = $('#shd-et-v').val();\n \n for (dow = 0; dow< 7; dow++) {\n\t\tvar dowUI = '#shd-dow-'+dow;\n\t\tif($(dowUI).prop( \"checked\")){\n\t\t obj[days[dow]] = true ;\n\t\t\tobj.dofWeek[dow] = 1 ;\n\t\t} else {\n\t\t obj[days[dow]] = false ;\n\t\t\tobj.dofWeek[dow] = 0 ;\n\t\t}\n\t}\n\t\n obj.StartDate = $('#shd-StartDate').val();\n obj.EndDate = $('#shd-EndDate').val();\n \n if($('#shd-disabled').prop( \"checked\")){\n\t\tobj.suspended = true ;\n\t} else {\n\t\tobj.suspended = false ;\n\t}\n console.log(\"pl:\"+obj.tag);\n return msg = {payload: obj};\n }\n})(scope);\n</script>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":true,"templateScope":"local","x":600,"y":220,"wires":[["c19183de.4c4a7","56b1f062.5d438"]],"info":"Dsiplays a shedule item config"},{"id":"ba847b8a.b36ff8","type":"schedex","z":"de76e056.a3ba7","name":"Timer01","passthroughunhandled":true,"suspended":false,"lat":"","lon":"","ontime":"","ontopic":"","onpayload":"1","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"0","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":980,"y":60,"wires":[["95c7578.5bca7a8"]]},{"id":"e84aa579.a671a8","type":"function","z":"de76e056.a3ba7","name":"get item","func":"var shed = flow.get('schedule','file');\n//var shedState = flow.get('scheduledState','file');\nvar idx = msg.payload.split('-');\nmsg.topic = msg.payload;\n//msg.payload = JSON.stringify(shed[msg.payload]);\nmsg.payload = shed[msg.payload];\nmsg.msgType = 'Schedule';\n//msg.payload.shedState = shedState[parseInt(idx[1],10)];\nreturn msg;","outputs":1,"noerr":0,"x":440,"y":220,"wires":[["cb9fa2c4.12ef5"]],"icon":"font-awesome/fa-database","info":"This node get the config of selected shedule item.\nNode input comes from selected shedule item ui template.\nOutput is passed to shedule item template."},{"id":"c19183de.4c4a7","type":"function","z":"de76e056.a3ba7","name":"update","func":"var _keyNo = parseInt(msg.payload.id,'10');\nvar no = _keyNo+1;\nvar _key = \"shd-\"+no ;\nvar shd = flow.get('schedule','file');\nshd[_key].tag = msg.payload.tag;\nshd[_key].ontime = msg.payload.ontime;\nshd[_key].onpayload = msg.payload.onpayload;\nshd[_key].offtime = msg.payload.offtime;\nshd[_key].offpayload = msg.payload.offpayload;\nshd[_key].dofWeek = msg.payload.dofWeek;\nshd[_key].StartDate = msg.payload.StartDate;\nshd[_key].EndDate = msg.payload.EndDate;\nshd[_key].suspended = msg.payload.suspended;\nflow.set('schedule',shd,'file');\nreturn msg;","outputs":1,"noerr":0,"x":770,"y":220,"wires":[[]],"icon":"font-awesome/fa-database","info":"persists changes to a shedule item."},{"id":"d1a1b290.3b781","type":"function","z":"de76e056.a3ba7","name":"Schedule","func":"var shedDIDs = {\n\"shd-1\": {\n \"id\": 0,\n \"tag\": \"Lights\",\n \"ontime\": \"19:00\",\n \"onpayload\": \"1\",\n \"offtime\": \"22:30\",\n \"offpayload\": \"0\",\n \"dofWeek\": [\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1\n ],\n \"StartDate\": null,\n \"EndDate\": null,\n \"suspended\": false\n }, \n\"shd-2\": {\n \"id\": 1, \n \"tag\": \"\",\n \"ontime\": null,\n \"onpayload\": null,\n \"offtime\": null,\n \"offpayload\": null,\n \"dofWeek\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"StartDate\": null,\n \"EndDate\": null,\n \"suspended\": true\n },\n\"shd-3\": {\n \"id\": 2, \n \"tag\": \"\",\n \"ontime\": \"\",\n \"onpayload\": null,\n \"offtime\": \"\",\n \"offpayload\": null,\n \"dofWeek\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"StartDate\": null,\n \"EndDate\": null,\n \"suspended\": true\n },\n\"shd-4\": {\n \"id\": 3, \n \"tag\": \"\",\n \"ontime\": null,\n \"onpayload\": null,\n \"offtime\": null,\n \"offpayload\": null,\n \"dofWeek\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"StartDate\": null,\n \"EndDate\": null,\n \"suspended\": true\n },\n\"shd-5\": {\n \"id\": 4, \n \"tag\": \"\",\n \"ontime\": null,\n \"onpayload\": null,\n \"offtime\": null,\n \"offpayload\": null,\n \"dofWeek\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"StartDate\": null,\n \"EndDate\": null,\n \"suspended\": true\n },\n\"shd-6\": {\n \"id\": 5, \n \"tag\": \"\",\n \"ontime\": null,\n \"onpayload\": null,\n \"offtime\": null,\n \"offpayload\": null,\n \"dofWeek\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"StartDate\": null,\n \"EndDate\": null,\n \"suspended\": true\n },\n\"shd-7\": {\n \"id\": 6, \n \"tag\": \"\",\n \"ontime\": null,\n \"onpayload\": null,\n \"offtime\": null,\n \"offpayload\": null,\n \"dofWeek\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"StartDate\": null,\n \"EndDate\": null,\n \"suspended\": true\n },\n\"shd-8\": {\n \"id\": 7, \n \"tag\": \"\",\n \"ontime\": null,\n \"onpayload\": null,\n \"offtime\": null,\n \"offpayload\": null,\n \"dofWeek\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"StartDate\": null,\n \"EndDate\": null,\n \"suspended\": true\n },\n\"shd-9\": {\n \"id\": 8, \n \"tag\": \"\",\n \"ontime\": null,\n \"onpayload\": null,\n \"offtime\": null,\n \"offpayload\": null,\n \"dofWeek\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"StartDate\": null,\n \"EndDate\": null,\n \"suspended\": true\n },\n\"shd-10\": {\n \"id\": 9, \n \"tag\": \"\",\n \"ontime\": null,\n \"onpayload\": null,\n \"offtime\": null,\n \"offpayload\": null,\n \"dofWeek\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"StartDate\": null,\n \"EndDate\": null,\n \"suspended\": true\n },\n\"shd-11\": {\n \"id\": 10, \n \"tag\": \"\",\n \"ontime\": null,\n \"onpayload\": null,\n \"offtime\": null,\n \"offpayload\": null,\n \"dofWeek\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"StartDate\": null,\n \"EndDate\": null,\n \"suspended\": true\n },\n\"shd-12\": {\n \"id\": 11, \n \"tag\": \"\",\n \"ontime\": null,\n \"onpayload\": null,\n \"offtime\": null,\n \"offpayload\": null,\n \"dofWeek\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ],\n \"StartDate\": null,\n \"EndDate\": null,\n \"suspended\": true\n }\n}\nflow.set('schedule',shedDIDs,'file');","outputs":1,"noerr":0,"x":260,"y":100,"wires":[[]],"icon":"font-awesome/fa-database","info":"shedule JSON"},{"id":"665f0a7a.0081e4","type":"inject","z":"de76e056.a3ba7","name":"create","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"0.0","x":110,"y":100,"wires":[["d1a1b290.3b781"]],"info":"Click this to create the schedule"},{"id":"a159bc2b.e7c6f","type":"inject","z":"de76e056.a3ba7","name":"","topic":"","payload":"shd-1","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":110,"y":220,"wires":[["bcab5774.3da1d8","6db354dc.df062c"]]},{"id":"95c7578.5bca7a8","type":"link out","z":"de76e056.a3ba7","name":"","links":["b112b041.1008b"],"x":1255,"y":60,"wires":[]},{"id":"bcab5774.3da1d8","type":"ui_template","z":"de76e056.a3ba7","group":"382c8b2c.300c74","name":"Select Schedule","order":1,"width":"5","height":4,"format":"<style>\ninput[type=checkbox].shed { display:none; }\ninput[type=checkbox].shed + label{width: 150px; min-width: 150px; border: 1px solid #486170; padding: 13px; margin:0 2px 0 0; border-radius:3px;}\ninput[type=checkbox].shed:checked + label{ background-color: #7A7A7A;}\n\ninput[type=checkbox].shedLR { display:none; }\ninput[type=checkbox].shedLR + label{width: 150px; min-width: 150px; border: 1px solid #486170; padding: 13px; margin:0 2px 0 0; border-radius:3px;}\ninput[type=checkbox].shedLR:checked + label{ background-color: #7A7A7A;}\n\n\ninput[type=checkbox].dow { display:none; }\ninput[type=checkbox].dow + label{ border: 1px solid #486170; padding: 9px; margin:0 0px 0 0; border-radius:3px;}\ninput[type=checkbox].dow:checked + label{ background-color:#7A7A7A; width: 150px;}\n\ninput[type=checkbox].dis { display:none; }\ninput[type=checkbox].dis + label{ border: 1px solid #486170; padding: 7px; margin:0 0 0 0; border-radius:3px;}\ninput[type=checkbox].dis:checked + label{border: 1px solid #FF7443; background-color:#FF7443; width: 150px;}\n\ninput[type=\"text\"]{padding: 3px 0 3px 4px; border: 1px solid #cccccc; margin: 5px 0 5px 0; border-radius:3px; color:#3C3C3C;}\ninput[type=\"text\"]:disabled { color: #486170;}\ninput[type=\"time\"]{padding: 0px 0 0px 4px; border: 1px solid #cccccc; font-size: 1.0em; border-radius:3px; color:#3C3C3C;}\ninput[type=\"time\"]:disabled { color: #486170;}\ninput[type=\"date\"]{padding: 0px 0 0px 4px; border: 1px solid #cccccc; font-size: 1.0em; border-radius:3px; color:#3C3C3C;}\ninput[type=\"date\"]:disabled { color: #486170;}\n\n.valMedium {width: 75px;}\n.valLable {padding-left: 15px; font-size: 0.8em;}\n.yLable {padding-left: 0px; font-size: 0.8em;}\n\n@media screen and (max-device-width:640px), screen and (max-width:640px) {\ninput[type=checkbox].shedLR { display:none; }\ninput[type=checkbox].shedLR + label{width: 155px; min-width: 155px; border: 1px solid #486170; padding: 13px 15px 13px 14px; margin:0 2px 0 0; border-radius:3px;}\ninput[type=checkbox].shedLR:checked + label{ background-color: #7A7A7A;;}\n}\n</style>\n<script>\n$(document).ready(function() {\n\t$(\"[evh=shedSel]\").bind( \"click\", function(event, ui) {\n\t\tvar sel = \"[evh=shedSel]\";\n\t\t$(sel).each(function () {\n \t\t$(sel).prop( \"checked\", false )\n\t });\n\t\t$(this ).prop( \"checked\", true ); \n });\n\n if($('#init').val() === 'yes'){\n $('#shd-1').prop( \"checked\", true );\n $('#init').val('no');\n }\n});\n</script>\n<div style=\"float:left; margin:18px 0 0 20px; height: 55px; 220px\">\n\t<input type=\"checkbox\" id=\"shd-1\" evh=\"shedSel\" ng-click=\"send(action($event))\" class=\"shed\">\n\t<label for=\"shd-1\" evh=\"shedSel\">01</label>\n\t<input type=\"checkbox\" id=\"shd-2\" evh=\"shedSel\" ng-click=\"send(action($event))\" class=\"shed\">\n <label for=\"shd-2\" evh=\"shedSel\">02</label>\n\t<input type=\"checkbox\" id=\"shd-3\" evh=\"shedSel\" ng-click=\"send(action($event))\" class=\"shed\">\n\t<label for=\"shd-3\">03</label>\t\n\t<input type=\"checkbox\" id=\"shd-4\" evh=\"shedSel\" ng-click=\"send(action($event))\" class=\"shed\">\n\t<label for=\"shd-4\">04</label>\n</div>\n<div style=\"float:left; margin:8px 0 0 20px; height: 55px; width: 220px\">\n\t<input type=\"checkbox\" id=\"shd-5\" evh=\"shedSel\" ng-click=\"send(action($event))\" class=\"shed\">\n\t<label for=\"shd-5\">05</label>\t\t\t\t\t\n\t<input type=\"checkbox\" id=\"shd-6\" evh=\"shedSel\" ng-click=\"send(action($event))\" class=\"shed\">\n\t<label for=\"shd-6\">06</label>\n\t<input type=\"checkbox\" id=\"shd-7\" evh=\"shedSel\" ng-click=\"send(action($event))\" class=\"shed\">\n\t<label for=\"shd-7\">07</label>\t\n\t<input type=\"checkbox\" id=\"shd-8\" evh=\"shedSel\" ng-click=\"send(action($event))\" class=\"shed\">\n\t<label for=\"shd-8\">08</label>\n</div>\t\n<div style=\"float:left; margin:8px 0 0 20px; height: 55px; width: 220px\">\n\t<input type=\"checkbox\" id=\"shd-9\" evh=\"shedSel\" ng-click=\"send(action($event))\" class=\"shed\">\n\t<label for=\"shd-9\">09</label>\t\t\t\t\t\n\t<input type=\"checkbox\" id=\"shd-10\" evh=\"shedSel\" ng-click=\"send(action($event))\" class=\"shedLR\">\n\t<label for=\"shd-10\" >10</label>\n\t<input type=\"checkbox\" id=\"shd-11\" evh=\"shedSel\" ng-click=\"send(action($event))\" class=\"shedLR\">\n\t<label for=\"shd-11\" >11</label>\t\n\t<input type=\"checkbox\" id=\"shd-12\" evh=\"shedSel\" ng-click=\"send(action($event))\" class=\"shedLR\">\n\t<label for=\"shd-12\">12</label>\n</div>\t\n<input type=\"hidden\" id=\"init\" value=\"yes\">\n<script>\n(function(scope) {\n\nthis.scope.action = function(event){\n //console.log('shedID: '+event.currentTarget.id);\n return msg = {payload: event.currentTarget.id};\n}\n})(scope);\n</script>\n\t","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":280,"y":220,"wires":[["e84aa579.a671a8"]],"info":"selects a shedule item No"},{"id":"7eb0e056.d66d1","type":"comment","z":"de76e056.a3ba7","name":"Create json structure - do once","info":"","x":170,"y":60,"wires":[]},{"id":"56b1f062.5d438","type":"switch","z":"de76e056.a3ba7","name":"","property":"payload.id","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"4","vt":"num"},{"t":"eq","v":"5","vt":"num"},{"t":"eq","v":"6","vt":"num"},{"t":"eq","v":"7","vt":"num"},{"t":"eq","v":"8","vt":"num"},{"t":"eq","v":"9","vt":"num"},{"t":"eq","v":"10","vt":"num"},{"t":"eq","v":"11","vt":"num"}],"checkall":"false","repair":false,"outputs":12,"x":770,"y":400,"wires":[["ba847b8a.b36ff8"],["407e2899.db9db8"],["6eac78e2.85c7c8"],["656666a2.028598"],["ed3f3019.3a5ed"],["20d07e86.be40e2"],["a59ab8d1.4586a8"],["f8175e32.1b57d"],["a6f9a489.61a838"],["47e73d86.138b74"],["8f00f70a.06d868"],["78bd86a5.2e4038"]]},{"id":"407e2899.db9db8","type":"schedex","z":"de76e056.a3ba7","name":"Timer02","passthroughunhandled":false,"suspended":false,"lat":"","lon":"","ontime":"","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":980,"y":120,"wires":[["589f2137.79094"]]},{"id":"656666a2.028598","type":"schedex","z":"de76e056.a3ba7","name":"Timer04","passthroughunhandled":false,"suspended":false,"lat":"","lon":"","ontime":"","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":980,"y":240,"wires":[["bd56690c.4c2ef8"]]},{"id":"6eac78e2.85c7c8","type":"schedex","z":"de76e056.a3ba7","name":"Timer03","passthroughunhandled":false,"suspended":false,"lat":"","lon":"","ontime":"","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":980,"y":180,"wires":[["59a17e38.7086e"]]},{"id":"8f00f70a.06d868","type":"schedex","z":"de76e056.a3ba7","name":"Timer11","passthroughunhandled":false,"suspended":false,"lat":"","lon":"","ontime":"","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":980,"y":660,"wires":[["45d758da.31ed68"]]},{"id":"ed3f3019.3a5ed","type":"schedex","z":"de76e056.a3ba7","name":"Timer05","passthroughunhandled":false,"suspended":false,"lat":"","lon":"","ontime":"","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":980,"y":300,"wires":[["667ca505.b1042c"]]},{"id":"20d07e86.be40e2","type":"schedex","z":"de76e056.a3ba7","name":"Timer06","passthroughunhandled":false,"suspended":false,"lat":"","lon":"","ontime":"","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":980,"y":360,"wires":[["9e13168a.d55af8"]]},{"id":"a59ab8d1.4586a8","type":"schedex","z":"de76e056.a3ba7","name":"Timer07","passthroughunhandled":false,"suspended":false,"lat":"","lon":"","ontime":"","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":980,"y":420,"wires":[["d7f7deb.13e562"]]},{"id":"47e73d86.138b74","type":"schedex","z":"de76e056.a3ba7","name":"Timer10","passthroughunhandled":false,"suspended":false,"lat":"","lon":"","ontime":"","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":980,"y":600,"wires":[["119e8f95.ea3eb"]]},{"id":"a6f9a489.61a838","type":"schedex","z":"de76e056.a3ba7","name":"Timer09","passthroughunhandled":false,"suspended":false,"lat":"","lon":"","ontime":"","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":980,"y":540,"wires":[["e276b1ad.56602"]]},{"id":"f8175e32.1b57d","type":"schedex","z":"de76e056.a3ba7","name":"Timer08","passthroughunhandled":false,"suspended":false,"lat":"","lon":"","ontime":"","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":980,"y":480,"wires":[["3995bd56.b9a942"]]},{"id":"78bd86a5.2e4038","type":"schedex","z":"de76e056.a3ba7","name":"Timer12","passthroughunhandled":false,"suspended":false,"lat":"","lon":"","ontime":"","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":980,"y":720,"wires":[["9a6adbcf.04cd28"]]},{"id":"c6e014bf.1c97d8","type":"comment","z":"de76e056.a3ba7","name":"Build UI and setup timers","info":"","x":150,"y":180,"wires":[]},{"id":"6db354dc.df062c","type":"function","z":"de76e056.a3ba7","name":"get all items","func":"var shed = flow.get('schedule','file');\nmsg.payload = shed;\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":400,"wires":[["76a4472.6143ab8"]],"icon":"font-awesome/fa-database"},{"id":"76a4472.6143ab8","type":"split","z":"de76e056.a3ba7","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":530,"y":400,"wires":[["56b1f062.5d438"]]},{"id":"5bd36f34.054b5","type":"comment","z":"de76e056.a3ba7","name":"Restore timer values on reload","info":"","x":390,"y":360,"wires":[]},{"id":"d917b7fd.f1fc78","type":"comment","z":"de76e056.a3ba7","name":"Get an item and modify/save","info":"","x":500,"y":180,"wires":[]},{"id":"589f2137.79094","type":"link out","z":"de76e056.a3ba7","name":"","links":[],"x":1255,"y":120,"wires":[]},{"id":"59a17e38.7086e","type":"link out","z":"de76e056.a3ba7","name":"","links":[],"x":1255,"y":180,"wires":[]},{"id":"bd56690c.4c2ef8","type":"link out","z":"de76e056.a3ba7","name":"","links":[],"x":1255,"y":240,"wires":[]},{"id":"667ca505.b1042c","type":"link out","z":"de76e056.a3ba7","name":"","links":[],"x":1255,"y":300,"wires":[]},{"id":"9e13168a.d55af8","type":"link out","z":"de76e056.a3ba7","name":"","links":[],"x":1255,"y":360,"wires":[]},{"id":"d7f7deb.13e562","type":"link out","z":"de76e056.a3ba7","name":"","links":[],"x":1255,"y":420,"wires":[]},{"id":"3995bd56.b9a942","type":"link out","z":"de76e056.a3ba7","name":"","links":[],"x":1255,"y":480,"wires":[]},{"id":"e276b1ad.56602","type":"link out","z":"de76e056.a3ba7","name":"","links":[],"x":1255,"y":540,"wires":[]},{"id":"119e8f95.ea3eb","type":"link out","z":"de76e056.a3ba7","name":"","links":[],"x":1255,"y":600,"wires":[]},{"id":"45d758da.31ed68","type":"link out","z":"de76e056.a3ba7","name":"","links":[],"x":1255,"y":660,"wires":[]},{"id":"9a6adbcf.04cd28","type":"link out","z":"de76e056.a3ba7","name":"","links":[],"x":1255,"y":720,"wires":[]},{"id":"e1673405.ab8328","type":"ui_group","z":"","name":"Schedule Item","tab":"51c606d2.dfb618","order":2,"disp":true,"width":"6","collapse":false},{"id":"382c8b2c.300c74","type":"ui_group","z":"","name":"Select Schedule Item","tab":"51c606d2.dfb618","order":1,"disp":true,"width":"6","collapse":false},{"id":"51c606d2.dfb618","type":"ui_tab","z":"","name":"Scheduler","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
@martynwheeler output 2 is for info on run state. null means the item hasn't been scheduled.
From memory run states are: null (never run) 1 start has run, 2 end has run
They key thing is to ensure that schedule doesn't run more than once say after a NR re-boot.
The other is to ensure End only runs if Start has been run. Hope that makes sense.
The scheduled item details will appear on output 1
Had a look it was in hurry had some stuff for day light saving so would never of worked, so apologies. Have made a update on output 2 hopefully a bit more informative.
Flow update on Git hub
Hello @drmibell, I just would like to ask you. I am using your UI Schedex timer, however not long time ago the timers from dashboard are not visible (it is not possible to edit them in UI). Have you ever been facing to similar issue as well? It come on my mind that regular node red was secured (you need to log in) but others functionality in UI are visible and working.
@Snapicek, welcome to the forum.
I will look into this issue as soon as I can. When you say "not long time ago the timers from dashboard are not visible," do you mean that the flow worked at one time and then stopped? If so, what has changed in the meanwhile? In any case, please identify the versions numbers of Node-RED, the dashboard, and schedex
you are using. I have not used this interface in quite some time, and all of those modules have been updated since then. Thanks.
Thank you for your time. Yes, it is still working (the timers react as were set). But in UI I can see the sheet schedex. But there are clear parameters and it is not possible to choose any of timers (as there is none visible). There were not anything big, just adding delay flow. Version of Node_red 1.1.3, schedex - 1.10.2, ui 2.23.2. Also if you have any other solution which could be working as well as yours (I tried also others, but there were problem with reboot for example) please let me know.
@Snapicek, I have not been able to reproduce your issue. I updated all my software and installed a fresh copy of my flow from post #15. The dashboard and timer selection drop-down look like this:
I can think of a few reasons why the timer selection might fail, so it would help if you could add some debug
nodes to the Programming tab and confirm that it is correctly loading the flows file and extracting the schedex
node names. If that much is working, we can troubleshoot further.
Hello JGKK,
Good day to you,
First of all thanks for your scheduler dashboard. I want to use it on my project. But I don't understand properly how to use it? If you have any demonstration please sent me to my better understanding. It will be helpful to me.
Actually, I want to control my chiller machine. It has two modes. One is manual and another one has scheduled mode.
Hello,
What is the problem you are encountering? Did you import the example flow in the post I linked?
There are descriptions of how the subflows work on the linked subflow pages in that thread.
Johannes
Hello
your scheduler is great.
I tried to teach him sunset and sunrise, but it didn't work for me.
Has anyone else made a similar attempt?
My Christmas lights do not need to burn all night.
I can't find a way how to enter either the time or sunset, sunrise
I apologize, but I saw a post that said something about setting storage in the config files. I cannot find it again and this is not working for me, not saving schedule settings.
can you help?
Did you check out the ui time scheduler?
It is an excellent dashboard scheduler.
Sorry that is very old as others have posted best look at some maintained schedulers