Conditional RBE Reset

First all Thank you to everyone who has helped me out thus far! This is a great community and I have learned a lot along the way!

I have a project that is monitoring a dashboard and I have node red connected to the API and is pulling a JSON file and parsing it.

Its looking for a specific City name and then sending me an SMS message when it finds the city. Then it will send another SMS if that City name disappears.

Here is the flow.


Contents of the "Chicago" function

const city = 'chicago';
const bool = msg.cities.includes(city);
var mess = `No calls on the board for ${city}`;
if (bool === true) {
    mess = `Call on the board for ${city}`;
}
msg.payload = mess;
return msg;

The Inject block checks the API every minute between the times of 8AM to 5PM M-F.
I then have the RBE set to Block Unless Value Has Changed (Ignore Initial Value). This keeps me from getting an SMS every time the inject block executes.
The Ignore Initial Value also keeps from getting nuisance SMS when the server reboots or the flow is reset.

So what I'm trying to figure out, is how to reset the RBE at 8 AM M-F only if the variable "bool" is true.

I was thinking of using another inject block to only send an inject at 8:01 AM directly into my "Chicago" function and then some how send a blank msg.reset. But I cannot figure it out.
Sorry just learning Javascript.
Any ideas or should I take a different approach?

Instead of using the RBE node, after the 'Send SMS' node set a context variable that sets 'send=true' and before the Send SMS node use a switch node that checks if the variable send is false (ie. it will block if it is true)

Then every day at 00:00 reset the send variable.

Thanks for the suggestion.
Unfortunately that would only send one text message a day. Where those messages pop up multiple times a day and require multiple SMS messages.

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