Skip to content

Commit

Permalink
Specify event source (#283)
Browse files Browse the repository at this point in the history
* Cosmetic

* Improve event msg precision

* Update version

* Set source for temp related events

* Fix
  • Loading branch information
luiscantero authored Jul 6, 2023
1 parent ca99cac commit e025a45
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions src/PluginNodes/Boiler2PluginNodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,26 +245,26 @@ private void InitEvents()
_offSpecEv = new DeviceHealthDiagnosticAlarmTypeState(parent: null);
_maintenanceRequiredEv = new DeviceHealthDiagnosticAlarmTypeState(parent: null);

// Init the events
// Init the events.
_failureEv.Initialize(_plcNodeManager.SystemContext,
source: null,
EventSeverity.Max,
new LocalizedText($"Temperature is above overheat threshold!"));
source: _currentTempDegreesNode,
EventSeverity.Max,
new LocalizedText($"Temperature is above or equal to the overheat threshold!"));

_checkFunctionEv.Initialize(_plcNodeManager.SystemContext,
source: null,
EventSeverity.Low,
new LocalizedText($"Temperature is above target!"));
source: _currentTempDegreesNode,
EventSeverity.Low,
new LocalizedText($"Temperature is above target!"));

_offSpecEv.Initialize(_plcNodeManager.SystemContext,
source: null,
EventSeverity.MediumLow,
new LocalizedText($"Temperature is off spec!"));
source: _currentTempDegreesNode,
EventSeverity.MediumLow,
new LocalizedText($"Temperature is off spec!"));

_maintenanceRequiredEv.Initialize(_plcNodeManager.SystemContext,
source: null,
EventSeverity.Medium,
new LocalizedText($"Maintenance required!"));
source: null,
EventSeverity.Medium,
new LocalizedText($"Maintenance required!"));

_failureEv.SetChildValue(_plcNodeManager.SystemContext, Opc.Ua.BrowseNames.SourceName, value: "Overheated", copy: false);
_checkFunctionEv.SetChildValue(_plcNodeManager.SystemContext, Opc.Ua.BrowseNames.SourceName, value: "Check function", copy: false);
Expand Down
2 changes: 1 addition & 1 deletion tests/Boiler2DeviceHealthEventsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void FiresEvent_Failure()
});
value.Should().ContainKey("/Message")
.WhoseValue.Should().BeOfType<LocalizedText>()
.Which.Text.Should().Be("Temperature is above overheat threshold!");
.Which.Text.Should().Be("Temperature is above or equal to the overheat threshold!");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "2.9.6",
"version": "2.9.7",
"versionHeightOffset": -1,
"publicReleaseRefSpec": [
"^refs/heads/main$",
Expand Down

0 comments on commit e025a45

Please sign in to comment.