-
Notifications
You must be signed in to change notification settings - Fork 310
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
Support fetching end device information from the device repository with vendor ID and profile ID #7222
Comments
Tested on staging1. Prerequisites:
Steps:
Results:
200 OK {
"end_device": {
"version_ids": {
"brand_id": "the-things-industries",
"model_id": "generic-node-sensor-edition",
"firmware_version": "1.0",
"band_id": "EU_863_870"
},
"lorawan_version": "MAC_V1_0_3",
"lorawan_phy_version": "PHY_V1_0_3_REV_A",
"supports_join": true,
"mac_settings": {
"supports_32_bit_f_cnt": true
},
"formatters": {
"up_formatter": "FORMATTER_REPOSITORY",
"down_formatter": "FORMATTER_REPOSITORY"
}
},
"field_mask": {
"paths": [
"version_ids",
"supports_join",
"supports_class_b",
"supports_class_c",
"lorawan_version",
"lorawan_phy_version",
"formatters",
"mac_settings.supports_32_bit_f_cnt"
]
}
}
200 OK {
"end_device": {
"version_ids": {
"brand_id": "bosch",
"model_id": "tps110",
"firmware_version": "0.23.3",
"band_id": "AS_923"
},
"lorawan_version": "MAC_V1_0_2",
"lorawan_phy_version": "PHY_V1_0_2_REV_B",
"supports_join": true,
"mac_settings": {
"supports_32_bit_f_cnt": true
}
},
"field_mask": {
"paths": [
"version_ids",
"supports_join",
"supports_class_b",
"supports_class_c",
"lorawan_version",
"lorawan_phy_version",
"mac_settings.supports_32_bit_f_cnt"
]
}
}
200 OK {
"end_device": {
"version_ids": {
"brand_id": "arduino",
"model_id": "mkr-wan-1310",
"firmware_version": "1.2.3",
"band_id": "US_902_928"
},
"lorawan_version": "MAC_V1_0_2",
"lorawan_phy_version": "PHY_V1_0_2_REV_A",
"supports_join": true,
"mac_settings": {
"supports_32_bit_f_cnt": true
},
"formatters": {
"up_formatter": "FORMATTER_REPOSITORY",
"down_formatter": "FORMATTER_REPOSITORY"
}
},
"field_mask": {
"paths": [
"version_ids",
"supports_join",
"supports_class_b",
"supports_class_c",
"lorawan_version",
"lorawan_phy_version",
"formatters",
"mac_settings.supports_32_bit_f_cnt"
]
}
} As the console doesn't use the endpoints that require the vendor profile ID + vendor ID parameters, I also did some API calls: curl -s --location -H "Authorization: $TTN_STAGING_AUTH_TOKEN" https://tti.staging1.cloud.thethings.industries/api/v3/dr/vendors/428/profiles/1/template curl -s --location -H "Authorization: $TTN_STAGING_AUTH_TOKEN" https://tti.staging1.cloud.thethings.industries/api/v3/dr/vendors/428/profiles/2/template These return a not found for now. I believe we have to rebuild the bleve.index as a new document type was introduced. I got the same issue locally, but after rebuilding the index the endpoint worked. EDIT: tested after rc release. the profiles are found now: curl -s --location -H "Authorization: $TTN_STAGING_AUTH_TOKEN" https://tti.staging1.cloud.thethings.industries/api/v3/dr/vendors/428/profiles/1/template {
"end_device": {
"version_ids": {
"brand_id": "the-things-industries",
"model_id": "generic-node-sensor-edition",
"hardware_version": "1.1",
"firmware_version": "1.0",
"band_id": "EU_863_870"
},
"lorawan_version": "MAC_V1_0_3",
"lorawan_phy_version": "PHY_V1_0_3_REV_A",
"supports_join": true,
"mac_settings": {
"supports_32_bit_f_cnt": true
},
"formatters": {
"up_formatter": "FORMATTER_REPOSITORY",
"down_formatter": "FORMATTER_REPOSITORY"
}
},
"field_mask": {
"paths": [
"version_ids",
"supports_join",
"supports_class_b",
"supports_class_c",
"lorawan_version",
"lorawan_phy_version",
"formatters",
"mac_settings.supports_32_bit_f_cnt"
]
}
} curl -s --location -H "Authorization: $TTN_STAGING_AUTH_TOKEN" https://tti.staging1.cloud.thethings.industries/api/v3/dr/vendors/428/profiles/2/template {
"end_device": {
"version_ids": {
"brand_id": "the-things-industries",
"model_id": "generic-node-sensor-edition",
"hardware_version": "1.1",
"firmware_version": "1.0",
"band_id": "US_902_928"
},
"lorawan_version": "MAC_V1_0_3",
"lorawan_phy_version": "PHY_V1_0_3_REV_A",
"supports_join": true,
"mac_settings": {
"supports_32_bit_f_cnt": true
},
"formatters": {
"up_formatter": "FORMATTER_REPOSITORY",
"down_formatter": "FORMATTER_REPOSITORY"
}
},
"field_mask": {
"paths": [
"version_ids",
"supports_join",
"supports_class_b",
"supports_class_c",
"lorawan_version",
"lorawan_phy_version",
"formatters",
"mac_settings.supports_32_bit_f_cnt"
]
}
} |
Thanks @vlasebian: This is done and tested. |
Summary
Support fetching end device information from the device repository with vendor ID and profile ID.
Current Situation
When an end device is currently registered via the console using a QR code, the console does the following
DeviceRepository
service.EndDeviceQRCodeGenerator
service.EndDevice
message which in-turn has the important LoRaAllianceProfileIdentifiers.VendorID
that uniquely identifies and end device vendor (ex: The Things Industries). We store this in the index file of the device repo.VendorProfileID
that is currently unused.<device-name>.yaml
in the folder for that device. ex: https://github.com/TheThingsNetwork/lorawan-devices/tree/master/vendor/the-things-industries) using the ListModels RPC.Why do we need this? Who uses it, and when?
When we parse a LoRa Alliance TR005 QR code, the QR code already contains the VendorID and VendorProfileID fields. We can simplify this flow and directly get the End Device Model and the End Device Profile from it without user intervention.
This makes the onboarding experience very smooth.
Proposed Implementation
New Console flow (After the backend part below is implemented)
Steps 1 and 2 from the
Current Situation
is the same.Step 3: The Console calls the new
GetEndDeviceProvisioningInfo
RPC (see below) and passes the vendor ID and vendor profile ID.a. If these are not properly defined in the device repository or there's an error, the Console can just use the same flow as now. (OR)
b. If the RPC returns the correct End Device Model and End Device Profile then the console can fill all the necessary info and skip steps 4, 5, 6 in
Current Situation
and move to Step 7.Backend implementation
We need the following to make this work.
EndDeviceInfo
orEndDeviceProvisioningInfo
message which contains theEndDeviceModel
andEndDeviceTemplate
.EndDeviceProvisioningInfo
message and has the vendor ID and vendor profile ID for search.EndDeviceProvisioningInfo
via the vendorID and vendor profile ID. The implementation of this method uses the index from step 2/3.GetEndDeviceProvisioningInfo
) to the device repository service (ex: https://github.com/TheThingsNetwork/lorawan-stack/blob/v3.32/pkg/devicerepository/grpc.go#L120) which internally uses this new store method.@johanstokking: Let me know if this is clear/complete.
Contributing
Validation
Code of Conduct
The text was updated successfully, but these errors were encountered: