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

Fix up Smart Start #71

Open
wants to merge 3 commits into
base: 4.0.0
Choose a base branch
from
Open

Fix up Smart Start #71

wants to merge 3 commits into from

Conversation

marcus-j-davies
Copy link
Member

No description provided.

@marcus-j-davies
Copy link
Member Author

marcus-j-davies commented Jun 26, 2024

@spudwebb

After some input from @AlCalzone, this PR reps the following.

ProvisionSmartStartNode now only accepts a SmartStartProvisioningEntry this is pretty much a Planned Provisioning Entry in the JS runtime

SmartStartProvisioningEntry can be created in 2 ways.

/* Your last PR - I added a default status */ 

public SmartStartProvisioningEntry(string dsk, SecurityClass[] securityClasses, Protocols protocol = Protocols.ZWave, ProvisioningEntryStatus status = ProvisioningEntryStatus.Active)
{
   this.dsk = dsk;
   this.securityClasses = securityClasses;
   this.requestedSecurityClasses = securityClasses;
   this.protocol = protocol;
   this.status = status;
   this.supportedProtocols = new Protocols[1] { protocol };
}
/* From a Parsed QR */

public SmartStartProvisioningEntry(QRProvisioningInformation ProvisioningInformation, Protocols protocol = Protocols.ZWave, ProvisioningEntryStatus status = ProvisioningEntryStatus.Active)
{
   if(!ProvisioningInformation.supportedProtocols.Contains(protocol))
   {
         throw new NotSupportedException("The provided protocol is not supported by this device.");
   }
           
   this.dsk = ProvisioningInformation.dsk;
   this.securityClasses = ProvisioningInformation.securityClasses;
   this.requestedSecurityClasses = ProvisioningInformation.securityClasses;
   this.supportedProtocols = ProvisioningInformation.supportedProtocols;
   this.protocol = protocol;
   this.status = status;
}

The securityClasses property of a SmartStartProvisioningEntry can be modified after creation, to allow Users to set what security classes they want to allow, after a QR code has been scanned for example

QRProvisioningInformation can be fetched by passing the QR Code Data to the Utils.ParseQRCodeString method

GetProvisioningEntries will return SmartStartProvisioningEntry[] with the additional nodeId if currently included

@AlCalzone, I believe this should fall more in line with what ProvisionSmartStartNode wants?

References:

public class QRProvisioningInformation

public class SmartStartProvisioningEntry

@AlCalzone
Copy link
Member

AlCalzone commented Jun 27, 2024

I believe this should fall more in line with what ProvisionSmartStartNode wants?

The QR code can also contain additional info, like manufacturer and label. While it is not required to provision a node, it would still be good to copy all additional properties (that have a value) from QRProvisioningInformation to the PlannedProvisioningEntry, so they get persisted in the cache.
Z-Wave JS UI for example shows them if they exist.

@marcus-j-davies
Copy link
Member Author

Right!

I do that anyway, in NR - Thanks

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