Cannot bind app key for one of the model with PYACI Script

Hello

I am trying to bind app key for one of the models with the help of PYACI Python script. I am using latest version v5.0.0 for PYACI script and downloaded it here: https://github.com/NordicSemiconductor/nRF5-SDK-for-Mesh , also with same version of documentation for commands https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v2.1.1%2Fmd_scripts_interactive_pyaci_README.html.  And I am using Raspberry pi where my py script is running and nRF52840 with Serial Script running connected to Raspberry Pi with Ports /dev/ttyACM0 (or) /dev/ttyACM1. I am trying to bind app key for Sensor_Server Example and i get like this where all the earlier commands works well.

NOTE: examples are connected to Laptop which is obvious where we can run with bluetooth

 I also tried with Mesh Chat sample like above and get same problem

Another Question: we can identify the sample with last model ID where vendor Setup Model ID bound to "0059000a" which is 8 bit and where it should be 4 bit. Even in app i get the same ID

which is ok to setup in app but in this command - cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1000)) it should have only 4 bit right?

Please help me as soon as possible. I really in need of help to continue my work further

Regards

Parents
  • Hi Sai,

    While getting the PyACI script to work, I ran into the same error.

    The cause of the error, for my case, was that the nodes at index 0 (db.nodes[0]) was not the Light Bulb node that I am trying to interact with.
    When I determine and use the correct node index, things work as it

    should.

    Could you please check your database.json and see if the nodes you want to talk with are not at index 0?

    If you need help with checking that, you could copy the content of the file into a code block here.

    Regards,

    Hieu

  • Hello

    I apologise for my late response. Here is my content and i am trying to provision Sensor Server Example from nordic samples. Still not able to resolve this issue.

    Regards

  • Hi, I am out of office from now until the end of the week. Let me try to quickly answer about the nodes field and the indices. Please see the comments I added to the JSON and see that the node named "client" should be in index 1.

    Keep in mind that indexing starts with 0 and increment for each array member.

      "nodes": [
    	{ 	// Index 0 begins
          "UUID": "0d49c695b0b444efb2b6396a4f4b8b10",
          "appKeys": [
            0
          ],
          "cid": "0059",
          "configComplete": false,
          "crpl": 10,
          "deviceKey": "REDACTED",
          "elements": [
            {
              "index": 0,
              "location": "0001",
              "models": [
                {
                  "modelId": "0000"
                },
                {
                  "modelId": "0002"
                },
                {
                  "modelId": "1100"
                },
                {
                  "bind": [
                    0
                  ],
                  "modelId": "1101"
                }
              ]
            }
          ],
          "features": {
            "friend": 0,
            "lowPower": 2,
            "proxy": 0,
            "relay": 0
          },
          "name": "server",
          "netKeys": [
            0
          ],
          "pid": "0000",
          "security": "low",
          "unicastAddress": 16,
          "vid": "0000"
        }, 	// Index 0 ends
        { 	// Index 1 begins
          "UUID": "3442243ef35a46a58bbddbc10ca5395a",
          "appKeys": [
            0
          ],
          "cid": "0059",
          "configComplete": false,
          "crpl": 10,
          "deviceKey": "REDACTED",
          "elements": [
            {
              "index": 0,
              "location": "0001",
              "models": [
                {
                  "modelId": "0000"
                },
                {
                  "modelId": "0002"
                },
                {
                  "bind": [
                    0
                  ],
                  "modelId": "1102",
                  "publish": {
                    "address": 16,
                    "credentials": 0,
                    "index": 0,
                    "period": 0,
                    "retransmit": {
                      "count": 0,
                      "interval": 50
                    },
                    "ttl": 1
                  }
                }
              ]
            }
          ],
          "features": {
            "friend": 0,
            "lowPower": 2,
            "proxy": 0,
            "relay": 0
          },
          "name": "client",
          "netKeys": [
            0
          ],
          "pid": "0000",
          "security": "low",
          "unicastAddress": 17,
          "vid": "0000"
        }	// Index 1 ends
      ],

    Actually I can quickly answer partially about the other part too.

    Yes, UUID looks like the only option to identify a node uniquely in the context of the provision() method.

    The name and address you see in the mobile apps are from the BLE Advertisement.

    I agree it would be helpful if the scan reports can show the nodes' name and address. I will try to look into how next week.

  • Please see the comments I added to the JSON and see that the node named "client" should be in index 1.

    Yes, i got it that "client" index should be '1' but i checked with PYACI commands its not working with '1' but working with '0' as shown in below pictures.1st picture is "server" provisioning(used commands from PYACI Script(1-12))  and 2nd picture is "client" provisioning(used commands from PYACI Script(17-28)). While i checked with index '0' for both server and client not sure how to use commands(23,24,26,28) still i used index '0' and checked but could not get output with '26' command as shown in 3rd picture

    I agree it would be helpful if the scan reports can show the nodes' name and address. I will try to look

    I already tried getting name but says "KeyError: 'name'" in "mesh/provision.py" in "class provisioner" function "__event_handler" like below code.

    def __event_handler(self, event):
            if event._opcode == Event.PROV_UNPROVISIONED_RECEIVED:
                uuid = event._data["uuid"]
                name = event._data["name"]
                rssi = event._data["rssi"]
                if uuid not in self.unprov_list:
                    self.logger.info(
                        "Received UUID {} and name {} with RSSI: {} dB".format(uuid.hex(),name,  rssi))
                    self.unprov_list.append(uuid)

    Regards

  • Just want to let you know that I am still keeping your questions on my backlog. I tried to look into this today, but I haven't found anything regarding logging more information from scanning yet.

    I will try to look into it further in the next two days.

    Regards,

    Hieu

  • No problem if i dont get much information about scanning yet. for first Atleast can u please make sure "mesh chat" example works when we provision with PYACI script

    Regards

  • I have tested the Mesh Chat sample in another DevZone question 1-2 weeks ago and it worked just fine. The nodes can talk to each other correctly. Do you expect them to speak to each other or to the PyACI script?

    Regards,

    Hieu

Reply Children
  • I expect to speak each other not to PyACI script, but as i told you there is problems to index numbers for me can u explain me in detail how to provision them with commands here please

    Just curious is there a way they can speak to PyACI too?

    Regards

  • I was not able to reproduce the index problem. I will try again today, but I'd like to answer quickly about the PyACI part. I doubt that the PyACI script is able to speak to the Mesh Chat devices out of the box. To talk with the Mesh Chat devices, a device needs the Mesh Chat vendor model, which the script doesn't have.

    You can consider building that model yourself.

    I will try to get to the index problem again in the afternoon. So far that has been very weird. I have a theory that maybe the index value expected is not the index in the node database but the index in the list of devices scanned/currently found...

    In your earlier report, I understand that the second device needs index == 0, but what about the first one? Does it also work with index == 0?

  • In your earlier report, I understand that the second device needs index == 0, but what about the first one? Does it also work with index == 0?

    Yes first one also works with index==0 but i could not complete the provisioning process as i have problem in publication step, command number: 26.

    Regards

  • I still cannot reproduce the problem where the second node provisioned need to use index 0 to work.

    I am wondering if you are using the correct parameters with publish_set() part...

    Could you please post the full log of your attempt, in text form. In addition to the normal steps, each time before you call model_app_bind(), please also you run the following:

    len(db.nodes)
    db.nodes[0]
    db.nodes[1]

    Remember to redact the device key from the output of db.nodes[x].


    I checked the printing scanned device address topic. This is currently not possible, because the serial firmware on the interface device does not send this information back to the script. See: Serial Event Details > Prov Unprovisioned Received.

    If this is very important, I think you can look into the Serial example and see if you can update both the device firmware and the PyACI script to send, receive, and parse the advertising name in the Unprovisioned Received event.


    SaSu said:
    but i could not complete the provisioning process as i have problem in publication step, command number: 26.

    The publication step is a part of the configuration, not the provisioning. I suspect this might have the same root cause as the index mix up. 

  • Can you help me with the model id how to use 8 digit to 4 digit id:

    I suspect this might have the same root cause as the index mix up. 

    yes i also have the same idea

Related