Closed johanstokking closed 2 years ago
Now that https://github.com/TheThingsNetwork/lorawan-stack/pull/5324 is merged, here's a short summary of the backend.
Claim
, Unclaim
, GetClaimStatus
and GetInfoByJoinEUI
. Check the DeviceClaimingServer service for details.GetInfoByJoinEUI
.
Claim
RPC to claim the device. join_server_address
field when registering in the IS.join_server_address
is set for the device and if not, use the Unclaim
RPC to remove the claim from the external JS.EndDeviceTemplate
with the LoRaWAN device profile info filled.So following our meeting just now, we figured out that it is not actually possible to determine the device model, versions and region from the QR code scan since it will only give us the device profile info and brand ID, which can be valid for multiple combinations.
So there are two things to do here:
I will work on modifying the wireframes accordingly.
- Look into extending the information that can be obtained from the QR code to include some kind of device repository identifier @johanstokking
- Change the UX to still have users select the relevant model, versions, and frequency profile when scanning a QR code. For this, the possible combinations would ideally be narrowed to the ones that match the fetched profile. In order to implement that, a new RPC in the DR service is required which would return such combinations based on the specified profile. @johanstokking @KrishnaIyer
For background: currently, the QR code contains vendor ID and profile ID, and there's gonna be a codec ID. That might be useful, but that does not provide the version identifiers which is useful for stats and display.
So ideally, the QR code tells us not only the vendor ID, but the model ID, hardware and firmware version and band. We could still use a single identifier for that, but not "profile ID" and "codec ID". However, that identifier would replace the need for a profile ID and vendor ID.
Until we have that, don't bother with this. We should not attempt reverse lookups. It gets too complicated also considering we support referring to profiles of other vendors.
Alright then. I've finalized the wireframes so that we can now plan implementation.
Please have a look and confirm.
I this still blocked on anything else? Otherwise we can remove the blocked
label as well.
This look complete to me.
ACK. Looks good to me as well. This isn't blocked so I'll remove that label.
Here's a rough planning summary of how we are going to implement this. I will keep this post updated with progressive insight.
Ok, so as discussed in our meeting last Wednesday we will split implementation up using the following scaffold
<EndDeviceOnboardingForm>
<EndDeviceTypeFormSection>
<DeviceTypeRepositoryFormSection />
<DeviceTypeManualFormSection />
</EndDeviceTypeFormSection>
<EndDeviceProvisioningFormSection>
<EndDeviceRegistrationFormSection />
<EndDeviceClaimingFormSection />
</EndDeviceProvisioningFormSection>
</EndDeviceOnboardingForm>
Here's the scaffold applied to the wireframe:
We will use React's context API to store global form data within <EndDeviceOnboardingForm />
, which then all sub-components will subscribe to. This way we avoid passing down a lot of props to the child components and rather use <EndDeviceOnboardingForm />
as a single source of truth about global form state. We will use two contexts here:
useFormikContext()
-hook)The form is highly dynamic but there are certain self-containing sections of the form, which I have outlined above which each should be able to handle their own concerns while reacting to certain form field values stored in the global context.
E.g. <EndDeviceTypeRepository />
will handle the Input method
field and render either <DeviceTypeRepositoryFormSection />
or <DeviceTypeManualFormSection />
based on the user's selection. It will do so by invoking the context via useFormikContext()
which contains the current form values, allowing us to do the conditional rendering.
Generally, the new form contains many existing elements and we should reuse as much as possible, this includes validation schemas, general utilities, JSX markup, etc. We should however make sure to address some of the issues we have in the current code:
I will create a feature branch with a scaffold of the implementation and then we can delegate tasks and work on this in parallel.
Summary
New end device onboarding flow
Replaces #3770 Blocked by #4840 Blocked by #4841 Blocked by #4845
Why do we need this?
To make it even easier to onboard new end devices by scanning QR codes.
Also we need to remove the creation on an external Join Server and integrate device claiming in the onboarding process.
For most end users, device creation and claiming is conceptually the same. We should put this in one nice device onboarding experience.
What is already there? What do you see now?
What is missing? What do you want to see?
Onboarding flow with QR code scanning, claiming, manual creation and retrieving info from the Device Repository integrated.
How do you propose to implement this?
For onboarding:
We have the following properties in an end device onboarding state:
Allow user to choose between: scan QR code, choose from device repository and manual creation:
QRCodeParser.Parse()
rpc (https://github.com/TheThingsNetwork/lorawan-stack/issues/4845)00
!)join_server_address
join_server_address
For offboarding
Check if the
join_server_address
is setHow do you propose to test this?
Let's test the flows first. I'm not sure what the best of doing that is; using mock ups?
These are key scenarios we need to support:
Can you do this yourself and submit a Pull Request?
Can review