Ubidots Community

[SOLVED] Count and display the number of times an alert has occurred


I have set up an event in Ubidots that triggers an alert every time the value exceeds 100. There are another 2 things I want to be able to do:

  1. How can I count/record of the number of alerts that have occurred (i.e. how many times the value has exceeded 100)? Is there a variable I can increment every time an alert is triggered? (And if so, how can I access this variable?)
  2. If I can keep track of this number, how can I display it on a dashboard? e.g. Using HTML Canvas to access this variable?

And for additional context, I have an Industrial Ubidots account where I am hosting dashboards for my company. Being able to display and keep track of the number of times an alert has been triggered would be extremely helpful.


Hello @switch_route,

We currently do not have a specific event that tells you exactly how many times an event has been activated. However, there is an alternative for you :smiley:

  1. Create a new raw variable, “activations”; this variable will receive a positive flag (integer number “1”), at the moment the event has been activated, and a “-100” when the activation counter reaches its limit.
  2. Create a synthetic variable, “count” with the following formula: cumsum("activations"); This variable will be responsible for adding up the total number of positive flags received in “activations”.
  3. Set up an additional “Set Variable” action in the event you want to account for. Select “activations” as the variable, and assign “1” as the value to be sent.
  4. Once the changes have been saved, configure an additional event for the “count” variable. This event will notify you that the variable exceeded the desired value, and at the same time it resets the counter of the “count” variable.
    The configurations of the event must be: If the variable “count” is “greater than or equal to” - “100”, then actions:
  • Notification - Email, phone call, msg, etc…
  • Set Variable - Variable: “activations”, value: -100.

The settings provided will allow you to receive a notification when a specific number of events are exceeded, however, keep in mind that this notification may take up to 2 minutes to be received because the computation of the synthetic variable has to be done first.

In addition to this, if you want to include these variables in your dashboard you can do it directly through the widgets provided by the platform.

Let me know if you have any additional doubt.

Maria H.

Hi @mariahernandez,

Thanks for the quick and detailed response. That definitely addresses the specific use case I mentioned, which will be helpful.

Do you have an alternative method in order for my company to count how many times the value has triggered the “Has been inactive” event?
For example, let’s say I create an event that triggers when a value hasn’t changed for 1 hour. In the span of 4 hours, there should have been 4 of these alerts triggered.

How can I use Synthetic Variables to increment / keep count of 1 hour time periods where there is no activity on a device?


I’m glad to know that my explanation was very helpful for what you was looking for.

Regarding the other question, I’m sorry to say that we don’t have an alternative for it since the logic of the event engine doesn’t allow it; the figure below describes how the Events Engine triggers alerts inside an active event window.


For more detailed information, I highly recommend you check out the following guides:

However, I would like to inform you that we are currently working on a new feature for the reactivation of events. Once this feature is deployed, we could find an alternative for what you are looking for.

I’ll keep you informed. :wink:

All the best,
Maria H.