Skip to main content

A context-based building security alarm through power and sensors analysis


The great technology advance over the last few years has led to a great increase in the quantity and availability of information. Having the means to obtain the required information, the main challenge is to make the best use of such information, by extracting as much knowledge as possible. The building security management process is no exception. With the emergence of IoT and the mature approach of SCADA, it is possible to guarantee a higher level of security, by analyzing the data that they are able to provide. However, a careful analysis is required to make the system able to correctly distinguish a normal situation from an undesired one. A given situation can be normal in a given context but reason for alarm in another. For this purpose, this paper presents a building security alarm enhanced with context-awareness which allows it to correctly identify an undesired situation in a given context.


Nowadays, the amount of generated information is increasing as result of the current technological advance. The emergence of the decentralized concept of IoT (Internet of Things) has considerably increased the number of participants in a computer network, giving life to the most varied objects (Lin et al. 2017). This way they are able to sense, think and act, having a very important role in the environment to which they belong. Nonetheless, this is not the first solution for the control of a given environment. The use of SCADA (Supervisory Control and Data Acquisition) with PLCs (Programmable Logic Controller) has been a key solution over the past thirty-five years (Boyer 2009; Vale et al. 2013). This centralized approach allows the partial or total control of a process (e.g. residential automation). The SCADA system may include interfaces to IoT systems.

The increase in information about an environment and its new interaction medium allows a wide range of possibilities to explore (smart homes, smart cities, smart grids, etc.), which can present features like energy management (energy saving and demand response events), increased security and comfort, asset tracking, etc.) (Lin et al. 2017). With a careful analysis of the generated data it is possible to learn new information that could revolutionize the operation of a given environment. One of the main applications is the security management of a given environment (Minoli et al. 2017). Through real-time analysis of the collected data by the various sensors and analyzers, it is possible to alert the interested parties about unexpected or undesired situations that are happening, or that may happen in the immediate future if no action is taken. By means of sensors of temperature, CO2, air quality, humidity, among others, it is possible to generate alarms for values that are outside the normal interval. In addition, energy consumption can play a very important role. Comparing real-time consumption with consumption profiles, identified in historical data, can identify equipment failures, unnecessarily connected equipment, and the presence of unauthorized persons. However, the success of this application depends greatly on the ability of the system to identify the different contexts of consumption existing in the environment in matter. For example, in a company that only works on weekdays, the system should not identify equipment failures over the weekend, since the low consumption is expected in this context.

This paper presents a system that implements the identified characteristics in order to guarantee the safety of a building by performing a context-aware real-time analysis of its power consumption and sensed data.

Main purpose

This paper presents a context-based building security alarm through power and sensors analysis. This system is responsible for the real-time monitoring of a building in order to generate alarms whenever abnormal values are detected within a given context. The Fig. 1 shows the main process of this system.

Fig. 1
figure 1

System’s main process

As shown in Fig. 1, the system analyzes IoT environmental sensors and power consumption analyzers, embedded in a SCADA system. In the case of environmental sensors, the system confronts the current values with the predefined rules, which indicate the ranges of values of each alarm level. These rules are also context dependent, since the read values may be normal under certain conditions (e.g., weather conditions and number of people). Each sensor can have particular rules depending on its location (e.g., a temperature sensor in a servers room has alarm triggers for lower temperatures than normal rooms, because the room must be kept cool). In relation to the consumption analyzers, the system confronts the current values with the consumption profile present in the data history for the context in matter. This profile allows to know the minimum and maximum consumption expected in this context, with a small margin of tolerance in order to ignore small variations that normally occur on a daily basis.

When comparing the instant consumption with the previously generated context profiles, it is important to aggregate the instant data in a higher level of granularity (e.g. last minute), which reduces its variable nature and therefore guarantees more solid data, avoiding misleading alarms.

The detection of contexts is performed by separating historical data from each sensor/analyzer into the number of groups that allows to identify the most relevant contexts. For this purpose, clustering is applied, a data mining technique that allows the aggregation of data in a certain number of groups, through the use of k-means algorithm provided by the R tool (R-Project 2018). This analysis is performed twice: one to detect the different types of days (e.g. weekend and weekday) and other to detect the different types of periods of the day (e.g. peak and off peak). By combining both analysis, it is possible to obtain the different contexts (e.g., weekday/weekend peak/off-peak). This analysis has to be performed regularly in order to capture new contexts that may arise. During monitoring, the system identifies the current context, in which each sensor/analyzer are, and confronts its current profile with the profile of that same context. The identification of the current context makes use of classification techniques to select the context, among the different contexts previously detected in historical data, that best represents the present moment. For this purpose, the systems uses the C5.0 algorithm provided by the C50 package of R (CRAN 2018).

The generated alarms are displayed in the graphical interface of the system and sent by email to the responsible parties in order for them to take the necessary actions.

Building security alarm

The developed alarm system contains a graphical interface for checking its current status, where the instantaneous values of each sensor/analyzer can be consulted as well as the existence of any alarm, as can be seen in Fig. 2.

Fig. 2
figure 2

System’s graphical interface

As it can be observed in Fig. 2, the GECAD laboratory (GECAD 2018), where the system is installed, contains several types of environmental sensors (CO2, humidity, light intensity, internal and external temperature, and VOC) and doors status sensors. In addition, the building also has several power consumption analyzers of different types of resources (HVACs, lights and sockets) installed in each of the areas covered by the system.

A rectangle is shown next to each sensor/analyzer, with its current value, displayed in a color corresponding to the alarm level (green in the absence of alarms, and yellow, orange and red depending on the severity of the generated alarms). In addition to the color change, in the occurrence of an alarm, an icon of the same color is also displayed that, when clicked, presents to the user the same message sent by email, with detailed information of the occurrence.

The current profile of each sensor/analyzer can be consulted by clicking on the corresponding rectangle or information icon, which presents the user with a popup with a chart. The chart shows the values recorded from a few hours earlier as well as the current context profile (from a few hours earlier to a few hours later). In this way it is possible to check the range of values considered normal and the proximity of the current value of an alarm situation. In the case of consumption analyzers, the minimum, average and maximum consumption value over time is displayed. The environmental sensors present the various levels of alarm (e.g., CO2 can have a level 1 alarm for values between 1500 and 3000, level 2 alarm between 3000 and 5000 and level 3 for higher than 5000) and the door status sensors present the most frequent state in the current context (either open or closed).


This paper presents a solution that allows a building to take advantage of its energy analyzers and sensors to increase its security. For that purpose, the presented system has a key feature of context awareness which allows it to intelligently adapt and better integrate itself to the environment where it is operating.



Internet of Things


Programmable Logic Controller


Supervisory Control and Data Acquisition


Download references


Not applicable.


This work has received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Sklodowska-Curie grant agreement No 641794 (project DREAM-GO) and from FEDER Funds through COMPETE program and from National Funds through FCT under the project UID/EEA/00760/2013.

Availability of data and materials

Not applicable.

About this supplement

This article has been published as part of Energy Informatics Volume 1 Supplement 1, 2018: Proceedings of the 7th DACH+ Conference on Energy Informatics. The full contents of the supplement are available online at

Author information

Authors and Affiliations



FS conceived and developed the proposed system and wrote the paper. GS and IP contributed in the conception of the system, draft and review of the manuscript. ZV participated in the system’s conception and project coordination and helped to draft the manuscript. All authors read and approved the final manuscript.

Corresponding author

Correspondence to Francisco Silva.

Ethics declarations

Competing interests

The authors declare that they have no competing interests.

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (, which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Silva, F., Santos, G., Praça, I. et al. A context-based building security alarm through power and sensors analysis. Energy Inform 1 (Suppl 1), 41 (2018).

Download citation

  • Published:

  • DOI: