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

Thread network commissionning (with Bluetooth)

Hello

I would like to commission my Thread network but my Thread network is isolated (I have no wifi) but I have bluetooth which works in parallel to the Thread network (app based on the "ble_thread_dyn_mtd_coap_cli_pca10056_s140" example ).

Would it be possible to use bluetooth to commission the Thread network (add a new device to the Thread network)? If yes, what do you advise me to be able to do that?

Thank you

Parents
  • Hello,

    As far as I know there are no standardized methods of providing the provision keys for openthread. Are you able to close the network, only allowing certain devices that contain the correct keys to join? 

    What I am really asking is whether this is the question, or whether the question is if we have any suggestions on how to transfer the keys over BLE.

    Best regards,

    Edvin

  • Hi Edvin,

    I just wanted to know if there was a good way to commission a new device to join an existing Thread network using Bluetooth.

    For example, I was thinking of doing one of the following:
    - connect in Bluetooth to the new device (to add to the Thread network) and send it all the credentials of the Thread network
    - or, connect in Bluetooth to a device in the Thread network and send it a command to activate the "commissioner" by providing it with the uid64 of the device to be added and its pskd. Then, I will connect in Bluetooth to the new device to activate the "joiner" to start the commissioning.

    So the question is: is this a good way to do it?

    I started by testing the second solution but I can't start the "Commissioner".
    My application is based on the example "ble_thread_dyn_mtd_coap_cli_pca10056_s140" but when I run the function "otCommissionerStart (...)" it returns "OT_ERROR_ALREADY" (Commissioner is already started).
    So I ignore this error and I run "otCommissionerAddJoiner (...)" but it returns "OT_ERROR_INVALID_STATE" (The commissioner is not active).
    Do you have any idea on how to fix this problem?

    Thank you

  • Hi,

    Sorry for hijacking this thread but I have similar issue and I want to know answer of original question of thread.

    I am facing similar issue. I am using ble_thread_dyn_proximity_uart_pca10056_s140 as I want to use COAP server as commissioner. as this project included optimized FTD Open thread library by default and I want it to be a commissioner so I removed it and added FTD library. and modified code as I understand commissioning process.    

    When I call otCommissionerStart() it returns OT_ERROR_ALREADY and another thing is that if I call otInstanceFactoryReset(thread_ot_instance_get()); it jumps to error handler.

    I am attaching my code for your review. What I want to do is commission a new device to a  network.,ble_thread_dyn_proximity_SR_COAP_Server.rar

    Regards,

    Hardik Harpal      

  • Hi Edvin,

    I've been waiting for 3 weeks: do you have any news?

    Thank you

  • Hello and ,

    Sorry for the late reply. I pinged our Thread team, and they told me that this was apparently already a known issue, but the fix didn't make it before the SDK 4.1.0 freeze. 

    The fix is included in this pull request:

    https://github.com/openthread/openthread/pull/4788

    As far as I know, the only way to patch this is to rebuild the openthread stack with this applied.

    They said that they will check if there is a possible workaround, but as of now, a rebuild is required. 

    Best regards,

    Edvin

  • Hello Edvin,

    I rebuiled OpenThread but unfortunately I still have the same problem ... I tested it with the example "ble_thread_dyn_mtd_coap_cli_pca10056_s140".

    When I execute the "otCommissionerStart (...)" function, it returns "OT_ERROR_ALREADY" to me and then if I execute "otCommissionerAddJoiner (...)", it returns "OT_ERROR_INVALID_STATE".

    And if I execute the "otCommissionerStop (...)" function before calling the "otCommissionerStart (...)" function, it returns "OT_ERROR_INVALID_STATE".

    Do you have any idea when we can have a correction?
    If the answer is no, is it possible to activate it by default (without having to activate it later in the application)? Or, do you have other ways to commission a new device on an existing Thread network?

    Thank you

  • Hello,

    A new reply from our Thread team:

    --

    Hello,

    The commissioner API exposes on-mesh commissioner API.

     

    Note that the on-mesh commissioner feature is optional in Thread, and does not need to be used. The normal/regular commissioning
    is done using external commissioner through e.g. mobile phone: https://openthread.io/guides/border-router/external-commissioning

    I do see two problems here.

    The first one is incorrect API usage, and the second is the bug in OpenThread described here: https://github.com/openthread/openthread/pull/4788
    which is already fixed on master.

    First of all, otCommissionerStart can be called only when device has already attached
    to the network. Calling this API before will return error code as in your case.

    For example, you can act on state change handler for example:

    switch (otThreadGetDeviceRole(p_context))
     {
     case OT_DEVICE_ROLE_CHILD:
     case OT_DEVICE_ROLE_ROUTER:
     case OT_DEVICE_ROLE_LEADER:
     {
         otError error = otCommissionerStart(thread_ot_instance_get(), commissioner_state_callback, commissioner_joiner_callback, NULL);
         ASSERT(error == OT_ERROR_NONE);
         break;
     }

    Only when state of the commissioner changes to `OT_COMMISSIONER_STATE_ACTIVE` you can call

    otCommissionerAddJoiner

    When it comes to the side-effect of using the OpenThread libraries as is in SDK 4.1.0, as explained
    in the GitHub's Pull Request. Basically if Commissioner changes the state without user intervention
    e.g. from Active to Disabled (due to some network issue e.g. Keep Alives are lost) without calling
    the OpenThread API it may not be possible to turn on/off the commissioner again.
    This should not be a blocker with the current OpenThread libraries.

    The `OT_ERROR_ALREADY` error is a little bit misleading since it is returned from Border Agent module, not the Commissioner one:
    https://github.com/openthread/openthread/blob/c6a258e3a5bd90aa26d8245c435c0ae5797027f4/src/core/api/commissioner_api.cpp#L54

    Anyway, I would suggest to rebuild OpenThread libraries with the following commit which includes the fix: 2f618bd4a72501a2f31e23d50a4f388b9a8c6b9b

    --

    Try this.

    BR,
    Edvin

Reply
  • Hello,

    A new reply from our Thread team:

    --

    Hello,

    The commissioner API exposes on-mesh commissioner API.

     

    Note that the on-mesh commissioner feature is optional in Thread, and does not need to be used. The normal/regular commissioning
    is done using external commissioner through e.g. mobile phone: https://openthread.io/guides/border-router/external-commissioning

    I do see two problems here.

    The first one is incorrect API usage, and the second is the bug in OpenThread described here: https://github.com/openthread/openthread/pull/4788
    which is already fixed on master.

    First of all, otCommissionerStart can be called only when device has already attached
    to the network. Calling this API before will return error code as in your case.

    For example, you can act on state change handler for example:

    switch (otThreadGetDeviceRole(p_context))
     {
     case OT_DEVICE_ROLE_CHILD:
     case OT_DEVICE_ROLE_ROUTER:
     case OT_DEVICE_ROLE_LEADER:
     {
         otError error = otCommissionerStart(thread_ot_instance_get(), commissioner_state_callback, commissioner_joiner_callback, NULL);
         ASSERT(error == OT_ERROR_NONE);
         break;
     }

    Only when state of the commissioner changes to `OT_COMMISSIONER_STATE_ACTIVE` you can call

    otCommissionerAddJoiner

    When it comes to the side-effect of using the OpenThread libraries as is in SDK 4.1.0, as explained
    in the GitHub's Pull Request. Basically if Commissioner changes the state without user intervention
    e.g. from Active to Disabled (due to some network issue e.g. Keep Alives are lost) without calling
    the OpenThread API it may not be possible to turn on/off the commissioner again.
    This should not be a blocker with the current OpenThread libraries.

    The `OT_ERROR_ALREADY` error is a little bit misleading since it is returned from Border Agent module, not the Commissioner one:
    https://github.com/openthread/openthread/blob/c6a258e3a5bd90aa26d8245c435c0ae5797027f4/src/core/api/commissioner_api.cpp#L54

    Anyway, I would suggest to rebuild OpenThread libraries with the following commit which includes the fix: 2f618bd4a72501a2f31e23d50a4f388b9a8c6b9b

    --

    Try this.

    BR,
    Edvin

Children
Related