This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Remote provisioning from all devices on the mesh

I am using mesh SDK v4.2.0.

I read the documentation of the remote provisioning example (pb_remote) and took look at the code.

My first feeling was that the remote provisioning in this example is done through a specific device on the mesh that implements the pb_remote_server and is chosen to start the process using the device that implements the pb_remote_client, most likely the provisioner device.

Before a detailed reading of this example, I thought the provisioner just flooded the mesh with provisioning messages and all devices repeated those messages and could add a new device to the mesh. While the provisioning data is indeed passed through the mesh as I expected to, only one specific device, the one chosen by the pb_remote_client, seems to be able to convey the message on the last jump to the new unprovisioned device.

How can the provisioner know beforehand the best device to choose as the final messager? Is it possible to activate many pb_remote_servers at the same time? Do we need to alternate which device is scanning for unprovisioned devices periodically? I think there might be many ways of doing this, so I am asking for advice, or correction if I understood something wrong.

Parents
  • Hi, 

    Sorry for the late reply. 

    You are correct, a specific remote provisioning server is used for actually provisioning each unprovisioned device. There is nothing stopping you from having a lot of these in the network however, possibly on every node. In addition, choosing the "best" server for provisioning a new device is not really neccessary, any device which picks up the unprovisioned beacon should do.

Reply
  • Hi, 

    Sorry for the late reply. 

    You are correct, a specific remote provisioning server is used for actually provisioning each unprovisioned device. There is nothing stopping you from having a lot of these in the network however, possibly on every node. In addition, choosing the "best" server for provisioning a new device is not really neccessary, any device which picks up the unprovisioned beacon should do.

Children
  • Greetings  ,  , and DevZone community.
    I am currently working on this also. At the moment I have two questions still standing concerning this:

    - Imagine we have more than one remote provisioning server. When one starts a provisioning/configuration session with an unprovisioned device that beaconed it. Would that unprovisioned device also be hearing and replying to other remote provisioning servers?

    - How would the original provisioner device handle the information of the other nodes being remotely provisioned by other remove provisioning server? For instance, we are using the nodes UUID as a sort of login identifier in our cloud gateway, is that info relayed back to the original provisioner?

    Thank you very much for all support,

    Best Regards and stay safe
    //EA

  • Hi,

    EAn said:
    Imagine we have more than one remote provisioning server. When one starts a provisioning/configuration session with an unprovisioned device that beaconed it. Would that unprovisioned device also be hearing and replying to other remote provisioning servers?

    Any unprovisioned device will have at most one provisioning link open at one time. I.e. the device will at some level "hear" the other servers, but it will open a link to at most one of them at a time and the actual provisioning process will only communicate between these two devices.

    EAn said:
    How would the original provisioner device handle the information of the other nodes being remotely provisioned by other remove provisioning server? For instance, we are using the nodes UUID as a sort of login identifier in our cloud gateway, is that info relayed back to the original provisioner?

    With remote provisioning, the pb-remote client is in charge of the actual provisioning and as such has access to all information normally available during e.g. provisioning over the advertiser bearer. The pb-remote server(s) and the rest of the mesh network only really exist to relay the messages for the provisioning process between the pb-remote client and the provisionee.

  • Hi, I returned to the development of the remote provisioner and while I got it working, I cannot start multiple remote scans at the same time. From my interpretation of the code, this is not natively possible.

    Currently I am cycling through all active nodes in the mesh network, first setting/changing the publish address of the pb_remote_client with the dsm to the address of the pb_remote_server in that node and then initiating the scan with pb_remote_client_remote_scan_start.

    pb_remote_client_remote_scan_start only returns NRF_SUCCESS if the client state is PB_REMOTE_CLIENT_STATE_IDLE, returning NRF_ERROR_INVALID_STATE otherwise. After the first scan is ordered, an event of type PB_REMOTE_CLIENT_EVENT_SCAN_START is sent for processing, which will trigger pb_remote_client_event_scan_start_cb and change the client state to PB_REMOTE_CLIENT_STATE_WAIT_ACK_SCAN. On ordering the second scan from the second node, client state is no longer PB_REMOTE_CLIENT_STATE_IDLE, but PB_REMOTE_CLIENT_STATE_WAIT_ACK_SCAN. This will trigger the NRF_ERROR_INVALID_STATE error and prevent me from initiating remote scanning on the second node.

    I imagine this is done because the remote client does not change its publish address dynamically, depending on the address of the server that links with the unprovisioned device. Am I on the right track? Thank you.

  • Hi, 

    pb remote client can work only with one pb remote server at a time. Dynamically changing publication address of the client will lead to incorrect state of both the server and the client. You can only change pb remote client publication (and thus run provisioning on another pb remote server) when it's state is IDLE.

    So what you can do is that you can set publication to one server and do scanning through that server. Once scanning is finished (either by canceling scanning or if server reaches the limit of maximum stored UUIDs defined by PB_REMOTE_SERVER_UUID_LIST_SIZE), you will get PB_REMOTE_EVENT_SCAN_CANCELED event on the client. Now you can change the publication address to another server or start provisioning. If the provisioning process is started, you can't change the client's publication address until the provisioning is completed.

  • I'm calling pb_remote_client_remote_scan_cancel in a timer handler that is triggered 30 seconds after I start the scan from the first server but I'm getting NRF_ERROR_INVALID_STATE since p_client->state != PB_REMOTE_CLIENT_STATE_IDLE obviously. Is it safe to force it to PB_REMOTE_CLIENT_STATE_IDLE before calling pb_remote_client_remote_scan_cancel?

    I don't mind experimenting and customizing the SDK to my needs, I'm just asking so I don't lose time implementing a workflow that was already well thought by you guys. Thanks!

Related