Rules - Count Nodes and Count Events Actions

v2.1 adds two new action types, Count Nodes and Count Events:

Type Description
Count Nodes Counts the number of nodes meeting the specified condition
Count Events Counts the number of times the specified condition has been true


Count Nodes

IoT Systems often include many of the same type of sensor and it is critical to know how many of these sensors are meeting a certain condition. The Count Nodes action supports this.

In the example below, count nodes is used to tally up all of the sensors sending the metric tempF that are over 60.   This screen shows setting up the Condition:



Below is the setup for the Count Nodes action.  The resulting count of tempF sensors that are reading over 60 is stored in the data cache (and data store if enabled) using the specified Target ID and Metric name (tempFnodesOver60 and tempFcount respectively in this example).  These should be new, unique names.  This new data set can be used to create dashboards, additional rules, notifications, etc.  


Count Events

Another related calculation is how many times a certain condition was met within a particular time interval.  For example, how many times in a 24 hour day is the door of a cold storage freezer opened.  The Count Events action facilitates this.

In the example below, whenever the door state is True, this rule will call the action, Increment Door Open Counter:


The setup for the Increment Door Open Counter action is as follows:


A unique Action Name is specified, Action type is Count Events, a unique Target ID and Metric Name are given, and finally the time period over which to count, Counter Reset.  Like Count Nodes, this new data set can be used to create dashboards, additional rules, notification, etc.  

Was this article helpful?
0 out of 0 found this helpful