Skip to content

Commit 636f1f5

Browse files
muenchrisChris MuenchChris Muench
authored
December 2024 (#64)
* Logger improvements * OPC UA To latest nugets; new ConsoleLogger and updates to Text Logger * text logger start message * CMyC update with new Energy Model; Fix for pssible crash in rules action * sln update * fix for cmc refrerence and opcua * Nuget Updates * SQL Plugin update * update sql * Logger Update * Newtonsoft bumped to 13.0.2 * Fix for crash in VisitorLog if NMI is disabled * Fix for discord logger * New NMI Editor for NMI Element in V-Things * Removed temp NMIEditor * Log Only support for Rules Engine; Rules Event support for Discord Logger ; Proper Disconnect management with AutoConnect on MQTT Sender * new System Clock for Rules engine to use for scheduled rules * Todo Removed * Plugin Cleanup * Rule Code Cleanup * Rules Engine Code Cleanup * Rules Engine Code Cleanup * Packager Update * Added packager to solution * Code Cleanup and removed depreciaed methods Rules Engine now supports Start/End Time and Sunrise Sunset * Modbus fix for int16 * Latest Nuget Versions * Removal of obsolete code * Fix for endless loop on insert retries * latest nugets * OPC UA Client to latest .NET SDK * Updated packager * update .net to 8 * API Fix * project fix * license fix * Categories added for store * Categories for Plugins * gitingore * New AzureSign CodeSigning FIx for Prometheus * Plugin Cleanup * latest cde * Removed AzureSign Folder * signme update * Signme fix * Updated Nugets * ready for NetStd 2.1 * Update to .NET 2.1 * Packer update * Set CDE Min Versions to 6.104 * build targets * Fix for VThings dependencies * Update dotnetcore.yml * Sln update * cde update * Modbus fix * copyrght updt * TargetThing for Modbus Reads * latest nuget * automation * New option for tagert things to set modbus values * modbus fox * Modernize Modbus RTU Watchdog for Modbus * modbus watchdog improvements * log entries * Fix for label * latest nugets * packaging * nuget update * logger update * nuget updates --------- Co-authored-by: Chris Muench <chris.muench@live.com> Co-authored-by: Chris Muench <muenchris@c-labs.com> Co-authored-by: Chris Muench <chris@hyviva.com>
1 parent f90b23d commit 636f1f5

File tree

12 files changed

+208
-89
lines changed

12 files changed

+208
-89
lines changed

.github/workflows/dotnetcore.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ jobs:
2727
- uses: actions/checkout@v2
2828

2929
- name: Setup Python
30-
uses: actions/setup-python@v2
30+
uses: actions/setup-python@v4
3131
with:
3232
python-version: '3.x'
3333

3434
- name: Setup .NET Core
35-
uses: actions/setup-dotnet@v1
35+
uses: actions/setup-dotnet@v4
3636
with:
3737
dotnet-version: |
3838
8.0.x
@@ -67,7 +67,7 @@ jobs:
6767
echo $envUpdate | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
6868
6969
- name: Install AzureSignTool
70-
run: dotnet tool install --global AzureSignTool
70+
run: dotnet tool install --global --version 5.0.0 AzureSignTool
7171

7272
- name: Enable code signing for build
7373
run: |
@@ -94,7 +94,7 @@ jobs:
9494
shell: cmd
9595

9696
- name: Upload artifacts
97-
uses: actions/upload-artifact@v1
97+
uses: actions/upload-artifact@v4
9898
with:
9999
name: CDEPlugins
100100
path: ./artifacts

BuildTools/cdePackager/C-DEngine.dll

21 KB
Binary file not shown.

src/040 - C-MyComputer/C-DMyComputer (PC)/C-DMyComputer.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
<PackageReference Include="cdeEnergyContractsShared" Version="6.*-*" />
3636
<PackageReference Include="cdeSensorTemplateShared" Version="6.*-*" />
3737
<PackageReference Include="System.Management">
38-
<Version>8.0.0</Version>
38+
<Version>9.0.0</Version>
3939
</PackageReference>
4040
<PackageReference Include="System.Diagnostics.PerformanceCounter">
41-
<Version>8.0.0</Version>
41+
<Version>9.0.0</Version>
4242
</PackageReference>
4343
</ItemGroup>
4444

src/078 - CDMyOPCUAClient/CDMyOPCUAClient/CDMyOPCUAClient.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
<PackageReference Include="cdeCommonMessageContractsShared" Version="6.*-*" IncludeAssets="ContentFiles" />
4444
<PackageReference Include="cdeOPCUAClientContractsShared" Version="6.*-*" IncludeAssets="ContentFiles" />
4545
<PackageReference Include="cdeThingMatcherShared" Version="6.*-*" IncludeAssets="ContentFiles" />
46-
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client" Version="1.5.374.27" />
47-
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.27" />
48-
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core" Version="1.5.374.27" />
46+
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client" Version="1.5.374.158" />
47+
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.158" />
48+
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core" Version="1.5.374.158" />
4949
</ItemGroup>
5050

5151
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

src/123 - CDMyModbus/CDMyModbus/CDMyModbus.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
<ItemGroup>
3939
<PackageReference Include="C-DEngine" Version="6.*-*" />
40-
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
40+
<PackageReference Include="System.IO.Ports" Version="9.0.0" />
4141
</ItemGroup>
4242

4343
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using nsCDEngine.BaseClasses;
2+
using nsCDEngine.Engines;
3+
using nsCDEngine.Engines.NMIService;
4+
using nsCDEngine.Engines.ThingService;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Text;
8+
using CU = nsCDEngine.BaseClasses.TheCommonUtils;
9+
using NMI = nsCDEngine.Engines.NMIService.TheNMIEngine;
10+
using TT = nsCDEngine.Engines.ThingService.TheThing;
11+
12+
namespace CDMyModbus.ViewModel
13+
{
14+
public class ModbusBase : TheThingBase
15+
{
16+
17+
[ConfigProperty]
18+
public Guid TargetThing
19+
{
20+
get { return TT.MemberGetSafePropertyGuid(MyBaseThing); }
21+
set { TT.MemberSetSafePropertyGuid(MyBaseThing, value); }
22+
}
23+
24+
protected TheFieldInfo AddThingTarget(TheFormInfo pForm, int StartFld, int ParentFld=1)
25+
{
26+
return NMI.AddSmartControl(MyBaseThing, pForm, eFieldType.ThingPicker, StartFld, 2, 0, "Target Thing", nameof(TargetThing), new nmiCtrlThingPicker() { ParentFld=ParentFld });
27+
}
28+
29+
protected void PushProperties(Dictionary<string, object> dict, DateTimeOffset timestamp)
30+
{
31+
32+
MyBaseThing.SetProperties(dict, timestamp);
33+
if (TargetThing != Guid.Empty)
34+
{
35+
var t = TheThingRegistry.GetThingByMID(TargetThing);
36+
if (t != null)
37+
t.SetProperties(dict, timestamp);
38+
else
39+
SetMessage("Target Thing not found", DateTimeOffset.Now, 0, eMsgLevel.l2_Warning);
40+
}
41+
}
42+
}
43+
}

src/123 - CDMyModbus/CDMyModbus/ViewModel/ModbusRTUDevice.cs

Lines changed: 139 additions & 69 deletions
Large diffs are not rendered by default.

src/123 - CDMyModbus/CDMyModbus/ViewModel/ModbusTCPDevice.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//
33
// SPDX-License-Identifier: MPL-2.0
44

5+
using CDMyModbus.ViewModel;
56
using Modbus.Device;
67
using NModbusExt.Config;
78
using NModbusExt.DataTypes;
@@ -21,7 +22,7 @@
2122
namespace Modbus
2223
{
2324
[DeviceType(DeviceType = eModbusType.ModbusTCPDevice, Description = "Represents an Modbus TCP connection", Capabilities = new[] { eThingCaps.ConfigManagement })]
24-
public class ModbusTCPDevice : TheThingBase
25+
public class ModbusTCPDevice : ModbusBase
2526
{
2627
[ConfigProperty]
2728
bool AutoConnect
@@ -90,6 +91,13 @@ public ModbusTCPDevice(TheThing tBaseThing, ICDEPlugin pPluginBase, DeviceDescri
9091
MyBaseThing.AddCapability(eThingCaps.SensorProvider);
9192
}
9293

94+
public override cdeP SetProperty(string pName, object pValue)
95+
{
96+
var pr = base.SetProperty(pName, pValue);
97+
sinkPChanged(pr);
98+
return pr;
99+
}
100+
93101
public void sinkUpdated(StoreEventArgs e)
94102
{
95103
SetupModbusProperties(true, null);
@@ -296,7 +304,7 @@ public override bool CreateUX()
296304
TheNMIEngine.AddSmartControl(MyBaseThing, MyModConnectForm, eFieldType.Number, 250, 2, 0, "Polling Interval", nameof(Interval), new nmiCtrlNumber() { TileWidth = 3, MinValue = 100, ParentFld = 200 });
297305
TheNMIEngine.AddSmartControl(MyBaseThing, MyModConnectForm, eFieldType.SingleCheck, 260, 2, 0, "Keep Open", nameof(KeepOpen), new nmiCtrlSingleEnded() { TileWidth = 3, ParentFld = 200 });
298306
TheNMIEngine.AddSmartControl(MyBaseThing, MyModConnectForm, eFieldType.ComboBox, 270, 2, 0, "Address Type", nameof(ConnectionType), new nmiCtrlComboBox() { NoTE = true, Options = "Read Coils:1;Read Input:2;Holding Registers:3;Input Register:4;Read Multiple Register:23", DefaultValue = "3", TileWidth = 6, ParentFld = 200 });
299-
307+
AddThingTarget(MyModConnectForm, 280, 271);
300308

301309
////METHODS Form
302310
MyFldMapperTable = new TheFormInfo(TheThing.GetSafeThingGuid(MyBaseThing, "FLDMAP"), eEngineName.NMIService, "Field Mapper", $"MBFLDS{MyBaseThing.ID}") { AddButtonText = "Add Tag", AddACL = 128 };
@@ -552,7 +560,7 @@ public async void ReaderThread()
552560
TheBaseAssets.MySYSLOG.WriteToLog(10000, TSM.L(eDEBUG_LEVELS.OFF) ? null : new TSM(MyBaseThing.EngineName, MyBaseThing.LastMessage, eMsgLevel.l4_Message));
553561
bPreviousError = false;
554562
}
555-
else
563+
else
556564
{
557565
if (MyBaseThing.StatusLevel != 1)
558566
{
@@ -564,7 +572,7 @@ public async void ReaderThread()
564572
Dictionary<string, object> dict = ReadAll();
565573
var timestamp = DateTimeOffset.Now;
566574
TheBaseAssets.MySYSLOG.WriteToLog(10000, TSM.L(eDEBUG_LEVELS.VERBOSE) ? null : new TSM(MyBaseThing.EngineName, String.Format("Setting properties for {0}", MyBaseThing.FriendlyName), eMsgLevel.l4_Message, String.Format("{0}: {1}", timestamp, dict.Aggregate("", (s, kv) => s + string.Format("{0}={1};", kv.Key, kv.Value)))));
567-
MyBaseThing.SetProperties(dict, timestamp);
575+
PushProperties(dict, timestamp);
568576
if (!KeepOpen)
569577
{
570578
CloseModBus();

src/123 - CDMyModbus/NModbus4Shared/Message/WriteSingleCoilRequestResponse.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
namespace Modbus.Message
22
{
3+
using Data;
34
using System;
45
using System.Diagnostics;
56
using System.IO;
67
using System.Linq;
78
using System.Net;
8-
9-
using Data;
10-
119
using Unme.Common;
1210

1311
public class WriteSingleCoilRequestResponse : AbstractModbusMessageWithData<RegisterCollection>, IModbusRequest

src/150 - CDMyMSSQL/CDMyMSSQL/CDMyMSSQLStorage.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<PackageReference Include="C-DEngine" Version="6.*-*" />
3535
<PackageReference Include="cdeEnergyContractsShared" Version="6.*-*" IncludeAssets="ContentFiles" />
3636
<PackageReference Include="cdeSensorTemplateShared" Version="6.*-*" />
37-
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
37+
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" />
3838
</ItemGroup>
3939

4040
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

src/178 - External Logger/CDMyLogger/CDMyLogger.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<ItemGroup>
2525
<PackageReference Include="C-DEngine" Version="6.*-*" />
2626
<PackageReference Include="Discord.Net.Webhook">
27-
<Version>3.14.1</Version>
27+
<Version>3.16.0</Version>
2828
</PackageReference>
2929
</ItemGroup>
3030

src/178 - External Logger/CDMyLogger/ViewModel/TheInternalLogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private void sinkStorageStationIsReadyFired(ICDEThing sender, object pReady)
5757
MyRuleEventLog.SetRecordExpiration(604800, null);
5858
MyRuleEventLog.CacheStoreInterval = 15;
5959
MyRuleEventLog.IsStoreIntervalInSeconds = true;
60-
MyRuleEventLog.AppendOnly = true;
60+
//MyRuleEventLog.AppendOnly = true;
6161

6262
if (!MyRuleEventLog.IsRAMStore)
6363
MyRuleEventLog.CreateStore("The Event Log", "History of events fired by the RulesEngine", null, true, TheBaseAssets.MyServiceHostInfo.IsNewDevice);

0 commit comments

Comments
 (0)