Read active alarms over native S7CommPlus
The C# reference driver reads the PLC alarm system natively; python-snap7 has no alarm support. Add reading of the active-alarm list (and the alarm catalog/texts).
Goal
An API like client.read_alarms(language_id=...) returning active alarms: {alarm_id, state (Coming/Going), text, additional texts, timestamp, associated values}.
Approach (mirror the C# Alarming/ package)
- Browse the alarm catalog: EXPLORE the alarm subsystem (
Ids.NativeObjects_theAlarmSubsystem_Rid = 8, already NATIVE_THE_ALARM_SUBSYSTEM_RID in protocol.py) to enumerate alarm definitions and their per-language texts.
- Parse alarm state: decode the CGS/DAI state objects → active alarms. Subtype 2673 =
DAI.Coming, 2677 = DAI.Going.
- Alarm texts: per
LanguageId (AlarmText + AdditionalText1..9, Infotext); resolve associated values into the text.
C# reference (thomas-v2/S7CommPlusDriver, LGPL-3.0) — src/S7CommPlusDriver/Alarming/
BrowseAlarms.cs — enumerate the catalog
AlarmsDai.cs, AlarmsAsCgs.cs — state objects (FromNotificationObject)
AlarmsAlarmTexts.cs, AlarmsAssociatedValues.cs, AlarmsHmiInfo.cs
AlarmsHandler.cs — orchestration
Already in place
Validation
Compare the active set against the alarms an HMI shows as active for the same PLC; the native list should match.
Note: live-pushed alarm notifications belong to the subscriptions issue; this issue is the polled/active-list read.
Read active alarms over native S7CommPlus
The C# reference driver reads the PLC alarm system natively; python-snap7 has no alarm support. Add reading of the active-alarm list (and the alarm catalog/texts).
Goal
An API like
client.read_alarms(language_id=...)returning active alarms:{alarm_id, state (Coming/Going), text, additional texts, timestamp, associated values}.Approach (mirror the C#
Alarming/package)Ids.NativeObjects_theAlarmSubsystem_Rid= 8, alreadyNATIVE_THE_ALARM_SUBSYSTEM_RIDinprotocol.py) to enumerate alarm definitions and their per-language texts.DAI.Coming, 2677 =DAI.Going.LanguageId(AlarmText + AdditionalText1..9, Infotext); resolve associated values into the text.C# reference (thomas-v2/S7CommPlusDriver, LGPL-3.0) —
src/S7CommPlusDriver/Alarming/BrowseAlarms.cs— enumerate the catalogAlarmsDai.cs,AlarmsAsCgs.cs— state objects (FromNotificationObject)AlarmsAlarmTexts.cs,AlarmsAssociatedValues.cs,AlarmsHmiInfo.csAlarmsHandler.cs— orchestrationAlready in place
NATIVE_THE_ALARM_SUBSYSTEM_RID,ALARM_SUBSCRIPTION_*inprotocol.py.Validation
Compare the active set against the alarms an HMI shows as active for the same PLC; the native list should match.
Note: live-pushed alarm notifications belong to the subscriptions issue; this issue is the polled/active-list read.