{Problem}Bigtimer

No, it wasn't you that was boring me. I did go on to take my example further:

It doesn't quite work how I wanted it to but at least I got rid of the subflow & I added in the cron-plus node & a bit of feedback - which is the bit that isn't quite working correctly. Still, you get the idea.

Also, my CRON syntax, while correct for some versions of CRON, were not correct for cron-plus. Here is a more suitable function:

const dt = new Date(msg.payload)

msg.payload = [
    {
        'command': 'add',
        'name': msg.topic,
        'expression': `0 ${dt.getUTCMinutes()} ${dt.getUTCHours()} * * *`,
        'payload': msg.topic,
        'type': 'str',
    },
    {
        'command': 'status',
        'name': msg.topic,
    },
]

return msg

That will replace any previous cron entries with the matching topic name. So you can send both the start and end times to it. It will also output the status for the updated cron entry so that you can attach a flow to the output of cron-plus that can be fed back to your page or anywhere else. When cron-plus fires, you can also take a copy of the output and feed the next trigger time back to your webpage.

2 Likes

Hi all, I finally got around to creating a reasonable demo...

Dynamic cron schedules / timers via dashboard control

Hope its of some use to people.

2 Likes

And for reference, I've started to build a uibuilder equivalent to this - though got sidetracked by some issues - the code is in this thread at the moment, I will post to a flow once it is completed.

1 Like

thank you very much to both of you you have been very kind, thanks to you I was able to solve.
There is only one problem @Steve-Mcl : when I enter every minute, for example, the timer starts from January 2000. I would like to know if it is a problem or I have to set the date ...

I don't understand?

There is no need to set a start time (thats not how CRON works)

What you makes you think it starts from January 2000? How is that you came to that conclusion?

EDIT...

TBH: This thread was hijacked and should have been new thread long ago - would probably be good netiquette to start a new thread if you have problems with a node or flow.


sorry for not making myself understood, I have attached a photo to you.

I think this was a bug that @TotallyInformation and @afelix pointed out (fixed in latest version)

Can you verify if your install of cron-plus is up to date? V0.4.0 is current

thank you very much, I solved by doing the update. One last thing and then I leave you in peace (I swear to God): how do I connect the "rpi gpio" output to the flow you gave me?

The same as you would if you used an inject node.

It's pretty much the same! A topic and payload is output when the time arrives. Use that (via a switch node to filter to correct topic if need be) to trigger your gpio

Thanks for all!

Hi @Steve-Mcl, I tried to connect rgpio output to the cronplus stream, but I didn't succeed ... Could you do me a screen of the right procedure?I really apologize for the trouble, but I tried with poor results ..

First get your gpio out working using a Inject node to drive it. When that is going you will know what you need to get out of the bigtimer node to make it go. So put a debug on the output of the timer node and see what you are getting. Then if you still can't make it go then show us what you are getting out of the timer and tell us what you want to get.
Watch in particular for things like sending string "1" and "0" for example when it may be that what you actually want is number 1 and 0.

@Colin the title indicates "bigtimer", but if you read above they recommended a cronplus, so I would need the scheme to connect gpio to the flow of the cronplus

What difference does that make? My logic still applies, get the gpio pin going with an inject node then check that you are getting that from the cron node. As for the actual connection between the nodes I think you will be able to connect the cron node output directly to the gpio node.

1 Like

Hi, regardless of Cron-plus or bigtimer, as @Colin rightly says, you need to get the GPIO to work first.

The Gpio works! I just have to connect the Cronplus to it ..

I already suggested what to do next. You know now what you have to get out of the timer node, so configure the timer with your best guess at what you need and put a debug on it's output and see what you are getting. Adjust the timer node setting till it shows the same as you are getting out of the inject node. Then connect the two together and it will work.

If the advice above does not help then we probably don't understand exactly what bit of the problem you are having difficulty with. Please try again to explain which part of the problem you need help with. You keep saying you don't know how to connect the gpio node to the timer node, but to do that you just have to join the output of the timer to the input of the gpio. So please explain exactly what you don't know how to do.

1 Like