diff --git a/src/Client/ZB.MOM.WW.OtOpcUa.Client.CLI/Commands/AlarmsCommand.cs b/src/Client/ZB.MOM.WW.OtOpcUa.Client.CLI/Commands/AlarmsCommand.cs
index 401fe121..77a48c68 100644
--- a/src/Client/ZB.MOM.WW.OtOpcUa.Client.CLI/Commands/AlarmsCommand.cs
+++ b/src/Client/ZB.MOM.WW.OtOpcUa.Client.CLI/Commands/AlarmsCommand.cs
@@ -79,6 +79,11 @@ public class AlarmsCommand : CommandBase
if (!string.IsNullOrEmpty(e.Message))
outputChannel.Writer.TryWrite($" Message: {e.Message}");
outputChannel.Writer.TryWrite($" Retain: {e.Retain}");
+ // `ack` needs both of these and nothing else in the CLI surfaces them.
+ if (!string.IsNullOrEmpty(e.ConditionNodeId))
+ outputChannel.Writer.TryWrite($" ConditionNodeId: {e.ConditionNodeId}");
+ if (e.EventId is { Length: > 0 })
+ outputChannel.Writer.TryWrite($" EventId: {Convert.ToHexString(e.EventId)}");
outputChannel.Writer.TryWrite(string.Empty);
}
catch
diff --git a/tests/Client/ZB.MOM.WW.OtOpcUa.Client.CLI.Tests/AlarmsCommandTests.cs b/tests/Client/ZB.MOM.WW.OtOpcUa.Client.CLI.Tests/AlarmsCommandTests.cs
index 38524913..fb886417 100644
--- a/tests/Client/ZB.MOM.WW.OtOpcUa.Client.CLI.Tests/AlarmsCommandTests.cs
+++ b/tests/Client/ZB.MOM.WW.OtOpcUa.Client.CLI.Tests/AlarmsCommandTests.cs
@@ -82,6 +82,30 @@ public class AlarmsCommandTests
output.ShouldContain("Condition refresh requested.");
}
+ /// The printed alarm carries the ConditionNodeId and EventId that `ack` requires (hex round-trips).
+ [Fact]
+ public async Task Execute_PrintsConditionNodeIdAndEventId_ForAck()
+ {
+ var fakeService = new FakeOpcUaClientService();
+ var factory = new FakeOpcUaClientServiceFactory(fakeService);
+ var command = new AlarmsCommand(factory) { Url = "opc.tcp://localhost:4840" };
+
+ using var console = TestConsoleHelper.CreateConsole();
+ var task = Task.Run(async () => { await command.ExecuteAsync(console); });
+
+ await fakeService.SubscribeAlarmsInvoked.WaitAsync(TimeSpan.FromSeconds(10));
+ fakeService.RaiseAlarmEvent(new Client.Shared.Models.AlarmEventArgs(
+ "src", "cond", 500, "msg", true, true, false, DateTime.UtcNow,
+ eventId: [0xAB, 0x01, 0xFF], conditionNodeId: "ns=2;s=Plant/cond"));
+ await Task.Delay(500);
+ console.RequestCancellation();
+ await task;
+
+ var output = TestConsoleHelper.GetOutput(console);
+ output.ShouldContain("ConditionNodeId: ns=2;s=Plant/cond");
+ output.ShouldContain("EventId: AB01FF");
+ }
+
/// Verifies that refresh failure prints error.
[Fact]
public async Task Execute_RefreshFailure_PrintsError()