Looking for a GUI to define Input for Schedex

Hi Guys,

sry for my bad english, hopefully it is good enough.

I'm new to Raspberry PI and Node-Red also. My plan is to build a schedule food automation for my animals for days where i have to go to work - mostly for 3 days a week.

I spend a lot of time to look for ideas with the keywords "sprinkling", "schedule" and "time picker".

My plan is to use "schedex" to define up to 4 Starting points each day (hour:minute). Also to define the runtime in seconds. Also to activate this scheduling plan for the 7 days a week. Example for feeding:

Monday: 0, Tuesday: 1, Wednesday 1, Thursday 1, Friday 0, Saturday 0, Sunday 0
08:00 - for 200 seconds
11:00 - for 60 seconds
16:00 - for 60 seconds
20:00 - for 200 seconds

My personal problem: I cant find any GUI like this to feed the input of my "schedex".

Any Idea's? Thanks for spend your time!

Hi @Cowboy, welcome to the forum.

I will try to reply to you by first asking a question :smile:

Do you think you really need a GUI in order to make it work? If yes, what capability would you expect from the GUI ?

I consider the Schedex one of the best timer nodes (at the time of this writing) as it can be programmed by incoming messages. Therefore you can use inject nodes to program and activate the timer. Your GUI would be in this case the own Node-RED editor. You would have something like this:

PS: feeding the pets for only 60 seconds ? Let me guess aquarium fishes ?

1 Like

Hi @Andrei, thanks for your reply!

My pets are a special kind of pigeons. The amount of food depends on several factors: number of pigeons, number and age of the boys, weather. So i often have to change the Timer and the depending runtime.

Normaly i drive to my business place Tuesday morning and return on Thursday evening. So, typically, i use the "Automation" on Tuesday, Wednesday and Thursday. But in some weeks, these days are different. Also, it is possible, that i can feed manually on Tuesday morning or on Thursday evening. Sometimes I can work in my homeoffice the hole week...

So, my idea is, to have a generell switch in a GUI to choose "Feeding:" - "Auto" or "Manuell". Also to choose how often a day to feed (minimum once a day, maximum 4 times). And for the situation, that i leave my home on Tuesday later in the morning, to deactivate the first feeding job on tuesday for Once, because I want to feed manually.

The schedulded feeding is not the best choice. So i plan to take a picture from my pigeons loft 5 minutes after feeding and transfer it via telegram to my smartphone. Then I have to interpret the situation and sometimes I have to use my GUI to feed more for X Seconds.

My personal problem is, that I look always for a good quality in the frontend for the user - in this case - i am the user.

2 Likes

Nice use case. Looks like it can be achieved by using the standard dashboard nodes from Node-RED.

Do you consider also using telegram to perform some kind of feeding control or it would be used only for the visual monitoring you mentioned?

Wow, now that is an interesting use-case :slight_smile:

Discussion on the best approaches to scheduling with Node-RED come up fairly regularly and I think that the only thing we've ever been able to agree on is that there isn't a single approach that works for all.

Indeed, this came up again recently and I started to share some information about a possible comprehensive approach with Andrei but I don't think even that would be of that much help in this instance. Though it would have allowed you to build a custom interface for overrides. However, the approach I was looking at is very complex and needs a lot more thought.

It sounds to me as though you would be better off with a web page that displays the schedule for the day - I'd start with a standard base schedule, just one since you adjust it so much anyway - with an on/off override button. Then the 4 lines, each with it's own on/off setting, start time and duration.

On update, that could send the updated info back to Node-RED which would work out the output for schedex, bigtimer or whatever works.

So actually, thinking it through as a user journey lets us break the problem down into its key parts which is basically a web UI for output & input, a process to build a schedule and a node to enact that schedule.

It will probably not surprise you to hear me say that node-red-contrib-uibuilder would be ideal for building the web UI as long as you are OK with some simple web coding. Doubtless it is also possible to do with Dashboard as well. Though unless you need Dashboard for other things or are really not happy about doing any web coding, I think it would just be getting in the way.

You could also replace the web UI with a Telegram bot which means that you don't need to expose an interface to the Internet. However, such a bot would be fiddly to construct - though really it is just a different set of UI disciplines.

The good news is that, having broken down the process, you can see that the processing part would be similar no matter what the front end is.

Not sure if that monologue helps you at all but it was an interesting thought experiment if nothing else.

1 Like

The «Light Scheduler» node has a Nice GUI when configuring it: https://flows.nodered.org/node/node-red-contrib-light-scheduler

It hasn’t been updated for a while and don’t have any “advanced” features, but it may fit if it’s a GUI for you alone when you are configuring it you need.

1 Like

@Cowboy, are you still looking for a gui to program schedex nodes? I am testing a flow that uses the NR dashboard to do this and would be happy to upload it after stepping on a few more bugs.

@drmibell
I am also looking for a schedules which i can confugure from the node-RED UI (gui) and not from the node-RED editor screen.
Have you made any progress with your schedules GUI?
Regards, Bert

Hi @Bert, thanks for your interest. I stopped working on that project some time ago, when there didn't seem to be any interest on this forum and I had decided not to use it in my own systems. Since then, the schedex node has seen several upgrades that ought to make the job easier, so I will take a look at my old work and see what I can do. I cannot promise anything polished (or very soon), but I will post again as soon as I know where things stand.

I have a flow I wrote to control sprinkler timers with a full GUI. It's not elegant or well written but I would be willing to share. One small problem is when I went to upload I get a message that states the limit is 32000 characters and I'm north of 150,000. Otherwise I'd be glad to share.

Update: My GUI uses three timers not four and it is based on cron-plus. Otherwise.......

One other question, what kind of birds? I have blue bars and white rollers.

This is my ui for a simple scheduler I wrote.
Two part dashboard templates 1 is the selector 1 to 12
The other show details as it used NR Dashboard work on any device
Happy to share if of any use

2 Likes

If you have a look through the forum, you will see some work a few of us did on a schedule UI for CRON Plus - but that was based on uibuilder rather than Dashboard.

This flow provides a dashboard UI for programming schedex nodes. The project turned out to be a bit more challenging than I expected, and the result has some kludgy bits and probably bugs. (You've been warned.)

[{"id":"2f7c2f6d.c20a68","type":"tab","label":"Programming","disabled":false,"info":""},{"id":"b888aaf7.fdcdb8","type":"tab","label":"Timers","disabled":false,"info":"For testing, the timers should be configured as:\n- Timer1: `{\nontime: \"07:00\"\nontopic: \"timer1on\"\nonpayload: \"on\"\n onoffset: \"200\"\n onrandomoffset: true\n offtime: \"08:00\"\n offtopic: \"timer1off\"\n offpayload: \"off\"\n offoffset: 0\n offrandomoffset: false\n mon: true\n tue: true\n wed: true\n thu: true\n fri: true\n sat: true\n sun: true\n lon: \"-1.4\"\n lat: \"51.025\"\n suspended: false\n name: \"timer1\"\n}`\n- Timer2: `{\nontime: \"09:00\"\nontopic: \"timer2on\"\nonpayload: \"1\"\nonoffset: 0\nonrandomoffset: false\nofftime: \"10:00\"\nofftopic: \"timer2off\"\noffpayload: \"0\"\noffoffset: \"100\"\noffrandomoffset: true\nmon: false\ntue: false\nwed: false\nthu: false\nfri: false\nsat: true\nsun: true\nlon: \"\"\nlat: \"\"\nsuspended: false\nname: \"timer2\"\n}`\n- Timer3: `{\nontime: \"11:00\"\nontopic: \"timer3on\"\nonpayload: \"true\"\nonoffset: 0\nonrandomoffset: false\nofftime: \"12:00\"\nofftopic: \"timer3off\"\noffpayload: \"false\"\noffoffset: 0\noffrandomoffset: false\nmon: true\ntue: true\nwed: true\nthu: true\nfri: true\nsat: false\nsun: false\nlon: \"-1.4\"\nlat: \"51.025\"\nsuspended: false\nname: \"timer3\"\n}`\n- Timer4: `{\nontime: \"13:00\"\nontopic: \"timer4on\"\nonpayload: \"on\"\nonoffset: \"10\"\nonrandomoffset: true\nofftime: \"14:00\"\nofftopic: \"timer4off\"\noffpayload: \"off\"\noffoffset: \"20\"\noffrandomoffset: true\nmon: true\ntue: false\nwed: true\nthu: false\nfri: true\nsat: false\nsun: false\nlon: \"-1.4\"\nlat: \"51.025\"\nsuspended: true\nname: \"timer4\"\n}`\n"},{"id":"1070b5a9.049e52","type":"tab","label":"Dashboard","disabled":false,"info":""},{"id":"67db763a.31161","type":"ui_base","theme":{"name":"theme-dark","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#097479","value":"#097479","edited":false},"page-titlebar-backgroundColor":{"value":"#097479","edited":false},"page-backgroundColor":{"value":"#111111","edited":false},"page-sidebar-backgroundColor":{"value":"#000000","edited":false},"group-textColor":{"value":"#0eb8c0","edited":false},"group-borderColor":{"value":"#555555","edited":false},"group-backgroundColor":{"value":"#333333","edited":false},"widget-textColor":{"value":"#eeeeee","edited":false},"widget-backgroundColor":{"value":"#097479","edited":false},"widget-borderColor":{"value":"#333333","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"36c9c21a.96173e","type":"ui_group","z":"","name":"Timer Program","tab":"73d76463.0a02dc","order":1,"disp":true,"width":8,"collapse":false},{"id":"74f33e54.c2d83","type":"ui_spacer","name":"spacer","group":"70335fb2.428898","order":4,"width":3,"height":1},{"id":"73d76463.0a02dc","type":"ui_tab","z":"","name":"schedex node programming","icon":"dashboard","disabled":false,"hidden":false},{"id":"dd827103.f06e2","type":"ui_spacer","name":"spacer","group":"36c9c21a.96173e","order":3,"width":1,"height":1},{"id":"8efd2d7.c73075","type":"ui_spacer","name":"spacer","group":"36c9c21a.96173e","order":19,"width":1,"height":1},{"id":"cc4da946.96b3f8","type":"ui_spacer","name":"spacer","group":"36c9c21a.96173e","order":7,"width":1,"height":1},{"id":"d00d3eab.92f5b8","type":"ui_spacer","name":"spacer","group":"36c9c21a.96173e","order":11,"width":1,"height":1},{"id":"b5501232.2fff9","type":"schedex","z":"b888aaf7.fdcdb8","name":"timer1","suspended":false,"lat":"51.025","lon":"-1.4","ontime":"07:00","ontopic":"timer1on","onpayload":"on","onoffset":"200","onrandomoffset":true,"offtime":"08:00","offtopic":"timer1off","offpayload":"off","offoffset":0,"offrandomoffset":false,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":510,"y":100,"wires":[[]]},{"id":"7ffaec7f.b94304","type":"schedex","z":"b888aaf7.fdcdb8","name":"timer2","suspended":false,"lat":"","lon":"","ontime":"09:00","ontopic":"timer2on","onpayload":"1","onoffset":0,"onrandomoffset":false,"offtime":"10:00","offtopic":"timer2off","offpayload":"0","offoffset":"100","offrandomoffset":true,"mon":false,"tue":false,"wed":false,"thu":false,"fri":false,"sat":true,"sun":true,"x":510,"y":160,"wires":[[]]},{"id":"bfc793b2.ca5ac","type":"schedex","z":"b888aaf7.fdcdb8","name":"timer3","suspended":false,"lat":"51.025","lon":"-1.4","ontime":"11:00","ontopic":"timer3on","onpayload":"true","onoffset":0,"onrandomoffset":false,"offtime":"12:00","offtopic":"timer3off","offpayload":"false","offoffset":0,"offrandomoffset":false,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":false,"sun":false,"x":510,"y":220,"wires":[[]]},{"id":"5b6e102f.6fe1","type":"schedex","z":"b888aaf7.fdcdb8","name":"timer4","suspended":true,"lat":"51.025","lon":"-1.4","ontime":"13:00","ontopic":"timer4on","onpayload":"on","onoffset":"10","onrandomoffset":true,"offtime":"14:00","offtopic":"timer4off","offpayload":"off","offoffset":"20","offrandomoffset":true,"mon":true,"tue":false,"wed":true,"thu":false,"fri":true,"sat":false,"sun":false,"x":510,"y":280,"wires":[["43374b26.800b8c"]]},{"id":"6da5cb4b.a8d624","type":"inject","z":"2f7c2f6d.c20a68","name":"startup","topic":"startup","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"0","x":280,"y":80,"wires":[["3fd2fdab.c9316a"]]},{"id":"3fd2fdab.c9316a","type":"http request","z":"2f7c2f6d.c20a68","name":"GET flows","method":"GET","ret":"obj","paytoqs":false,"url":"http://localhost:1880/flows","tls":"","persist":false,"proxy":"","authType":"basic","x":450,"y":100,"wires":[["69061920.be04e"]],"info":"Get list (array) of all tabs and nodes.\n"},{"id":"31f9e070.867d48","type":"ui_button","z":"2f7c2f6d.c20a68","name":"","group":"36c9c21a.96173e","order":25,"width":2,"height":1,"passthru":true,"label":"enter","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":290,"y":340,"wires":[["eff8af.4fbda75"]]},{"id":"e628595a.519808","type":"ui_button","z":"2f7c2f6d.c20a68","name":"","group":"36c9c21a.96173e","order":26,"width":3,"height":1,"passthru":true,"label":"cancel","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":290,"y":300,"wires":[["829ffd9d.34944"]]},{"id":"fcd4dc4f.39cf7","type":"link out","z":"2f7c2f6d.c20a68","name":"dashboard","links":["3483a1c7.e219be","3ec86e62.f2149a","ba57316.2a653d","c361c25b.5ffb4","e548d302.4e9298","50f68ec5.b21388","ee76c4f1.c1a97","2ce14e8.d6aad32","a1cfd4ee.fdd4e"],"x":650,"y":240,"wires":[],"l":true},{"id":"823a00d6.767448","type":"ui_button","z":"2f7c2f6d.c20a68","name":"","group":"36c9c21a.96173e","order":24,"width":3,"height":1,"passthru":true,"label":"reset","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"reset","x":290,"y":120,"wires":[["3fd2fdab.c9316a"]]},{"id":"2f6357db.bcb44","type":"inject","z":"2f7c2f6d.c20a68","name":"cancel","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":300,"wires":[["e628595a.519808"]]},{"id":"ba040dde.294888","type":"inject","z":"2f7c2f6d.c20a68","name":"enter","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":340,"wires":[["31f9e070.867d48"]]},{"id":"75acb159.4d8a4","type":"inject","z":"2f7c2f6d.c20a68","name":"reset","topic":"reset","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":120,"wires":[["823a00d6.767448"]]},{"id":"25522a14.5997a6","type":"function","z":"2f7c2f6d.c20a68","name":"reset","func":"const i = global.get('selection');\nmsg.select = true;\nmsg.topic = global.get('timers')[i];\nvar nodes = msg.payload.filter(findNodes); // array of schedex nodes\nnodes.sort(function(a,b){return a.name > b.name}); // sort by name\n// no cleanup this time\nvar program = global.get('program'); // reset program\nprogram[i] = nodes[i];\nglobal.set('program',program);\nmsg.payload = program[i];\nreturn msg;\n\nfunction findNodes(x){\n    return x.type === \"schedex\"\n}\n","outputs":1,"noerr":0,"x":330,"y":240,"wires":[["fcd4dc4f.39cf7","b92536a0.404088"]]},{"id":"92907703.dd218","type":"switch","z":"b888aaf7.fdcdb8","name":"timer1","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"timer1","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":60,"wires":[["b5501232.2fff9"]]},{"id":"c7125ca4.33c6e","type":"link in","z":"b888aaf7.fdcdb8","name":"","links":["b92536a0.404088"],"x":275,"y":60,"wires":[["92907703.dd218"]]},{"id":"b92536a0.404088","type":"link out","z":"2f7c2f6d.c20a68","name":"timers","links":["1fca179d.ff2eb8","5f95bbab.f701f4","b9feae4f.515388","c7125ca4.33c6e","dd004900.275c08","33d1654c.49ef1a"],"x":630,"y":280,"wires":[],"l":true},{"id":"fdfbd4ad.2b802","type":"switch","z":"b888aaf7.fdcdb8","name":"timer2","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"timer2","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":120,"wires":[["7ffaec7f.b94304"]]},{"id":"dd004900.275c08","type":"link in","z":"b888aaf7.fdcdb8","name":"","links":["b92536a0.404088"],"x":275,"y":120,"wires":[["fdfbd4ad.2b802"]]},{"id":"37a90171.0b70fe","type":"switch","z":"b888aaf7.fdcdb8","name":"timer3","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"timer3","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":180,"wires":[["bfc793b2.ca5ac"]]},{"id":"1fca179d.ff2eb8","type":"link in","z":"b888aaf7.fdcdb8","name":"","links":["b92536a0.404088"],"x":275,"y":180,"wires":[["37a90171.0b70fe"]]},{"id":"56397dd.8133704","type":"switch","z":"b888aaf7.fdcdb8","name":"timer4","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"timer4","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":240,"wires":[["5b6e102f.6fe1"]]},{"id":"5f95bbab.f701f4","type":"link in","z":"b888aaf7.fdcdb8","name":"","links":["b92536a0.404088"],"x":275,"y":240,"wires":[["56397dd.8133704"]]},{"id":"59e8b2d6.cbbd0c","type":"ui_switch","z":"1070b5a9.049e52","name":"","label":"F","tooltip":"","group":"36c9c21a.96173e","order":16,"width":"1","height":1,"passthru":true,"decouple":"false","topic":"fri","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-check-square-o","oncolor":"--nr-dashboard-widgetTextColor","offvalue":"false","offvalueType":"bool","officon":"fa-square-o","offcolor":"--nr-dashboard-widgetTextColor","x":650,"y":660,"wires":[["38214638.d15062"]]},{"id":"757b6407.93bfac","type":"ui_switch","z":"1070b5a9.049e52","name":"","label":"Sa","tooltip":"","group":"36c9c21a.96173e","order":17,"width":"1","height":1,"passthru":true,"decouple":"false","topic":"sat","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-check-square-o","oncolor":"--nr-dashboard-widgetTextColor","offvalue":"false","offvalueType":"bool","officon":"fa-square-o","offcolor":"--nr-dashboard-widgetTextColor","x":710,"y":700,"wires":[["38214638.d15062"]]},{"id":"26165084.cac6","type":"ui_switch","z":"1070b5a9.049e52","name":"","label":"Su","tooltip":"","group":"36c9c21a.96173e","order":18,"width":"1","height":1,"passthru":true,"decouple":"false","topic":"sun","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-check-square-o","oncolor":"--nr-dashboard-widgetTextColor","offvalue":"false","offvalueType":"bool","officon":"fa-square-o","offcolor":"--nr-dashboard-widgetTextColor","x":750,"y":740,"wires":[["38214638.d15062"]]},{"id":"632c7f85.3c1a7","type":"ui_switch","z":"1070b5a9.049e52","name":"","label":"M","tooltip":"","group":"36c9c21a.96173e","order":12,"width":"1","height":1,"passthru":true,"decouple":"false","topic":"mon","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-check-square-o","oncolor":"--nr-dashboard-widgetTextColor","offvalue":"false","offvalueType":"bool","officon":"fa-square-o","offcolor":"--nr-dashboard-widgetTextColor","x":490,"y":500,"wires":[["38214638.d15062"]]},{"id":"ff572887.7ad76","type":"ui_switch","z":"1070b5a9.049e52","name":"","label":"Tu","tooltip":"","group":"36c9c21a.96173e","order":13,"width":"1","height":1,"passthru":true,"decouple":"false","topic":"tue","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-check-square-o","oncolor":"--nr-dashboard-widgetTextColor","offvalue":"false","offvalueType":"bool","officon":"fa-square-o","offcolor":"--nr-dashboard-widgetTextColor","x":530,"y":540,"wires":[["38214638.d15062"]]},{"id":"78babdf4.24f33c","type":"ui_switch","z":"1070b5a9.049e52","name":"","label":"W","tooltip":"","group":"36c9c21a.96173e","order":14,"width":"1","height":1,"passthru":true,"decouple":"false","topic":"wed","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-check-square-o","oncolor":"--nr-dashboard-widgetTextColor","offvalue":"false","offvalueType":"bool","officon":"fa-square-o","offcolor":"--nr-dashboard-widgetTextColor","x":570,"y":580,"wires":[["38214638.d15062"]]},{"id":"ae78308b.1b4898","type":"ui_switch","z":"1070b5a9.049e52","name":"","label":"Th","tooltip":"","group":"36c9c21a.96173e","order":15,"width":"1","height":1,"passthru":true,"decouple":"false","topic":"thu","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-check-square-o","oncolor":"--nr-dashboard-widgetTextColor","offvalue":"false","offvalueType":"bool","officon":"fa-square-o","offcolor":"--nr-dashboard-widgetTextColor","x":610,"y":620,"wires":[["38214638.d15062"]]},{"id":"3483a1c7.e219be","type":"link in","z":"1070b5a9.049e52","name":"program","links":["d25d866c.8a0408","fe18f21a.ceb84","d67a4762.fe9ad8","1a0d9394.7a11a4","fcd4dc4f.39cf7","a70fb0b3.eb4cd"],"x":160,"y":540,"wires":[["aa8b0026.128e3","a98bbbb3.5d96d","4bd44087.5a2338","a8c1557b.980cb8","4de4e61d.3eddc8","3b1817b7.ed688","5b74cf5c.c0e2d","f0fc11f4.d9f028","d93e6493.7d9448","56665016.eed738"]],"l":true},{"id":"dc56cfd3.d7f388","type":"ui_text_input","z":"1070b5a9.049e52","name":"on time","label":"On time","tooltip":"","group":"36c9c21a.96173e","order":4,"width":"3","height":1,"passthru":false,"mode":"text","delay":"300","topic":"ontime","x":520,"y":40,"wires":[["4841a765.6a20c8"]]},{"id":"c4c22f3b.f4ee5","type":"change","z":"1070b5a9.049e52","name":"ontime","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ontime","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":40,"wires":[["dc56cfd3.d7f388"]]},{"id":"c361c25b.5ffb4","type":"link in","z":"1070b5a9.049e52","name":"program","links":["fcd4dc4f.39cf7"],"x":160,"y":180,"wires":[["c4c22f3b.f4ee5","f5e3f327.3112a8","687a8e68.6deec","155795ba.49b2a2","feef6961.5abd1","628a9f6d.54b678","23823687.ab3e9a","bd123285.a95848"]],"l":true},{"id":"f5e3f327.3112a8","type":"change","z":"1070b5a9.049e52","name":" onoffset","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.onoffset","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":80,"wires":[["bb3f3cde.0f6c98"]]},{"id":"bb3f3cde.0f6c98","type":"ui_text_input","z":"1070b5a9.049e52","name":"on offset","label":"Offset (min)","tooltip":"","group":"36c9c21a.96173e","order":5,"width":"2","height":1,"passthru":false,"mode":"text","delay":"300","topic":"onoffset","x":520,"y":80,"wires":[["4841a765.6a20c8"]]},{"id":"687a8e68.6deec","type":"change","z":"1070b5a9.049e52","name":"offtime","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.offtime","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":120,"wires":[["b7c05bf9.c0f45"]]},{"id":"b7c05bf9.c0f45","type":"ui_text_input","z":"1070b5a9.049e52","name":"off time","label":"Off time","tooltip":"","group":"36c9c21a.96173e","order":8,"width":3,"height":1,"passthru":false,"mode":"text","delay":300,"topic":"offtime","x":520,"y":120,"wires":[["4841a765.6a20c8"]]},{"id":"155795ba.49b2a2","type":"change","z":"1070b5a9.049e52","name":"offoffset","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.offoffset","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":160,"wires":[["5dadc79b.d70188"]]},{"id":"5dadc79b.d70188","type":"ui_text_input","z":"1070b5a9.049e52","name":"off offset","label":"Offset (min)","tooltip":"","group":"36c9c21a.96173e","order":9,"width":"2","height":1,"passthru":false,"mode":"text","delay":300,"topic":"offoffset","x":520,"y":160,"wires":[["4841a765.6a20c8"]]},{"id":"a26821d1.c67928","type":"ui_switch","z":"1070b5a9.049e52","name":"on random offset","label":"Random","tooltip":"","group":"36c9c21a.96173e","order":6,"width":2,"height":1,"passthru":true,"decouple":"false","topic":"onrandomoffset","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-check-square-o","oncolor":"--nr-dashboard-widgetTextColor","offvalue":"false","offvalueType":"bool","officon":"fa-square-o","offcolor":"--nr-dashboard-widgetTextColor","x":590,"y":420,"wires":[["38214638.d15062"]]},{"id":"7583bddb.0a3cd4","type":"ui_switch","z":"1070b5a9.049e52","name":"off random offset","label":"Random","tooltip":"","group":"36c9c21a.96173e","order":10,"width":2,"height":1,"passthru":true,"decouple":"false","topic":"offrandomoffset","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-check-square-o","oncolor":"--nr-dashboard-widgetTextColor","offvalue":"false","offvalueType":"bool","officon":"fa-square-o","offcolor":"--nr-dashboard-widgetTextColor","x":630,"y":460,"wires":[["38214638.d15062"]]},{"id":"aa8b0026.128e3","type":"change","z":"1070b5a9.049e52","name":"mon","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.mon","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":500,"wires":[["632c7f85.3c1a7"]]},{"id":"a98bbbb3.5d96d","type":"change","z":"1070b5a9.049e52","name":"tue","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.tue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":540,"wires":[["ff572887.7ad76"]]},{"id":"5b74cf5c.c0e2d","type":"change","z":"1070b5a9.049e52","name":"sun","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.sun","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":740,"wires":[["26165084.cac6"]]},{"id":"4de4e61d.3eddc8","type":"change","z":"1070b5a9.049e52","name":"fri","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.fri","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":660,"wires":[["59e8b2d6.cbbd0c"]]},{"id":"a8c1557b.980cb8","type":"change","z":"1070b5a9.049e52","name":"thu","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.thu","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":620,"wires":[["ae78308b.1b4898"]]},{"id":"4bd44087.5a2338","type":"change","z":"1070b5a9.049e52","name":"wed","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.wed","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":580,"wires":[["78babdf4.24f33c"]]},{"id":"3b1817b7.ed688","type":"change","z":"1070b5a9.049e52","name":"sat","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.sat","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":700,"wires":[["757b6407.93bfac"]]},{"id":"f0fc11f4.d9f028","type":"change","z":"1070b5a9.049e52","name":" offrandom","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.offrandomoffset","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":460,"wires":[["7583bddb.0a3cd4"]]},{"id":"d93e6493.7d9448","type":"change","z":"1070b5a9.049e52","name":" onrandom","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.onrandomoffset","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":420,"wires":[["a26821d1.c67928"]]},{"id":"3e4eef12.1c9e8","type":"ui_switch","z":"1070b5a9.049e52","name":"suspended","label":"Suspended","tooltip":"","group":"36c9c21a.96173e","order":2,"width":2,"height":1,"passthru":true,"decouple":"false","topic":"suspended","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-check-square-o","oncolor":"--nr-dashboard-widgetTextColor","offvalue":"false","offvalueType":"bool","officon":"fa-square-o","offcolor":"--nr-dashboard-widgetTextColor","x":530,"y":380,"wires":[["38214638.d15062"]]},{"id":"56665016.eed738","type":"change","z":"1070b5a9.049e52","name":"suspended","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.suspended","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":380,"wires":[["3e4eef12.1c9e8"]]},{"id":"c091824d.9ef168","type":"ui_text_input","z":"1070b5a9.049e52","name":"","label":"On topic","tooltip":"","group":"36c9c21a.96173e","order":20,"width":0,"height":0,"passthru":false,"mode":"text","delay":"300","topic":"ontopic","x":520,"y":200,"wires":[["4841a765.6a20c8"]]},{"id":"33a5546f.a5b7d4","type":"ui_text_input","z":"1070b5a9.049e52","name":"","label":"Off topic","tooltip":"","group":"36c9c21a.96173e","order":22,"width":0,"height":0,"passthru":false,"mode":"text","delay":"300","topic":"offtopic","x":520,"y":280,"wires":[["4841a765.6a20c8"]]},{"id":"7cabe1a1.4a7008","type":"ui_text_input","z":"1070b5a9.049e52","name":"","label":"On payload","tooltip":"","group":"36c9c21a.96173e","order":21,"width":0,"height":0,"passthru":false,"mode":"text","delay":"300","topic":"onpayload","x":530,"y":240,"wires":[["4841a765.6a20c8"]]},{"id":"118502f7.62b7ed","type":"ui_text_input","z":"1070b5a9.049e52","name":"","label":"Off payload","tooltip":"","group":"36c9c21a.96173e","order":23,"width":0,"height":0,"passthru":false,"mode":"text","delay":"300","topic":"offpayload","x":530,"y":320,"wires":[["4841a765.6a20c8"]]},{"id":"feef6961.5abd1","type":"change","z":"1070b5a9.049e52","name":"ontopic","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ontopic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":359,"y":200,"wires":[["c091824d.9ef168"]]},{"id":"628a9f6d.54b678","type":"change","z":"1070b5a9.049e52","name":"onpayload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.onpayload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":369,"y":240,"wires":[["7cabe1a1.4a7008"]]},{"id":"23823687.ab3e9a","type":"change","z":"1070b5a9.049e52","name":"ontopic","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.offtopic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":359,"y":280,"wires":[["33a5546f.a5b7d4"]]},{"id":"bd123285.a95848","type":"change","z":"1070b5a9.049e52","name":"offpayload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.offpayload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":369,"y":320,"wires":[["118502f7.62b7ed"]]},{"id":"8bee0df8.9a3d78","type":"ui_dropdown","z":"2f7c2f6d.c20a68","name":"select","label":"Select","tooltip":"","place":"Select timer","group":"36c9c21a.96173e","order":1,"width":5,"height":1,"passthru":true,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"select","x":490,"y":180,"wires":[["4149b917.eca6"]]},{"id":"b61417ef.9bdf98","type":"function","z":"2f7c2f6d.c20a68","name":"initialize","func":"var timers = []; \nvar program = []; \nglobal.set('update',{});\nvar nodes = msg.payload.filter(findNodes); // array of schedex nodes\nnodes.sort(function(a,b){return a.name > b.name}); // sort by name\nfor (i=0;i<nodes.length;i++){\n    name = nodes[i].name; // check for duplicates\n    if (timers.includes(name)) {\n        node.error(\"Duplicate node names\");\n        return;\n    }\n    if (name !== '') { // skip blank names\n        timers.push(name);\n        delete nodes[i].id; // for neatness, probably not needed\n        delete nodes[i].type\n        delete nodes[i].z\n        delete nodes[i].x;\n        delete nodes[i].y;\n        delete nodes[i].wires;\n    }\n}\nglobal.set('program',nodes);\nglobal.set(\"timers\",timers);\n\n// initialize timers\nfor (i=0;i<nodes.length;i++){\n    msg.topic = timers[i];\n    msg.payload = nodes[i];\n    \n    node.send([null,msg]);\n}\n\n// initialize dashboard\nmsg.options = timers; // initialize ui_dropdown menu\nglobal.set('selection',0);  // set default selection\nmsg.payload = timers[0];\nreturn [msg,null];\n\nfunction findNodes(x){\n    return x.type === \"schedex\"\n}\n","outputs":2,"noerr":0,"x":340,"y":200,"wires":[["8bee0df8.9a3d78"],["b92536a0.404088"]],"info":"- Get list (array) of `schedex` nodes.\n- Set up dropdown menu.\n- Set initial selection to `timer[0]`\n"},{"id":"829ffd9d.34944","type":"function","z":"2f7c2f6d.c20a68","name":"cancel","func":"const i = global.get('selection');\nglobal.set('update',{});\nmsg.select = true;\nmsg.topic = global.get('timers')[i];\nmsg.payload = global.get('program')[i];\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":300,"wires":[["fcd4dc4f.39cf7"]]},{"id":"eff8af.4fbda75","type":"function","z":"2f7c2f6d.c20a68","name":"enter","func":"var i = global.get('selection');\nvar program = global.get('program');\nvar update = global.get('update');\nfor (let x in update) {\n    program[i][x] = update[x];\n}\nglobal.set('program',program);\nglobal.set('update',{});\nmsg.topic = global.get('timers')[i];\nmsg.payload = program[i];\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":340,"wires":[["b92536a0.404088"]]},{"id":"38214638.d15062","type":"function","z":"1070b5a9.049e52","name":"booleans","func":"if (msg.select) {\n    global.set('update',{});\n} else {\n    update = global.get('update') || {};\n    node.warn(msg.topic);\n    let property = msg.topic;\n    update[property] = msg.payload;\n    global.set('update',update);\n    node.warn(update);\n}\nreturn msg","outputs":0,"noerr":0,"x":820,"y":540,"wires":[]},{"id":"4149b917.eca6","type":"function","z":"2f7c2f6d.c20a68","name":"show","func":"var timers = global.get(\"timers\");\nvar i = timers.indexOf(msg.payload);\nglobal.set('selection',i);\nvar program = global.get(\"program\");\nglobal.set('update',{});\nmsg = {'payload':program[i]};\nmsg.select = true;\nreturn msg;","outputs":1,"noerr":0,"x":610,"y":180,"wires":[["fcd4dc4f.39cf7"]],"outputLabels":["timers"]},{"id":"4841a765.6a20c8","type":"function","z":"1070b5a9.049e52","name":"strings","func":"update = global.get('update') || {};\nnode.warn(msg.topic);\nlet property = msg.topic;\nupdate[property] = msg.payload;\nglobal.set('update',update);\nreturn msg","outputs":0,"noerr":0,"x":710,"y":180,"wires":[]},{"id":"69061920.be04e","type":"switch","z":"2f7c2f6d.c20a68","name":"action","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"startup","vt":"str"},{"t":"eq","v":"reset","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":190,"y":220,"wires":[["b61417ef.9bdf98"],["25522a14.5997a6"]],"info":"Select startup or reset action."},{"id":"d260d894.c43d7","type":"inject","z":"b888aaf7.fdcdb8","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":280,"wires":[["5b6e102f.6fe1"]]},{"id":"3ec6b734.70852","type":"inject","z":"b888aaf7.fdcdb8","name":"","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":320,"wires":[["5b6e102f.6fe1"]]},{"id":"c28ea6e6.a354d","type":"inject","z":"b888aaf7.fdcdb8","name":"","topic":"","payload":"toggle","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":360,"wires":[["5b6e102f.6fe1"]]},{"id":"abc40a68.94aa","type":"inject","z":"b888aaf7.fdcdb8","name":"","topic":"","payload":"info","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":400,"wires":[["5b6e102f.6fe1"]]},{"id":"43374b26.800b8c","type":"debug","z":"b888aaf7.fdcdb8","name":"timer4 output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":660,"y":280,"wires":[]}]

The dashboard looks like this.

Changes can be entered in the text fields and checkboxes, which correspond to the settings in the node's edit dialog. At present, there are no checks for valid input, so caution is required. The dropdown menu lets the user choose which schedex node to program. The cancel button discards any changes, and the enter button writes them into the selected node. The reset button restores the node parameters to the values in the edit dialog. Selecting a different node discards any changes that have not been entered.

At startup, the flow scans the flow file for instances of the schedex node and identifies them by the name property. Each instance must have a unique name, except that unnamed nodes are ignored. To use the interface, a schedex node may be located anywhere in the flow but must have its input connected to the programmer through a link in node and a switch node programmed to pass only messages with msg.topic equal to the node name. Other inputs and outputs are connected as usual. This is shown in the Timers tab, which has an example consisting of four schedex nodes.

I have no idea whether anyone will find this useful, but I have learned a bit while developing it and will be happy to fix bugs or make improvements if they are brought to my attention.

4 Likes

Hi iiLaw very interested in your scheduler looks great can you share the code please
Thanks
P

Hi yep let me tidy it up.

no probs - thanks

@iiLaw, Hi, I know this is an old thread but did you get anywhere with your tidying up? I'd be interested in looking over your flow.

Thanks
Martyn

It’s not using schedex but i build a scheduler and a timerange switch as subflows a while back and i had also made an ui example for it. So maybe if your interested have a look here (needs nodered 1.0 and above to work):