Open Source Monitoring and Alarm System for Smart Microgrids Operation and Maintenance Management

: Microgrids are becoming increasingly important for improving the dependability, stability, and quality of the electrical system, as well as for integrating renewable technologies. This paper describes a novel monitoring and alarm system that has been developed to optimize the operation and maintenance of microgrids. The system is unique in that it has been developed using open source software, including Node-RED, Home Assistant, Maria DB, and Telegram, and it allows for easy programming of alarms or warnings. Testing of the system has taken place within the CEDER microgrid and is capable of detecting faults in various components of the microgrid, such as generation units, storage systems, and loads. Upon detecting a fault, the system immediately sends a text message to the mobile phones of the microgrid operator or maintenance crew, enabling them to promptly address the problem. The software can also manage preventive maintenance of the microgrid by sending periodic reminders to the maintenance crew regarding necessary tasks.


Introduction
Currently, the demand for electric energy is increasing every year due to population growth and economic development, resulting in the consumption of electricity becoming a necessity worldwide. Unfortunately, more than 70% of the world's electric energy production comes from non-renewable sources [1]. These non-renewable technologies emit high levels of greenhouse gases and contribute to global warming, which is one of the major problems faced by society today. Nevertheless, renewable electricity generation technologies provide a substitute for conventional energy sources at a cost of generation that is comparable or even more competitive, making them a key tool in achieving a sustainable electric system. The integration of different renewable energy systems into various grids can pose challenges in terms of control and operation due to the varying yields of technologies such as photovoltaic or wind energy [2]. This has a significant impact on the performance of the electric system due to the requirements of the electricity grid.
A microgrid (MG) refers to a cluster of generators, energy storage elements, and loads that function as a unified entity in either a grid-connected or islanded mode relative to the utility grid [3]. MGs have the capacity to enhance the reliability, stability, and quality of the electricity supply [4,5]. They also resolve the primary challenges that arise with the growing adoption of renewable technologies based on non-manageable sources. For this reason, MGs are pivotal in the transition towards a sustainable electricity system. users to view real-time data and issue control commands to the various devices in the MG. The app also sends notifications regarding the MG's performance and can enable the addition or removal of loads and generators, given that it is properly configured. Some SCADA systems have been developed using the software Node-RED as a tool for data processing and visualization [21,22]. In these systems, parameters monitored by several sensors are sent to the Node-RED platform through communication protocols such as Firmata [21] or Modbus [22].
To enhance the accuracy and speed of alarm processing in microgrids, an improved method based on equipment fault prediction and support vector machine learning can be implemented [23]. Creating an alarm system for an MG is a useful tool that can enhance the MG's performance and optimize maintenance tasks, which is crucial for the generators and storage systems [24,25]. Optimized maintenance reduces the cost of energy and increases renewable energy yield, as well as the availability and sturdiness of the MG, because it allows for quick fault detection. In fact, a well-designed alarm system can eliminate the need for continuous surveillance, which saves time, money and contributes to the sustainability of microgrids from an operational and economic perspective.
This paper presents an MG monitoring and alarm system for MG maintenance management based on the following open source software: Home Assistant, Node-RED, Maria DB and Telegram. It offers an easy-to-use interface for programming alarms, making it accessible to users without advanced programming knowledge.
Although other similar systems have been proposed before, their scope has been limited to laboratory systems [22] or small hybrid systems [21]. However, the present approach aims to implement a system for a medium-large microgrid with multiple types of generation units and various energy storage technologies such as lead-acid batteries, LFP batteries, or water pumping storage. Moreover, the implemented system demonstrates the ability to efficiently manage operations and monitor the microgrid from a global perspective. In the paper's second section, the MG where the monitoring and alarm system has been implemented is described, and the third section discusses the system's concept and performance. The fourth section showcases the warnings and alarms that have been successfully put into place in the MG. Lastly, the paper's conclusions are presented in the final section.

CEDER Microgrid Description
The alarm system mentioned in this paper has been implemented at a facility called CEDER, which is owned by CIEMAT and is located in Lubia, Spain. This facility covers a large area of land, with three separate built-up areas spread over 640 hectares.
CEDER has an intelligent microgrid that has been adapted for research purposes. A 1000 kVA electrical transformer is used to lower the voltage of the MG, which is connected to a 45 kV distribution network, in order to power a closed-ring grid operating at 15 kV. There are eight transformation centers within this closed-ring grid that reduce the voltage to 400 V, to which all the generators, storage systems, and loads are connected. The various elements that constitute the CEDER MG are detailed below. A schematic of the communications infrastructure can also be seen in Figure 1, where all generator units, storage system and load measuring equipment are connected to different switches.

Distributed Generation
CEDER has multiple electrical generation facilities spread over a vast area of 640 hectares. Generation units are connected to the MG through a low voltage level (400 V). Based on their renewable nature and ability to be managed, these generation facilities can be categorized into three groups: non-controllable renewable, which includes eight photovoltaic systems with a total capacity of 123.5 kW and four wind turbines with a total capacity of 61.2 kW; controllable renewable, which includes a hydraulic turbine with a total capacity of 50 kW; and non-renewable, which includes a diesel generator with a capacity of 100 kVA.

Distributed Generation
CEDER has multiple electrical generation facilities spread over a vast area of 640 hectares. Generation units are connected to the MG through a low voltage level (400 V). Based on their renewable nature and ability to be managed, these generation facilities can be categorized into three groups: non-controllable renewable, which includes eight photovoltaic systems with a total capacity of 123.5 kW and four wind turbines with a total capacity of 61.2 kW; controllable renewable, which includes a hydraulic turbine with a total capacity of 50 kW; and non-renewable, which includes a diesel generator with a capacity of 100 kVA.

Storage System
Energy storage systems are essential for balancing energy generation and consumption in the CEDER MG. These systems prevent energy overflow into the grid and store excess energy for later use when the load exceeds generation capacity. The microgrid's storage systems consist of hydraulic pumps with a capacity of 7 kW each, water tanks with a volume of 2000 m 3 and 70 m elevation for mechanical storage, and several electrochemical storage systems, including three lead-acid battery facilities and one lithium-ion battery facility:  Lead-acid battery I consists of 120 cells, each with a voltage of 2 volts and a capacity of 1080 Ah. The battery is connected to a 50 kW inverter.  Lead-acid battery II consists of 120 lead-acid battery cells, each with a voltage of 2 V and a capacity of 765 Ah. It is connected to an inverter with a power capacity of 20 kW.

Storage System
Energy storage systems are essential for balancing energy generation and consumption in the CEDER MG. These systems prevent energy overflow into the grid and store excess energy for later use when the load exceeds generation capacity. The microgrid's storage systems consist of hydraulic pumps with a capacity of 7 kW each, water tanks with a volume of 2000 m 3 and 70 m elevation for mechanical storage, and several electrochemical storage systems, including three lead-acid battery facilities and one lithium-ion battery facility: • Lead-acid battery I consists of 120 cells, each with a voltage of 2 volts and a capacity of 1080 Ah. The battery is connected to a 50 kW inverter. • Lead-acid battery II consists of 120 lead-acid battery cells, each with a voltage of 2 V and a capacity of 765 Ah. It is connected to an inverter with a power capacity of 20 kW. • Lead-acid battery III consists of 120 cells with a voltage of 2 V and a capacity of 650 h, with an inverter of 5 kW.

•
The lithium-ion battery is made up of two racks with 14 modules and 14 cells per module, using LFP chemistry. Each cell has a voltage of 3.2 V and a capacity of 50 Ah, and the inverter has a power rating of 30 kW.

Loads
The CEDER MG includes multiple loads that are connected to the low voltage grid. A smart meter is installed at the point where the MG and distribution network meet to measure energy consumption. Furthermore, each transformer center features a grid analyzer, which is capable of measuring both the quality and energy consumption.

Implementation
The monitoring and alarm system consists of three different blocks: a communication block, a data storage block, and a management block. Four open source software programs have been implemented: Node-RED, Home Assistant, MariaDB, and Telegram. A schematic of the programs used and the information flow between them is shown in Figure 2.

Loads
The CEDER MG includes multiple loads that are connected to the low voltage grid. A smart meter is installed at the point where the MG and distribution network meet to measure energy consumption. Furthermore, each transformer center features a grid analyzer, which is capable of measuring both the quality and energy consumption.

Implementation
The monitoring and alarm system consists of three different blocks: a communication block, a data storage block, and a management block. Four open source software programs have been implemented: Node-RED, Home Assistant, MariaDB, and Telegram. A schematic of the programs used and the information flow between them is shown in Fig  The choice of these software (Home Assistant, Node-RED and MariaDB) for the development of the microgrid control system is based on the great compatibility that exists between them, which makes it possible to create a robust system that is easy to implement, and also on economic aspects, given that they are three open source programs and are therefore free. They also have a large community of users who continually develop new capacities, solve problems from previous versions and resolve doubts in forums without the need to contact any technical service for maintenance.
Each software is installed on a Linux virtual machine running under Microsoft's Hyper-V hypervisor, and the programs are mounted on a Storage Spaces Direct (S2D) cluster of two physical servers (running Windows Server 2019) via failover to provide high availability by allowing one of the servers to fail or be shut down for upgrades or computer maintenance. This provides resilience against potential disk failures by having active standby disks and acting on the system by creating Cluster Shared Volume (CSV), where data and virtual machines are available for both servers.
The servers are connected to each other and to the CEDER data network by means of network cards with two 10/25 Gb fiber-optic ports each to provide availability when accessing the CEDER systems through the data processing center (DPC) switches in the event of a port failure at either end and high capacity when migrating resources (such as virtual machines or shared disks from one server to another). The choice of these software (Home Assistant, Node-RED and MariaDB) for the development of the microgrid control system is based on the great compatibility that exists between them, which makes it possible to create a robust system that is easy to implement, and also on economic aspects, given that they are three open source programs and are therefore free. They also have a large community of users who continually develop new capacities, solve problems from previous versions and resolve doubts in forums without the need to contact any technical service for maintenance.
Each software is installed on a Linux virtual machine running under Microsoft's Hyper-V hypervisor, and the programs are mounted on a Storage Spaces Direct (S2D) cluster of two physical servers (running Windows Server 2019) via failover to provide high availability by allowing one of the servers to fail or be shut down for upgrades or computer maintenance. This provides resilience against potential disk failures by having active standby disks and acting on the system by creating Cluster Shared Volume (CSV), where data and virtual machines are available for both servers.
The servers are connected to each other and to the CEDER data network by means of network cards with two 10/25 Gb fiber-optic ports each to provide availability when accessing the CEDER systems through the data processing center (DPC) switches in the event of a port failure at either end and high capacity when migrating resources (such as virtual machines or shared disks from one server to another).
In addition, each server has two power supplies, providing redundancy at the power supply level.
Node-RED is an open source program based on JavaScript that allows the connecting of hardware devices, APIs, and online services. It offers several communication protocols such as Modbus, Hypertext Transfer Protocol (HTTP), Message Queuing Telemetry Transport (MQTT) or Mobile Transport protocols (MTProto) to connect different generation systems, storage units, and loads. Node-RED software provides a browser editor that simplifies the process of connecting flows using multiple nodes.
Modbus is the communication protocol used to monitor the values of all the elements of the microgrid, except for the pumps and valves of the hydraulic system for which http protocol is used. The reading of these values by Node-RED is performed with a sampling rate of 1 data per second.
Home Assistant is a Python-based open source software which is mainly used for home automation but can also be used to monitor and manage MGs. It provides a user-friendly interface for real-time monitoring of multiple MG units, programming management strategies, and setting operating instructions. The software provides a decentralized solution that is accessible from any point within the communication network. Additionally, it can be accessed remotely through a smartphone application.
Home Assistant receives data from Node-RED with a sampling rate of 1 Hz, which allows it to monitor data in real time through its dashboard, and sends it at the same sampling rate to the database in MariaDb for storage.
Telegram is a messaging application and open source software that provides endto-end encrypted calls. It can be utilized in MG management for communication and sending alerts.
MariaDB is an open source relational database based on Structured Query Language (SQL). MariaDB receives data from Home Assistant with a sampling rate of 1 data per second of the different units of generation, storage, and loads that make up the MG and stores them in real time. Using SQL programs running on the Linux virtual machine where the MariaDB database engine is located, fifteen-minute averages are calculated in order to compare the information obtained from the microgrid with that provided by the electricity distribution company in an electricity bill. The data stored are treated and analyzed to develop new energy management strategies in the medium and long term.
It is true that Node-RED is primarily used in the communication block, but its huge potential allows it to be used to program alarms for maintenance tasks in MGs. By integration with Home Assistant and Telegram, Node-RED can use any parameters monitored by Home Assistant as inputs for alarm programming, and it can send text messages to the MG supervisor and maintenance staff via Telegram to inform them of any issues in the MG. This allows maintenance staff to quickly take appropriate measures for its operation or schedule necessary maintenance tasks in a timely manner.
To implement the alarm system, the MG monitoring and alarm system must be developed using Home Assistant [26]. All components of the microgrid, as well as the management system, must be connected to the MG's data network, which is an Ethernet data network in this case. Cybersecurity is a critical aspect of the microgrid's management and control software, given the large number of devices, entry points, and protocols involved, which make it vulnerable to cyber-attacks. The current cybersecurity market lacks the capacity to manage such a large-scale display for the entire power grid accurately, necessitating the development of a security framework to provide a set of defensive measures in the event of network attacks.

Performance
The Node-RED interface provides an easy way to program MG alarms that does not require advanced programming knowledge. Several inputs can be used, as shown in Figure 3, and setting threshold values and conditions allows the microgrid operator to configure alarms. In case of an alarm, the MG staff receive a text message notification via Telegram. The system is customizable to send different alarms to different personnel; the main operator receives all the alarms detected, whereas each member of the maintenance team receives only the alarms for the specific facilities under their responsibility. Additionally, it may be possible to perform some action in the MG unit to automatically solve the detected problem.
An example of a simple alarm configuration is shown in Figure 4. The arrangement of nodes enables the detection of faults in solar plants. This configuration effectively identifies situations where a solar inverter fails to generate energy despite having sufficient solar irradiance to do so. Upon detecting such a fault, the system promptly sends an alarm in the form of a text message.
The initial node, referred to as the "trigger node", verifies the inverter power value. If the power remains at null (zero) for a specific duration, the node triggers a flow that is subsequently transmitted to the next node. To configure this node, it should include the Home Assistant server and specify the name of the entity that needs to be monitored. The second node, "conditional node," verifies whether the measured irradiance is sufficient for power generation. Thus, if the solar irradiance exceeds a certain value, a flow is directed to the third node. The configuration of this node should also involve the Home Assistant server and specify the entity's name that needs to be checked. The third node, "function node", must include the Telegram user ID of the person who is going to receive the alarm and text message. The final node serves as a "Telegram sender node" and facilitates communication between Node-RED and the Telegram messaging platform.
Electronics 2023, 12, x FOR PEER REVIEW 7 of 14 Telegram. The system is customizable to send different alarms to different personnel; the main operator receives all the alarms detected, whereas each member of the maintenance team receives only the alarms for the specific facilities under their responsibility. Additionally, it may be possible to perform some action in the MG unit to automatically solve the detected problem. An example of a simple alarm configuration is shown in Figure 4. The arrangement of nodes enables the detection of faults in solar plants. This configuration effectively identifies situations where a solar inverter fails to generate energy despite having sufficient solar irradiance to do so. Upon detecting such a fault, the system promptly sends an alarm in the form of a text message.
The initial node, referred to as the "trigger node", verifies the inverter power value. If the power remains at null (zero) for a specific duration, the node triggers a flow that is subsequently transmitted to the next node. To configure this node, it should include the Home Assistant server and specify the name of the entity that needs to be monitored. The second node, "conditional node," verifies whether the measured irradiance is sufficient for power generation. Thus, if the solar irradiance exceeds a certain value, a flow is directed to the third node. The configuration of this node should also involve the Home Assistant server and specify the entity's name that needs to be checked. The third node, "function node", must include the Telegram user ID of the person who is going to receive the alarm and text message. The final node serves as a "Telegram sender node" and facilitates communication between Node-RED and the Telegram messaging platform.
Note that the current nodes use a simple configuration. However, it is possible to implement more complex configurations that involve additional input parameters, advanced algorithms for quicker fault detection, or output nodes for performing control activities in the microgrid. Having a well-defined set off alarms is crucial for efficient management and maintenance of a microgrid. Different types of alarms can be programmed based on the specific needs and requirements of the microgrid. Below, the performance of the alarm system and the different types of alarms it generates are presented (see Figure 5). The system can  An example of a simple alarm configuration is shown in Figure 4. The arrangement of nodes enables the detection of faults in solar plants. This configuration effectively identifies situations where a solar inverter fails to generate energy despite having sufficient solar irradiance to do so. Upon detecting such a fault, the system promptly sends an alarm in the form of a text message.
The initial node, referred to as the "trigger node", verifies the inverter power value. If the power remains at null (zero) for a specific duration, the node triggers a flow that is subsequently transmitted to the next node. To configure this node, it should include the Home Assistant server and specify the name of the entity that needs to be monitored. The second node, "conditional node," verifies whether the measured irradiance is sufficient for power generation. Thus, if the solar irradiance exceeds a certain value, a flow is directed to the third node. The configuration of this node should also involve the Home Assistant server and specify the entity's name that needs to be checked. The third node, "function node", must include the Telegram user ID of the person who is going to receive the alarm and text message. The final node serves as a "Telegram sender node" and facilitates communication between Node-RED and the Telegram messaging platform.
Note that the current nodes use a simple configuration. However, it is possible to implement more complex configurations that involve additional input parameters, advanced algorithms for quicker fault detection, or output nodes for performing control activities in the microgrid. Having a well-defined set off alarms is crucial for efficient management and maintenance of a microgrid. Different types of alarms can be programmed based on the specific needs and requirements of the microgrid. Below, the performance of the alarm system and the different types of alarms it generates are presented (see Figure 5). The system can Note that the current nodes use a simple configuration. However, it is possible to implement more complex configurations that involve additional input parameters, advanced algorithms for quicker fault detection, or output nodes for performing control activities in the microgrid.
Having a well-defined set off alarms is crucial for efficient management and maintenance of a microgrid. Different types of alarms can be programmed based on the specific needs and requirements of the microgrid. Below, the performance of the alarm system and the different types of alarms it generates are presented (see Figure 5). The system can send corrective maintenance alarms when a parameter failure occurs that prevents the normal functioning of the microgrid. This type of alarm requires immediate attention and action to restore the proper operation of the microgrid. On the other hand, informative alarms can be used to notify relevant staff about a parameter failure that does not necessarily affect the normal functioning of the microgrid. These alarms are also important as they help in identifying potential issues and planning preventive maintenance tasks.
In addition to corrective and informative alarms, periodic alarms can be set to remind maintenance staff about preventive maintenance tasks. These alarms are triggered at regular intervals and ensure that preventive maintenance tasks are performed on time. If the conditions of the MG are not suitable for maintenance, the system will wait until the conditions are appropriate and then send an alarm message. Overall, having a welldefined set of alarms that differentiates between corrective maintenance, informative, and preventive periodic alarms ensures the efficient management and maintenance of a microgrid.
In addition to corrective and informative alarms, periodic alarms can be set to remind maintenance staff about preventive maintenance tasks. These alarms are triggered at regular intervals and ensure that preventive maintenance tasks are performed on time. If the conditions of the MG are not suitable for maintenance, the system will wait until the conditions are appropriate and then send an alarm message. Overall, having a well-defined set of alarms that differentiates between corrective maintenance, informative, and preventive periodic alarms ensures the efficient management and maintenance of a microgrid. Preventive maintenance alarms are set up in multiple generation and storage units to remind the maintenance crew to perform regular maintenance tasks and prevent breakdowns or premature degradation of the storage system. These alarms may also be programmed to alert the crew when certain conditions allow for performing preventive maintenance tasks. Although these alarms do not impact the MG's usual operation, a maintenance crew member must still go to the location of the unit requiring maintenance. Nevertheless, some of these alarms can be resolved automatically.
Informative alarms are designed to provide valuable information about the performance of the MG to the maintenance crew and operator. They do not necessarily require immediate action but serve as a way to monitor the operation of the microgrid and identify any potential issues or areas for improvement. Examples of informative alarms include notifications about the battery state of charge, renewable energy generation levels, Preventive maintenance alarms are set up in multiple generation and storage units to remind the maintenance crew to perform regular maintenance tasks and prevent breakdowns or premature degradation of the storage system. These alarms may also be programmed to alert the crew when certain conditions allow for performing preventive maintenance tasks. Although these alarms do not impact the MG's usual operation, a maintenance crew member must still go to the location of the unit requiring maintenance. Nevertheless, some of these alarms can be resolved automatically.
Informative alarms are designed to provide valuable information about the performance of the MG to the maintenance crew and operator. They do not necessarily require immediate action but serve as a way to monitor the operation of the microgrid and identify any potential issues or areas for improvement. Examples of informative alarms include notifications about the battery state of charge, renewable energy generation levels, and grid connection status. These alarms can be used to track the overall performance of the microgrid and help identify any trends or patterns that could be indicative of larger issues.
Corrective maintenance alarms are generated when a failure occurs in the MG that requires the attention of the maintenance crew to restore normal operations. These alarms can be triggered by changes in monitored parameters during normal operation or when the generation or storage units begin to operate. In such cases, a maintenance crew member must go to the location of the failure to fix the issue. As an example, Table 1 shows some of the most important corrective alarms, including the causes that have generated the errors, the consequences in the microgrid, and the necessary actions to restore normal operation.

Photovoltaic Modules
Photovoltaic fault Problem with the inverter or the grid PV shutdown Operator must Correct error and start inverter

Wind turbines
Wind turbine fault Problem with the inverter or the grid Wind turbine shutdown Operator must correct error and start inverter

Cybersecurity Apects
CEDER data network is only accessible through a VPN protocol that restricts connections to the network, making it difficult for unauthorized persons to access it from outside the center. All the devices that make up the MG are connected to this internal network (Ethernet), so they cannot be accessed from outside the center. The cybersecurity measures implemented with each software are as follows: Home Assistant: • Password access management and user roles to the interface: Users accessing the interface must identify themselves with a username and password. Each user will be able to access a number of items to be displayed and may or may not control different devices. • Whitelist (IP addresses allowed): Node-RED and MariaDB. Node-RED: • Access to the interface as administrator by password.

•
Establishes connection through credentials with Home Assistant to be able to carry out communications. Node-RED server IP. • Whitelist (IP addresses allowed): Home Assistant. MariaDB: • Access to the schema through privileged user roles • Whitelist (IP addresses allowed): Home Assistant. Telegram: • Whitelist (IP addresses allowed): Node-RED.

Results
The implemented system has successfully programmed 37 alarms over a period of 10 months (see Table 2). These alarms include corrective maintenance alarms, such as those indicating failure in the MG operation, as well as informative alarms providing data about the MG's performance. Additionally, preventive maintenance alarms were programmed to remind maintenance crews of necessary maintenance tasks, some of which could only be performed under specific conditions. The system has proven to be robust and effective in managing alarms and warnings related to MG operation and maintenance. The alarms and warnings were sent to the MG operator or maintenance crew as needed. New optimal tilt angle for PV system Informative 4 Modules thermographic inspection Preventive 1 Inverter thermographic and visual inspection Preventive 2

Wind Energy
Wind turbine failure Corrective 9 Wind speed higher than limit Informative 6 Structure inspection Preventive 1 The continuous monitoring of key parameters allows for fault detection. Below are some examples of the implemented alarms. Figure 6 represents the power output in an inverter facility and the measured irradiance over time. The Node-RED interface processes these parameters and continuously checks both of them. When the irradiance is high enough but the inverter power output is null, the system generates an alarm. It is then possible to observe the moment when the fault has been resolved and the inverter power output returns to normal operation. An analogous situation is presented in Figure 7, illustrating the power output of a wind turbine and the wind speed. When the wind speed is sufficiently high but the wind turbine power output is null, an alarm is automatically generated. Over a required period of time for fixing the problem, the wind turbine restores its normal operation. The continuous monitoring of key parameters allows for fault detection. Below are some examples of the implemented alarms. Figure 6 represents the power output in an inverter facility and the measured irradiance over time. The Node-RED interface processes these parameters and continuously checks both of them. When the irradiance is high enough but the inverter power output is null, the system generates an alarm. It is then possible to observe the moment when the fault has been resolved and the inverter power output returns to normal operation. An analogous situation is presented in Figure  7, illustrating the power output of a wind turbine and the wind speed. When the wind speed is sufficiently high but the wind turbine power output is null, an alarm is automatically generated. Over a required period of time for fixing the problem, the wind turbine restores its normal operation.   Finally, Figure 8 displays the level of the upper water tank and power flow in water turbines and pumps. When the water turbine is operating, the level of the upper tank decreases until it reaches a predefined minimum value, at which point an alarm is triggered and the water turbine is shut down. Additionally, the system is capable of monitoring the water level in the lower tank. If the level is low, the pumps are turned off to prevent them from operating under vacuum conditions, which could potentially cause pump malfunctions.   Finally, Figure 8 displays the level of the upper water tank and power flow in water turbines and pumps. When the water turbine is operating, the level of the upper tank decreases until it reaches a predefined minimum value, at which point an alarm is triggered and the water turbine is shut down. Additionally, the system is capable of monitoring the water level in the lower tank. If the level is low, the pumps are turned off to prevent them from operating under vacuum conditions, which could potentially cause pump malfunctions.

Discussion
The present approach highlights the feasibility of creating an alarm and warning system using Node-RED, Home Assistant, Maria DB, and Telegram to enhance the performance of an MG and streamline maintenance tasks for its components. The system is capable of identifying failures in various units, including generation, storage, and loads. This ensures the maximum utilization of renewable energy and improves the reliability of the MG. Additionally, the system is capable of handling the preventative maintenance of the MG facilities equipment by alerting the maintenance crew about periodic maintenance tasks. The system can also be programmed to generate informative alarms that may be useful for the MG operator or maintenance crew. The system is built using open source software, making it an affordable solution for most MGs. Furthermore, the Node-RED browser editor allows for the creation of several alarms without requiring advanced programming knowledge. The implemented system has been shown to be a robust solution with the potential to manage several alarms in an MG efficiently.
The implementation of the presented system in the CEDER MG has significantly improved its performance. Throughout the duration of testing, the system has effectively preserved its stability without encountering any issues. It has consistently exhibited dependable performance, demonstrating its capacity to operate without substantial stability concerns. A total of 37 alarms have been programmed, including preventive, informative, and corrective alarms. The programmed corrective alarms have enabled quick detection of faults in the several units that make up the MG. This leads to an increase in the amount of energy produced and a decrease in the amount of energy consumed by the distribution network. Informative alarms have provided valuable insights into the MG's performance for the operator. The preventive alarms have facilitated an efficient preventive maintenance plan, thus reducing breakdowns of MG units and maximizing the components' useful life. Additionally, the alarm system has eliminated the need for continuous monitoring

Discussion
The present approach highlights the feasibility of creating an alarm and warning system using Node-RED, Home Assistant, Maria DB, and Telegram to enhance the performance of an MG and streamline maintenance tasks for its components. The system is capable of identifying failures in various units, including generation, storage, and loads. This ensures the maximum utilization of renewable energy and improves the reliability of the MG. Additionally, the system is capable of handling the preventative maintenance of the MG facilities equipment by alerting the maintenance crew about periodic maintenance tasks. The system can also be programmed to generate informative alarms that may be useful for the MG operator or maintenance crew. The system is built using open source software, making it an affordable solution for most MGs. Furthermore, the Node-RED browser editor allows for the creation of several alarms without requiring advanced programming knowledge. The implemented system has been shown to be a robust solution with the potential to manage several alarms in an MG efficiently.
The implementation of the presented system in the CEDER MG has significantly improved its performance. Throughout the duration of testing, the system has effectively preserved its stability without encountering any issues. It has consistently exhibited dependable performance, demonstrating its capacity to operate without substantial stability concerns. A total of 37 alarms have been programmed, including preventive, informative, and corrective alarms. The programmed corrective alarms have enabled quick detection of faults in the several units that make up the MG. This leads to an increase in the amount of energy produced and a decrease in the amount of energy consumed by the distribution network. Informative alarms have provided valuable insights into the MG's performance for the operator. The preventive alarms have facilitated an efficient preventive maintenance plan, thus reducing breakdowns of MG units and maximizing the components' useful life. Additionally, the alarm system has eliminated the need for continuous monitoring and saved time for the microgrid operator. The mentioned advantages can also be achieved with any SCADA system. However, the presented approach has the novelty of using a set of open source software programs as well as managing the operation and monitoring of a large system including all the maintenance tasks that must be performed in an MG.
Future work should focus on improving cybersecurity. To this end, it would be desirable to encrypt the data in the database by recording. This would reduce the impact of a possible attack. In the event that an attacker manages to enter the system and access the data, data encryption would be recorded so that no information could be obtained from them. It would also be convenient to encrypt and decrypt the data in SQL using the AES (Advanced Encryption Standard) algorithm.