From 85b91d4f4ba3600d613b89bb4e54a84a8d08aa57 Mon Sep 17 00:00:00 2001 From: spud Date: Wed, 27 Sep 2023 15:49:51 -0400 Subject: [PATCH 1/2] Add SetRawConfigParameterValue method to the ZWaveNode class --- CHANGELOG.md | 1 + .../ZWaveJS.NET/ZWaveJS.NET/Enums.cs | 1 + .../ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs | 25 +++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b170d4..f38c485 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - The Node **FirmwareUpdateFinished** event now passes an args parameter - New Features + - Added **SetRawConfigParameterValue** method to the ZWaveNode class. - Added **RefreshValues** method to the ZWaveNode class. - Added **WaitForWakeUp** method to the ZWaveNode class. - Added **Ping**, method to the ZwaveNode class. diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Enums.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Enums.cs index 745aa78..8431ca8 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Enums.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Enums.cs @@ -94,6 +94,7 @@ internal class Commands public const string SetValue = "node.set_value"; public const string GetValue = "node.get_value"; public const string PollValue = "node.poll_value"; + public const string SetRawConfigParameterValue = "node.set_raw_config_parameter_value"; public const string RefreshValues = "node.refresh_values"; public const string GetDefinedValueIDs = "node.get_defined_value_ids"; public const string GetValueMetadata = "node.get_value_metadata"; diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs index dcafbab..f9d6a76 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs @@ -372,6 +372,31 @@ public Task PollValue(ValueID ValueID) return Result.Task; } + public Task SetRawConfigParameterValue(int parameter, int value, int valueSize) + { + Guid ID = Guid.NewGuid(); + + TaskCompletionSource Result = new TaskCompletionSource(); + Driver.Instance.Callbacks.Add(ID, (JO) => + { + CMDResult Res = new CMDResult(JO); + Result.SetResult(Res); + }); + + Dictionary Request = new Dictionary(); + Request.Add("messageId", ID); + Request.Add("command", Enums.Commands.SetRawConfigParameterValue); + Request.Add("nodeId", this.id); + Request.Add("parameter", parameter); + Request.Add("value", value); + Request.Add("valueSize", valueSize); + + string RequestPL = Newtonsoft.Json.JsonConvert.SerializeObject(Request); + Driver.Instance.ClientWebSocket.SendInstant(RequestPL); + + return Result.Task; + } + public Task RefreshValues() { Guid ID = Guid.NewGuid(); From 6b6e4ef04d7ed6ceea17744b4253fac30aecff2a Mon Sep 17 00:00:00 2001 From: Marcus Davies <55892693+marcus-j-davies@users.noreply.github.com> Date: Mon, 2 Oct 2023 20:20:17 +0100 Subject: [PATCH 2/2] Create separation between Server and Driver --- .../ZWaveJS.NET/ZWaveJS.NET/Driver.cs | 12 ++++++------ .../ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Driver.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Driver.cs index 1c68f29..8a80f2c 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Driver.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Driver.cs @@ -32,7 +32,7 @@ public class Driver private bool Host = true; private string _ZWaveJSDriverVersion; - public string ZWaveJSDriverVersion + public string ZWJSS_DriverVersion { get { @@ -41,7 +41,7 @@ public string ZWaveJSDriverVersion } private string _ZWaveJSServerVersion; - public string ZWaveJSServerVersion + public string ZWJSS_ServerVersion { get { @@ -69,10 +69,10 @@ public string ZWaveJSServerVersion public event UnexpectedHostExitEvent UnexpectedHostExit; public delegate void LoggingEventDelegate(LoggingEventArgs args); - public event LoggingEventDelegate LoggingEvent; + public event LoggingEventDelegate ZWJSS_LoggingEvent; internal void Trigger_LoggingEvent(LoggingEventArgs args) { - LoggingEvent?.Invoke(args); + ZWJSS_LoggingEvent?.Invoke(args); } private void MapNodeEvents() @@ -641,7 +641,7 @@ private void StartListetningCB(JObject JO) } } - public Task StartListeningLogs() + public Task ZWJSS_StartListeningLogs() { Guid ID = Guid.NewGuid(); @@ -664,7 +664,7 @@ public Task StartListeningLogs() return Result.Task; } - public Task StopListeningLogs() + public Task ZWJSS_StopListeningLogs() { Guid ID = Guid.NewGuid(); diff --git a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs index f9d6a76..fd23c56 100644 --- a/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs +++ b/Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs @@ -13,7 +13,7 @@ internal ZWaveNode() { } - + public delegate void LifelineHealthCheckProgress(int Round, int TotalRounds, int LastRating); private LifelineHealthCheckProgress LifelineHealthCheckProgressSub; internal void Trigger_LifelineHealthCheckProgress(int Round, int TotalRounds, int LastRating) @@ -372,7 +372,7 @@ public Task PollValue(ValueID ValueID) return Result.Task; } - public Task SetRawConfigParameterValue(int parameter, int value, int valueSize) + public Task ZWJSS_SetRawConfigParameterValue(int parameter, int value, int valueSize) { Guid ID = Guid.NewGuid();