Thank you for the feedback,
Let me think a bit more on how to.
Thank you for the feedback,
Let me think a bit more on how to.
Actually I realise there may be a much better solution. Would your system be ok if there was a restriction that the On time plus the Off time is a fixed value? So in the image you posted that would be 30 minutes? With the on/off duty cycle variable to give the on and off times you want? If so then have a look at node-red-contrib-timeprop which provides exactly that. Rather than being given the on and off times it is configured with a cycle time (30 minutes for your requirement) and then is passed a duty cycle in the range 0 to 1, so to achieve 20 on and 10 off you would pass it the value 20/30 or 0.67.
You could adapt this
example...
then if you have a power failure, to get current ON/OFF state, you can simply send a list
command to the CRON-PLUS node), to get the "next event time" for the schedules ^ determined ON/OFF state
e.g.
nextDate
is < "grow led off" schedules' nextDate
then the fire an OFF msgnextDate
is > "grow led off" schedules' nextDate
then the fire an ON msgThank you for reply , the cycle time are no necessarily 30 min. The on time can be any value, as well the off time and the sum of the two not equal to a specific amount.
The timeprop would have been a perfect solution if the sum of the two were a constant and the one a fraction of the other.
Thank you for your reply.
It looks very well put together, but splitting the outputs to 7 devices I want to control (a bit of work there), it also does not have redundancy ( that will be a bit to to get done), but I like the idea, so maybe something to further investigate.
No bother.
If you don't mind, what do you mean by
And
I'm curious.
I have 3 sets of led I need to turn on and off and 4 valves I want to open and close
As soon as you re-deploy the flow or the PI (device) resets you have to re enter all your Corn Schedules. (but it is most probably that I don't wright my context data to file).
Full deployment does indeed discard the dynamic CRON schedules. However, any solution you create (dynamically) is lost if there is a power cut. So you will need to persist to file whichever solution you go with. So in other words, the Cron node would also work and can do everything thing you need (I think).
Still not sure what you mean about 7 outputs. You can very easily attach a switch node to the output of the Cron node and divert the ON OFF signals anywhere you want (based on topic)
If I understand correctly a message are issued when a scheduled event occurs (On) , are there a duration for a even or do you create a new schedule for the off time?
I can create a DB and recover the schedule from it. As we have a few issues with reliability of power here.
I really like the dynamic part of it, well do. (I have some way to go to understand node-red and JS)
You create as many on / off events as you want.
To be completely dynamic (the ultimate goal of CRON+) there is no awareness of on/off/start/stop etc. You just create the events via your dashboard. Send any topic you want. Send any payload you want. (that allows you to be able to simply extract by payload or by topic via a switch node to send your schedule event to 7 or 77 different directions)
For example, the screenshot above where you had an hour, minute and MON, TUE, WED....... SUN check boxes for LED ON and LED OFF....
I would simply generate the CRON string for what is selected and add two schedules (one for on, one for off)
E.g.
Add them together as
0 Min Hour * * Days
Then send them to the Cron node as an add
command (its all documentes in the side bar help panel)
For persistence (power fail recovery) simply send a "list-all" command (again, it in the built in help) and write the appropriate data to file. Upon start-up, use an inject node and a little function code to regenerate the CRON schedules via "add" commands.
All I can say is, it's all perfectly possible, with quite minimal effort to achieve what you're asking.
Up to you.
I can of course help out if you get stuck.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.