---
title: "Read and reset robot alarms from a PC"
description: "Read the active alarms of Fanuc, Yaskawa, Universal Robots and ABB controllers with one code, and the history and the reset where the brand has them: what each brand reads and resets, C# and Python examples."
---

# Read and reset robot alarms from a PC

This article shows how to read the active alarms of Fanuc, Yaskawa, Universal Robots and ABB controllers from a PC and reset them, with one code in C# or Python. What an alarm and a reset are depends on the controller: the table at the end gives the details of each brand.

The alarms of a Stäubli controller are not in the common API, and some brands have no reset or no history: the support table below shows it.

## Prerequisites

- UnderAutomation.Robotics in your project. See [Get started with .NET](/robotics/documentation/get-started-net) or [Get started with Python](/robotics/documentation/get-started-python).
- The connection settings of each controller. See [Connect to your robot](/robotics/documentation/connect).
- The license of each brand you connect, or the 30 day trial. See [Licensing](/robotics/documentation/license).
- A reset from a PC acknowledges alarms that an operator would acknowledge at the pendant. Find the cause of the alarm before you reset it. On some controllers, the reset also brings back the servo power.

## Brand support

Each cell gives the protocol that the method uses on this brand, in the default order. The table is generated from the route data of the library. "Not available" means that the brand has no route for the method: the call throws `FeatureNotSupportedException`, and `IsAvailable` returns false before the call.

Routes of each method in the default order. The first route is used, the next ones are fallbacks. (manual) marks a route that you enable yourself.

| Method | Fanuc | Yaskawa | Universal Robots | ABB | Stäubli |
| --- | --- | --- | --- | --- | --- |
| Alarm.ReadActive | SNPX, FTP | High Speed Ethernet Server, Ethernet Server | Primary Interface (Primary), Dashboard Server | Robot Web Services | Not available |
| Alarm.ReadHistory | SNPX, FTP | Not available | Not available | Robot Web Services | Not available |
| Alarm.Reset | SNPX, CGTP (CgtpKcl), Telnet | High Speed Ethernet Server, Ethernet Server | Dashboard Server | Not available | Not available |
| Alarm | **3 of 3** | **2 of 3** | **2 of 3** | **2 of 3** | **0 of 3** |

## Example

### Read and reset the alarms of each controller of a cell

The example connects to the controllers of a cell one after the other. It prints the active alarms, then resets them on the brands that have a reset and reads what is left. `ReadActive` returns a `ControllerAlarm` per alarm, with its code, its severity and its message.

`IsAvailable(AlarmFeature.Reset)` is false on a brand without a reset route: the example then only reads the alarms.

**C# : AlarmAllBrands**
```csharp
using UnderAutomation.Robotics.Controllers;

public class AlarmAllBrands
{
    static void Main()
    {
        /**/
        // One line per controller: only the brand and the address change
        var cell = new[]
        {
            (Brand: "fanuc", Address: "192.168.0.1"),
            (Brand: "yaskawa", Address: "192.168.0.2"),
            (Brand: "universalrobots", Address: "192.168.0.3"),
            (Brand: "abb", Address: "192.168.125.1"),
        };

        foreach (var controller in cell)
        {
            // The same code for each controller of this cell
            RobotController robot = new RobotController();
            robot.Connect(RobotConnectionParameters.Create(controller.Brand, controller.Address));

            foreach (ControllerAlarm alarm in robot.Alarm.ReadActive())
                Console.WriteLine($"{robot.Brand} {alarm.Code} {alarm.Severity}: {alarm.Message}");

            // False on a brand that has no reset route
            if (robot.Alarm.IsAvailable(AlarmFeature.Reset))
            {
                robot.Alarm.Reset();
                Console.WriteLine($"{robot.Brand}: {robot.Alarm.ReadActive().Length} alarm(s) left");
            }

            robot.Disconnect();
        }
        /**/
    }
}
```

**Python : AlarmAllBrands**
```python
from underautomation.robotics.controllers.robot_controller import RobotController
from underautomation.robotics.controllers.robot_connection_parameters import RobotConnectionParameters
from underautomation.robotics.controllers.alarm_feature import AlarmFeature

##
# One line per controller: only the brand and the address change
cell = [
    ("fanuc", "192.168.0.1"),
    ("yaskawa", "192.168.0.2"),
    ("universalrobots", "192.168.0.3"),
    ("abb", "192.168.125.1"),
]

for brand, address in cell:
    # The same code for each controller of this cell
    robot = RobotController()
    robot.connect(RobotConnectionParameters.create(brand, address, ""))

    for alarm in robot.alarm.read_active():
        print(f"{robot.brand.name} {alarm.code} {alarm.severity.name}: {alarm.message}")

    # False on a brand that has no reset route
    if robot.alarm.is_available(AlarmFeature.Reset):
        robot.alarm.reset()
        print(f"{robot.brand.name}: {len(robot.alarm.read_active())} alarm(s) left")

    robot.disconnect()
##
```

In Python, the names are in snake_case: `robot.alarm.read_active()`, `robot.alarm.reset()`, `robot.alarm.is_available(...)`.

### Read the history

`ReadHistory(count)` returns the last alarms of the history, the most recent first, on the brands that have a history. Check `HasDate` before you use `Date`: some controllers do not give it.

**C# : AlarmRead**
```csharp
using UnderAutomation.Robotics.Controllers;

public class AlarmRead
{
    static void Main()
    {
        RobotController robot = new RobotController();
        robot.Connect(RobotConnectionParameters.Create("fanuc", "192.168.0.1"));

        /**/
        foreach (ControllerAlarm alarm in robot.Alarm.ReadActive())
            Console.WriteLine($"{alarm.Code} {alarm.Severity}: {alarm.Message}");

        // The last 10 alarms
        foreach (ControllerAlarm alarm in robot.Alarm.ReadHistory(10))
            Console.WriteLine(alarm.HasDate ? $"{alarm.Date}: {alarm.Message}" : alarm.Message);
        /**/

        robot.Disconnect();
    }
}
```

**Python : AlarmRead**
```python
from underautomation.robotics.controllers.robot_controller import RobotController
from underautomation.robotics.controllers.robot_connection_parameters import RobotConnectionParameters

robot = RobotController()
robot.connect(RobotConnectionParameters.create("fanuc", "192.168.0.1", ""))

##
for alarm in robot.alarm.read_active():
    print(f"{alarm.code} {alarm.severity.name}: {alarm.message}")

# The last 10 alarms
for alarm in robot.alarm.read_history(10):
    print(f"{alarm.date}: {alarm.message}" if alarm.has_date else alarm.message)
##

robot.disconnect()
```

## What changes from one brand to another

The code does not change. The content of an alarm and the effect of a reset depend on the controller.

| Brand | Active alarms | History | Reset | Brand article |
| --- | --- | --- | --- | --- |
| Fanuc | The active alarms of the alarm log. | The alarm log. | Resets the controller: it clears the alarms that can be cleared and brings back the servo power when the safety chain is closed. | [Reset an alarm remotely](/fanuc/documentation/how-to-reset-fanuc-alarm-remotely) |
| Yaskawa | The active alarms. | Not available | Resets the alarms. | [Read and reset alarms](/yaskawa/documentation/how-to-read-reset-alarms) |
| Universal Robots | The protective stop, the emergency stop and the safety status. | Not available | Closes the popups, then unlocks the protective stop when the robot is in protective stop. | [Read and reset alarms](/universal-robots/documentation/how-to-read-reset-alarms) |
| ABB | The guard stop, the emergency stop and the system failure of the controller state. | The event log of the controller. | Not available | [Event log](/abb/documentation/rws-elog) |
| Stäubli | Not available | Not available | Not available | |

`AlarmPresent` of the state tells that an alarm is active without reading the list. See [Monitor the state of a robot controller](/robotics/documentation/how-to-monitor-state).

## Errors

- `FeatureNotSupportedException`: the brand has no route for the method, for example `Reset` on ABB.
- `RouteUnavailableException`: the method has routes, but none can be used, for example because the protocol did not answer at the connection.
- `ControllerRefusedException`: the controller received the reset and refused it.
- `RobotControllerException`: the route failed. Its inner exception is the exception of the brand SDK.

The page [Errors](/robotics/documentation/errors) explains each exception.

## What to read next

- [Alarm](/robotics/documentation/alarm): every method of the Alarm service and the `ControllerAlarm` type.
- [Start, stop and select a robot program](/robotics/documentation/how-to-run-program): start the program again after the reset.
- [Monitor the state of a robot controller](/robotics/documentation/how-to-monitor-state): follow the controllers of a cell.