Ui_time_scheduler question

Installed the ui time scheduler node and was playing around trying various things. One question... is there any way to discern which timer is firing? If there are three schedules I don't see anything in the output that tells me which timer fired. Is there an indicator.

Hi @gerry,

every configured device has its own output and therefore you can see what device fired.

If you configure multiple timers for a specific device, let's say 08:00 to 09:00 and 10:00 to 11:00 then there is currently no way of telling if the first one or the second one fired. What's your use case (and why would this be important to know)?

I have one device with 3 schedules and I'm looking to control animal feeders or device on duration. For example in the summer the pig misters run longer in the afternoon than in the morning. Each time may have different time durations. So I need to be able to define what time or timer fired to set a duration

Also the different time durations are set via dashboard so I only use the timer to fire the event not set a duration

Okay interesting.
You can put a function node behind the output and simply insert this:

msg.date = new Date();
return msg;

then you have the current time in your message object and you can process it later.

Or do you need some other information in the message object as well?

I suppose what I was hoping for was a topic that told me which schedule number fired. I can do the function thing but if I change the time then I would have to go into the function and change some things. I have a flow I've been using that uses the cron nodes and my cobbled together dashboard interface. I like the looks of yours much better. There is a number off to the side of the time that I was hoping would be output. I looked at your code but then if I made a change in your code it would be my fault. As it is if I use your code then I can blame you when the wife grumbles , I also don't want to run a custom node since when you make changes my changes would be overwritten

I would suggest the topic output that number in the msg. Thoughts on that?

Ok, I'll offer a solution. an option.

Although you only have one device and three schedules. Why not make it 3 devices?
Though if you want to then add further schedules you are in trouble.

Sorry: just a thought.

But if it is only going to be 3..... (or: a fixed number) then that would work for you.

You just then have code which detects which output is sending the signal and all is sweet.

I already have a working albeit somewhat clumsy solution, looking for that better way. Using three nodes doesn't really move me forward. If I could get a topic identifying the timer, that makes it worth working on.

This is interesting.

(Sorry @fellinga - I'm not trying to steal them using your node)

I have a similar thing to you, but different is so many ways also. :wink:

I have a thing happening daily which is also variable.

My scenario is sunset and what happens then.

So sunset happens and depending on the month, different times apply to when the next thing happens.

So in summer (well that isn't really applicable it is more months)....

In "summer" it starts to do things (and repeat) at a shorter time interval than when it is "winter".
And the months between have slightly increasing/decreasing values.

I am not sure you are using the right node for this requirement.

I can post a bit of my flow if you are interested.

Oh, just for the fun of it, how about either a screen shot of the flow (a basic idea) or the core part of the flow (code)?

It may help @fellinga also understand what you want better.
(No offence meant)

This is a very basic flow I just wrote:

I did a slight tweak on it at 17:25 local.

[{"id":"3a1a3d7c.d6a1a2","type":"inject","z":"5b6dee10.d1621","name":"minutes to run","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":260,"y":970,"wires":[["42a37f0b.fe6918"]]},{"id":"42a37f0b.fe6918","type":"change","z":"5b6dee10.d1621","name":"flow.run_time","rules":[{"t":"move","p":"payload","pt":"msg","to":"run_time","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":970,"wires":[[]]},{"id":"7f54a2fd.f5e364","type":"inject","z":"5b6dee10.d1621","name":"Schedule atart signal *","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"start","payloadType":"str","x":240,"y":1070,"wires":[["947d20e9.68bd58"]],"info":"This happens at a given time every day.\nFor the same of not confusing things, you need to press it to get things going.\n"},{"id":"8a18e133.eba3c","type":"comment","z":"5b6dee10.d1621","name":"Read me *","info":"Any node with an `*` in the name has more to be read in this part of the node.","x":440,"y":900,"wires":[]},{"id":"f07fe327.8f0bd8","type":"change","z":"5b6dee10.d1621","name":"get run_time","rules":[{"t":"set","p":"delay","pt":"msg","to":"run_time","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":1110,"wires":[["d61ac89d.6038d"]]},{"id":"d61ac89d.6038d","type":"trigger","z":"5b6dee10.d1621","name":"","op1":"START","op2":"END","op1type":"str","op2type":"str","duration":"250","extend":false,"overrideDelay":true,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":840,"y":1110,"wires":[["f96d2d77.e90508"]]},{"id":"f96d2d77.e90508","type":"function","z":"5b6dee10.d1621","name":"do this *","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1020,"y":1110,"wires":[[]],"info":"This is the rest of your flow.\nIt gets a message `START` to start things and a `END` to signal the end.\n"},{"id":"947d20e9.68bd58","type":"switch","z":"5b6dee10.d1621","name":"Only allow START signal to pass","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"START","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":520,"y":1070,"wires":[["f07fe327.8f0bd8"]]}]

Are you are referring to the number at the frontend?

That's not reliable data really, if you would create another timer at 07:00 to 07:30 then the one from 08:00 to 09:00 would change to #2 and you would have to adjust things again too.

I really don't mind adding a topic to the generated output messages, but I just can't see how this number would help with anything. Can you explain your mechanism after the scheduler node a bit more so that I fully understand how you currently decide the next steps?


I think that would be handy for a greater good.

Let's see if it's possible for me to fully explain.
Let's take the feeders. There are five of them total but at any given time I may or may not use all of them. Currently only three are used. They run twice a day but may not run on any given day if the animals are out. So when the main timer fires then starts the 1st count down timer. That time is variable based on a number of factors and while it's not adjusted every day it's not unusual to adjust it once a week. That logic applies to all the count down timers. After the first countdown finishes the next count down starts and so on for all five count down timers. They cannot run at the same time as the feed chute cannot handle dispensing that much feed from the bin.
All of my timers are much like any sprinkler system timer and in fact one of them functions as my irrigation system timer.
The requirements are that each on time for the main timers be adjustable and the duration of each count down timer has to be adjustable. And the on time from the main timer as well as the individual count down timers must be adjustable from the dashboard. The morning run time durations may be different from the afternoon run time durations so every start time has to be adjustable and every count down time has to be adjustable.
As stated I have a working flow in place that is huge, cumbersome, not at all optimized and really needs help. So off and on over the time that system has been in place I have looked at different nodes and methods to improve my code and frankly have a better dashboard. I am not by training a coder and my ability to mix colors, shapes and placements for a nice looking dashboard place me in roughly the bottom 1% of the population as I have no abilities in that area.
Currently my flows use three cron-plus nodes in each flow to start the count down timers. I could indeed place three of the ui time scheduler nodes in a flow but that doesn't get me any further than I already am.
If I could somehow identify which timer was being fired in the time scheduler node then I would know which set of duration times I needed to use. I like the time scheduler dashboard which is why I started playing with the node. There are literally thousands of nodes out there with no really good method to sort them out or identify how they work so when the forum brought up the ui time scheduler node I thought I'd try it out.

(DId you try/look at the flow I posted?)

Ok: your scenario is interesting.

How "big" is big?

I have flows that are also huge - (no, this isn't a pissing contest) - and am only now going through optimising them because I am actually getting a bit smarter now.

Is it only one tab?

What ever way, select the tab (or nodes on the tab. But if it is all nodes on the tab ... keep reading) export then either selected tabs or current flow and post how many nodes are involved.

Hope to hear back soon.

Oh, and not to make your choices more difficult:
Have a look at his node:
It may be handy for your needs

Yes I did load up your flow In it's basic form I see what you are doing. My flow has 103 nodes in it. As best as I can count. When I started this project it seemed fairly simple in my mind but as I tried to implement the dashboard controls and started to flesh out all the different functions I wanted it seemed to turn into this huge monster. It does work and it seems robust and it does all the things I wanted it to. As stated I'd love to get this down to a better flow and keep looking for nodes to help. I have no problem sending the flow if you can figure out how to get it. As I said I'm not a good programmer and any improvements are welcome.

Just released 0.4.9, it includes the option to enable a msg.topic per device (yes per device not per timer).

I have created a demo flow. It's only one ui-time-scheduler node but has 5 different devices (feeders) configured within the node itself. Every output adds the device name as topic to the outgoing message.
Optional info: The node in the demo flow is also configured in Event Mode with Custom Payloads activated, which means you can directly input the time (duration) into the event field, like this:
This timer sends a msg with payload "240" (random chosen number (4 minutes)) and the topic "Feeder1". You can use this information for your post processing.

[{"id":"ef11c701.cd9fa8","type":"file","z":"d8cb3879.806298","name":"WriteFile","filename":"/home/debian/Documents/time-schedule0.txt","appendNewline":true,"createDir":true,"overwriteFile":"true","encoding":"none","x":760,"y":100,"wires":[[]]},{"id":"7822012a.876838","type":"inject","z":"d8cb3879.806298","name":"FireAfterReboot","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":200,"wires":[["2920de2a.a86312"]]},{"id":"2920de2a.a86312","type":"file in","z":"d8cb3879.806298","name":"ReadFile","filename":"/home/debian/Documents/time-schedule0.txt","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":340,"y":200,"wires":[["18d69559.b452cb"]]},{"id":"ee4ea530.9cd2b","type":"ui_switch","z":"d8cb3879.806298","name":"","label":"Feeder1","tooltip":"","group":"da533883.459d88","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":760,"y":140,"wires":[[]]},{"id":"18d69559.b452cb","type":"ui_time_scheduler","z":"d8cb3879.806298","group":"bfe48a3e.1b0f4","name":"","startDay":"1","refresh":"60","devices":["Feeder1","Feeder2","Feeder3","Feeder4","Feeder5"],"customPayload":true,"eventMode":true,"sendTopic":true,"outputs":6,"order":1,"width":"6","height":"3","x":510,"y":200,"wires":[["ef11c701.cd9fa8"],["ee4ea530.9cd2b"],["7cd30112.54883"],["837610b7.b518b"],["e1328f7a.9d932"],["caf1ef51.9f911"]]},{"id":"7cd30112.54883","type":"ui_switch","z":"d8cb3879.806298","name":"","label":"Feeder2","tooltip":"","group":"da533883.459d88","order":3,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":760,"y":180,"wires":[[]]},{"id":"837610b7.b518b","type":"ui_switch","z":"d8cb3879.806298","name":"","label":"Feeder3","tooltip":"","group":"da533883.459d88","order":4,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":760,"y":220,"wires":[[]]},{"id":"e1328f7a.9d932","type":"ui_switch","z":"d8cb3879.806298","name":"","label":"Feeder4","tooltip":"","group":"da533883.459d88","order":5,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":760,"y":260,"wires":[[]]},{"id":"caf1ef51.9f911","type":"ui_switch","z":"d8cb3879.806298","name":"","label":"Feeder5","tooltip":"","group":"da533883.459d88","order":6,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":760,"y":300,"wires":[[]]},{"id":"da533883.459d88","type":"ui_group","name":"Switches","tab":"2936b813.6cde68","order":2,"disp":true,"width":"6","collapse":false},{"id":"bfe48a3e.1b0f4","type":"ui_group","name":"PermDemo","tab":"2936b813.6cde68","order":1,"disp":true,"width":"6","collapse":false},{"id":"2936b813.6cde68","type":"ui_tab","name":"Scheduler Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

You should update to 0.4.9 and then import the flow. Please let me know if this helps!


I may have to update mine soon to see if it helps me too.

1 Like

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