Monthly signal - help please

(Brain failure)

I'm wanting a monthly signal to happen at ...... 23:50. (say)
(Sorry.... The rub: last day of the month)

The inject nodes doesn't quite seem to do that.

cronplus may. bigtimer seems possible too.

But I just can't get my head around how to do it.

Someone - please.

You can use an inject node and a very simple function node.

[{"id":"8a7ca794.3fa14","type":"function","z":"f954564f.03e718","name":"is tomorrow the 1st?","func":"let date = new Date(msg.payload+86400000); //create a date object from the timestamp plus one day\nlet day = date.getDate(); //get the corresponding day\nif(day==1){ //check if tomorrow is the 1st\n    return msg;\n}else{\n    return null; //else do nothing\n}","outputs":1,"noerr":0,"x":440,"y":3840,"wires":[["26e1d7e1.e15c5"]]},{"id":"67f730c5.493e6","type":"inject","z":"f954564f.03e718","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"50 23 * * *","once":false,"onceDelay":0.1,"x":230,"y":3840,"wires":[["8a7ca794.3fa14"]]},{"id":"26e1d7e1.e15c5","type":"debug","z":"f954564f.03e718","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":3840,"wires":[]}]

A timestamp is injected at 23:50 everyday and we than check in a function if tomorrow is the first, otherwise we return nothing:

let date = new Date(msg.payload+86400000); //create a date object from the timestamp plus one day
let day = date.getDate(); //get the corresponding day
if(day==1){ //check if tomorrow is the 1st
    return msg;
}else{
    return null; //else do nothing
}

Johannes

Ok. Thanks.

I'll look at it.

I'm guessing all those times are local and not Zulu time. (Sorry I have had a few problems with time zones, and just want to be sure.)

This will be whatever time the machine nodered runs on uses as we generate the Date object from the base of the timestamp from the inject node.

Ok. Again: Thanks.

With cronplus you could use:

2 Likes

Ah! I missed the L flag.

1 Like

It is not a standard cron feature (ie: not available everywhere), but is a very useful one in this case!

Yeah. Thanks.

I was nearly going to make it at 00:10:00 on the first day of the month.
It isn't that critical.

But for the sake of getting it as I want, it is good to know and learn.

While this is not a standard, L is employed by a quite a few cron implementations I've seen, including Quartz.

Its even listed on wikipedia (so it must be popular :wink: )

1 Like

Yeah, thanks.

I did google it and did a bit of digging. But I didn't see that mentioned/listed/shown.

Anyway, it is now resolved and again: Thanks to all who responded.

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