Count no of occurences of a variable going 0 to 1



I am using a number of separate error code variables to state an occurring error.
In the UI they are shown on a slider with values ranging from 0 (not triggered) to 1 (triggered).

I am also using the HTML Canvas widget to show a specific error icon using JS/CSS.

Ubidots is being sent a string of values from a virtual device model in Node-Red every 5 seconds,
hence I will not be able to use the inherit Count functionality on a variable. Is there any other way
of counting number of errors going active during a specific time frame?



Dear @topese,

As I understand you desired to count the number of times the conditions were triggered(1), right? To count the number you can simply create a Rolling Window variable the type of count based on the variable which is triggering the action.

I hope this would help you!

All the best,
Maria C.


Hi Maria and thanks for your reply.

Adding a rolling window to the variable won´t work since I updating the Ubidots with incoming data sent from Node-Red every 5 seconds (configurable). The count variable hence shows the number of times the variable have been updated (about 5000 times when I last looked).

What I do need to retrieve is the number of errors, i.e. times either variable error01 or error02 has gone from 0 to 1, that is have been triggered. I could potentially do this addition in Node-Red since the virtual device model and its variables are held there.



Oh… Now I get you! If you desire to know how many times the errors have been triggered, you have to use a rolling window - sum variable. For more information about the rolling windows, reference to the following article:

All the best,
Maria C.