Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SetRawConfigParameterValue method to the ZWaveNode class #38

Merged
merged 2 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class Driver
private bool Host = true;

private string _ZWaveJSDriverVersion;
public string ZWaveJSDriverVersion
public string ZWJSS_DriverVersion
{
get
{
Expand All @@ -41,7 +41,7 @@ public string ZWaveJSDriverVersion
}

private string _ZWaveJSServerVersion;
public string ZWaveJSServerVersion
public string ZWJSS_ServerVersion
{
get
{
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -641,7 +641,7 @@ private void StartListetningCB(JObject JO)
}
}

public Task<CMDResult> StartListeningLogs()
public Task<CMDResult> ZWJSS_StartListeningLogs()
{
Guid ID = Guid.NewGuid();

Expand All @@ -664,7 +664,7 @@ public Task<CMDResult> StartListeningLogs()
return Result.Task;
}

public Task<CMDResult> StopListeningLogs()
public Task<CMDResult> ZWJSS_StopListeningLogs()
{
Guid ID = Guid.NewGuid();

Expand Down
1 change: 1 addition & 0 deletions Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
27 changes: 26 additions & 1 deletion Visual Studio Projects/ZWaveJS.NET/ZWaveJS.NET/ZWaveNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -372,6 +372,31 @@ public Task<CMDResult> PollValue(ValueID ValueID)
return Result.Task;
}

public Task<CMDResult> ZWJSS_SetRawConfigParameterValue(int parameter, int value, int valueSize)
{
Guid ID = Guid.NewGuid();

TaskCompletionSource<CMDResult> Result = new TaskCompletionSource<CMDResult>();
Driver.Instance.Callbacks.Add(ID, (JO) =>
{
CMDResult Res = new CMDResult(JO);
Result.SetResult(Res);
});

Dictionary<string, object> Request = new Dictionary<string, object>();
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<CMDResult> RefreshValues()
{
Guid ID = Guid.NewGuid();
Expand Down