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

How to delete key of Node side and provisioner side in Mesh

Hi all, 

I using 1 Provisioner provisioning for some Nodes (light switch server) . If I have 5 Nodes in mesh network

I want to remove Node 4 from network and then add it to Network 

beside Node , I use 

mesh_stack_config_clear();
node_reset();

and it ok . Data is clear from flash and I can add it to network but Provisioner consider it the 6th node. And beside provisioner , if I use 

clear_app_data();
mesh_stack_config_clear();

It will delete total flash and I have to add 5 Node back from the beginning . And I only want remove data of Node 4 beside provisioner and add it again and provisioner consider it as 4th node.

How I can do that? Pls help me!!!

  • Hi Giang, 

     

    Currently there is no definition in Mesh spec on how the provisioner should re-use a deleted node's address. All new node address should be the increment of the last provisioned address. 

    Do you have a problem having a new address for node #4 ? If you want to keep track of active node, you can use heart beat. 

    If you want to have the ability to reuse a removed address, I think it's possible, however you need to implement the code yourself. Two things need to be done, next address to be assigned, and update the devicekey assigned for the node.  

    Basically if you call clear_app_data() it clears all the flash stored data and when you call mesh_stack_config_clear() it clears all the RAM data of the configuration of the node. Meaning if you call that on a provisioner, it will forget everything about all the nodes in the network. 

     

    Do you really need to keep the address of a node that you remove from the network ? 

     

    Also please be aware that when you send config_client_node_reset() to tell a node to reset itself, there is no guarantee that the node will follow the command and remove the network key. If you want to make sure you force a node out of the network, you would need to do a keyrefresh with that node blacklisted. 

     

  • Hi, 

    If I define Network have 30 Node is max.

    When I remove Node 5 from Network and add it again and Provisioner consider it is Node 6 , If I continue remove it and add it . Provisioner consider it is Node 7 ... So when Provisioner consider it is Node 30 . Reality , My network only have 5 Node

    :(( Can you suggest for this?

    And I want to ask more : In light switch server , when I want add more 1 light switch client , But I dont find out appkey handler in project for bind to client . Can you help me ? Thank very much.

  • Hi Giang, 

     

    As I mentioned, you need to implement code in your provisioner to assign the newly free address to the provisionee. You need to have a look at how we define and calculate the  m_nw_state.next_device_address. You would need to make it a little bit smarter to re-use address that has been removed from the network. It's not suggested though. 

     

    The easier way is to increase max Node above 30. I don't think you would have a problem doing so. 

    Note that we don't suggest user to use nRF52 as provisioner, but you better use a computer or phone to work as provisioner. This way it's easier to re-configure and store provisioning data. 

     

    Your second question, could you be more clear ? You mean you want to add a light switch model to the server node ? Be aware that they have to be on different element. You need to be more specific on the appkey handler you are asking. The app key is assigned to a model when configuration. The server app key and the client app key should be the same so they can talk to each other. 

  • Hi,

    In question 2, I want to add light switch client model into light switch proxy server , as this video : https://www.youtube.com/watch?v=XthbU9NP0Yg

    So , I need appkey handle for bind to client model . But I can't find it in project . So I want to ask you how I can find out this function . Now , I fixed code appkey_handle = 0 and 2 model can work fine as your video . But I want to find out appkey handle by function code . I know when provisioner provisioning for light switch server , we exchange key and appkey handle was created. So , what function on project can help me? Thank!!!

Related