I am utilizing two Nordic development kits as servers through the Light Switch Server example, and my task is to provision both devices using a Python script. To achieve this goal, I referred to the Using Serial Interface for Provisioning and Configuration document in the nrf5 SDK documentation. I compiled all the necessary provisioning commands into a script, which is displayed below.
After creating the provisioning script, I tested it and found that it worked well. The results of the script can be seen below.
Problem:
i found a problem in the above script and the problem is in this command (p.provision(name="Sensor server")) i will give you more explanation below.
Initially, when I ran the script without any interruptions, such as powering off a node, both the provisioning and configuration processes completed successfully for both server nodes.In another test, I interrupted one of the nodes during the provisioning command "p.provision()" by powering it off. This caused an error, and the compiler went to the "except" statement. Afterward, the compiler went to the second iteration and ran the provision command to provision the second node. However, the same error occurred again.
In another test, I once again interrupted one of the nodes by powering it off. However, this time I allowed the compiler to run the provision command and complete the provisioning process before powering off the node to generate an error during configuration. As expected, the error occurred during configuration, and the compiler went to the "except" statement. However, during the second iteration to provision the other node, there were no issues, and both the provisioning and configuration processes were successful for second node.
The overall testing results demonstrate that errors during node provisioning can cause the same problem for another node in the loop.
failed with error treated as unexpected error in above picture....sorry
Based on my extensive testing, I believe that the error occurred during the first iteration due to the "p.provision(name='')" command. In the second iteration, when the code provisioned the second node, the "p.provision()" command responded to the previous node that generated the error. I think if this command had responded to the second node, it would have worked.
My Question:
My primary inquiry is how to use the "p.provision(name="")" command so that it can be used for different nodes in the loop, where in the first iteration it responds to the first node and in the second iteration it responds to the second server node.
Thanks