Hi,
My problem is simple yet I can't seem to wrap my head around it. I'm grabbing the last saved count from 'node-red-contrib-counter' when it's reset at midnight and displaying the old total as "Yesterdays Count". The function below for "Yesterdays Count" is working if the count is 1 or more but if the count is 0 it is not returning 0. "Yesterdays Count" will remain at whatever the value was before or will update next time the count is a reset as long as the count is 1 or more. How can I adapt the function below to accept 0 and pass it to "Yesterdays Count"?
// Grab the last saved total count:
msg.ycount = flow.get("ycount")||0;
// If the count just reset, display the old total:
if (msg.reset === "True") return msg;
// otherwise just update the new saved value,
else {
flow.set("ycount", msg.count);
// and end the program:
return null;
}