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

Conversation

spudwebb
Copy link

No description provided.

@marcus-j-davies
Copy link
Member

marcus-j-davies commented Sep 27, 2023

Thanks @spudwebb

This may already be possible, I think this is a just a utility method added by the server, I want to avoid adding these if at all possible, to remain faithful to the Native Drivers API layout and documentation available to users.

Adding CC specific methods to a node, may open up the flood gates to start wiring in CC specific methods in various places 😱

Can you try:

Dictionary<string, int> Params = new Dictionary<string, int>();
Params.Add("parameter", some-param-number);
Params.Add("value", some-value);
Params.Add("valueSize", some-size);
YourNode.InvokeCCAPI(0x70,"set", Params) // Configuration CC, Method, Method args (just an object for Configuration.Set)

https://zwave-js.github.io/node-zwave-js/#/api/endpoint?id=invokeccapi

https://zwave-js.github.io/node-zwave-js/#/api/CCs/Configuration?id=set

https://github.com/zwave-js/node-zwave-js/blob/da38c2d65dba7961964b50f1c78d7d8b7833d51d/packages/cc/src/cc/ConfigurationCC.ts#L106

I can of course still have a change of heart 😄

@spudwebb
Copy link
Author

Yes your code works too. Thanks

But since it is an existing and documented command in ZWave JS server, I thought it would be nice to have it, even if it is just a utility method, because I guess it is a command that most of clients would need to use.
https://github.com/zwave-js/zwave-js-server#set-raw-configuration-parameter-value-advanced

@marcus-j-davies
Copy link
Member

Ok.

To be fair, if the lib is being used with an external server, then one is likely aware of server specific implementations, as apposed to running the lib with the built in runtime.

I'll merge this a bit later, but may add a few changes that I discussed in a previous PR.
This will allow Server specific methods to be utilised, without tattooing the lib with methods on classes that are not actually part of the Native Driver offerings.

Example

Driver.ServerUtils.StartListeningLogs();
ZWaveNode.ServerUtils.SetRawConfigParameterValue();

@marcus-j-davies
Copy link
Member

marcus-j-davies commented Oct 2, 2023

Hi @spudwebb

This will now be merged, but I have renamed some server specifics, to identify them as being something extra the server has added ontop of the Native Driver.

i.e prefixing with ZWJSS_

ZWaveNode.SetRawConfigParameterValue --> ZWaveNode.ZWJSS_SetRawConfigParameterValue
Driver.LoggingEvent --> Driver.ZWJSS_LoggingEvent
Driver.StartListeningLogs --> Driver.ZWJSS_StartListeningLogs
Driver.StopListeningLogs --> Driver.ZWJSS_StopListeningLogs

@marcus-j-davies marcus-j-davies merged commit 90687b0 into zwave-js:4.0.0 Oct 2, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants