Skip to content

Read active alarms over native S7CommPlus #5

@ale-rinaldi

Description

@ale-rinaldi

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)

  1. 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.
  2. Parse alarm state: decode the CGS/DAI state objects → active alarms. Subtype 2673 = DAI.Coming, 2677 = DAI.Going.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions