HOW TO: manage event and list of devices in tables on Snap4City Dashboards


In the IoT world, sensors and devices of various kinds share the data they detect with centralized units with the aim of analyzing and displaying the data. For example, pollution sensors scattered around the city can indicate on a map which areas are most polluted in real time.

Although the IOT world is perfectly suited to a case like the one reported above, the exception is made for events that may or may not have a temporal duration. In this scenario we evaluate the types of events to represent, then we move on to the representation of a unified model for their registration and finally we develop a graphical dashboard for viewing. Moreover, the events may be ONESHOT or REPEAT.

ONESHOT events are for example landslide, accidents, etc. They are Device Orinented, realted to the device, a set of devices are events

  • They occur at a given time instant and may evolve chaiging the status in the successive time instants, and thus on messages posted on the IoT Device representing the Event.
  • The evolution could be marked by some state: inception, stable, present, solved.
  • Thus once the event is finished its visualization is completely part of the story and the event it not anymore active.
  • In most cases, this kind of events are interesting only for the last message on the IoT Device representing the event. 
  • in this case, one should ask which are the ACTIVE Event, menas to search in a category of Devices (according to the same device model used) and get those that have still non CLOSED status

REPEAT events are for exmaple: entertainment events on a theater, taxation registered on a speed measruing device of police, maintenance events of a certain machine or car, etc., They are message oriented, related to the messages of a unique Device.

  • They have an initial description at the creation of the entity as an IoT Device in which the events occur.
  • The single event is substantially an instance message of the IoT device of the entity.
  • The temporal duration of the events is usually declared into the message variable, e.g., the datetime in which the show at the theter is going to be represented, the datetime in which the advertising can start and the final day of the representations. 
  • In this casem on should ask to the list of messages of a certain device, for example occurred in a certain day, or period; or which have a certain date in a certain range of values 

Future / Past Events

Past-> Past events with respect to local time.

Future-> Future Events with respect to local time. for example for planning entertainment event, for project planning, etc.

Events with temporal Duration

Events with time duration are those events that have a Beginning, a Progress and an End. The duration of the event is assumed to be unknown, it will be the responsibility of the IoT devices to report the progression of the event and then indicate its opening, progress and termination.

An example could be road maintenance events, cataclysmic or dangerous events.

Events with no temporal duration (instant)

For Instant events we mean those events that do not have a temporal duration, this type of events can only be reported as having occurred at a given moment, they do not have a progression, nor a termination.

In the modeling these events will be represented as Events with Duration where the event start date and event end date coincide.

An example of these events can be Traffic Fines.


Possible Models

The idea is to identify the single model to which all types of events must refer, within it the model can in turn host the models that refer to particular cases, for example. seismic events, fines, maintenance work, etc.

Other features like device name, location etc. they are already specified in the structure of any IOTDevice.

General Model



Value for example





Start event timestamp



Strat promotion timestamp



End event timestamp

Timestamp, se non previsto = null


Event status

“Start” – Event start, “In Progress” – Event in progress, “End” – Event closed, “Future” – Future event


Icon color



Id of the icon



Visualition Active/Not active

Active – Active for the visualization

Inactive – Not active for the visualization


Some coded status



Description or event update



Relatd/Not related from the device: ONESHOT or REPEAT

“DeviceUnrelated” – Not related to the device

“DeviceRelated”- Related to the device


Streent of the incident



Unique identifier of the event type REPEAT

Unique data of the device + progressive number assigned from the IOT device




Civic number

Number of peole




Specific attributes based on the event type (sismic,

Attribuiti specifici in base al tipo di evento(seismic, fines, maintenance etc.)

Specific Models

As examples, here are represented some specific attributes.


Fines model for the AutoVelox (REPEAT)



Value for example


license plate






Speed Limit



Unit of Measure



Maintenance Model (REPEAT)



Value for example


Company in charge of the work



Kind of work



Description of work



Emergencies Model (ONESHOT)



Value for example


Emergency category

Geophysical, Meteorological, Safety, Security, Fire



Brief description of the emergency


Es. building on fire


Detailed description of the emergency



Urgency of the emergency

Immediate, Expected, Future, Past


Emergency Severity

Extreme, Severe , Moderate, Minor, None


Certainty about the emergency

Observed, Likely, Possible, Unlikely


Number of people involved in the emergency (Observed)



Event Table User Manual

After downloading the node-red-contrib-snap4city-user updated package, to start using Event Table, use the Event Table node available in the S4CDashboard section of the Node-RED library column:

The following image shows an example with various configurations and can be downloaded here [ADD LINK]

Once the flow has been created and deployed in the chosen dashboard, following Widget is available on the dashboard:

To start viewing the data it is necessary to go in the node configuration, in this case in the function node before WidgetEvent:

Here we found::

  • ordering: name of the column;prefix:
  • devices URI prefix;
  • devices: devices to which an event to be displayed is connected
  • actions: actions available to be displayed in the actions column, by default the "pin" action is available and a pin icon is shown;
  • columnsToShow: columns to be displayed in the widget, all non-chosen columns will be available via the drop-down menu

The “columnsToShow” and “ordering” fields must have columns available in the following list:

  • device
  • description
  • severity
  • startDate
  • endDate
  • dateObserved
  • type
  • colorStatus
  • dateStartShow
  • eventKind
  • shownStatus
  • status
  • uniqueEventIdentifier
  • latitude
  • longitude
  • specificData

Now, by clicking the inject node (timestamp) immediately the widget and the loaded events on the dashboard are loaded:

please note that the look and feel of the table would depend on the Style Chosen  the representation here are in editing 

By clicking on the + it will be possible to view the columns excluded from the view, this action is sent to node-red by default as "expanded" when it is opened and "closed" when it is closed:

please note that the look and feel of the table would depend on the Style Chosen  the representation here are in editing 

In the same way, by clicking on the sorting columns, the order change is notified:

By clicking on a certain action in the Actions column is possible to view the following data in the node-red debug area:

Where the following fields are shown:

  • device: The selected device
  • prefix: device URI prefix
  • ordering: current ordering column
  • action: Selected actions in the column “Actions”

If the loaded devices do not comply with the minimum requirements of the general model illustrated above, an error is reported on node-red where the missing values for each device are specified, as shown in the following image.

In this case we can see 3 devices that are not compliant with the requirements and with the respectively missing fields.