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

  • SaSu said:
    server is 0x1101

    I'm afraid that's not right.

    Regards,

    Hieu

  • Hello Hieu

    I tried with right server id still i have same issue like earlier with "publication set" command.

    If you don't mind can you check whether it works for you or not.

    Regards

  • Hello Sai,

    My apology for the long absence. My team has been facing high loading due to some unavailability. I want to let you know that I am still around and am still keeping track of your question.

    I revisit this topic today and also see the same issue where the sensor server node log Failed to publish with error -22.

    I will continue to debug this next week. Please excuse some further delay due to the ongoing high loading and a holiday next week.

    For reference, these are my script commands.

    db = MeshDB("database/example_database.json")
    
    p = Provisioner(device, db)
    p.scan_start()
    p.scan_stop()
    p.provision("b9ed5250206146188612adafdf9e29e7", 0, "Sensor", 0, 0)
    p.provision("f1f09dbd97e649818e0f62426819e67e", 0, "Observer", 0, 0)
    
    cc = ConfigurationClient(db)
    device.model_add(cc)
    
    cc.publish_set(8, 0)
    cc.composition_data_get()
    cc.appkey_add(0)
    
    
    cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1100))
    cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1100), mt.Publish(db.nodes[1].unicast_address, index=0, ttl=1, period=3000))
    cc.model_publication_get(db.nodes[0].unicast_address, mt.ModelId(0x1100))
    
    
    cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1101))
    cc.model_subscription_add(db.nodes[0].unicast_address, db.groups[0].address, mt.ModelId(0x1101))
    cc.model_subscription_get(db.nodes[0].unicast_address, mt.ModelId(0x1101))
    
    
    
    cc.publish_set(9, 1)
    cc.composition_data_get()
    cc.appkey_add(0)
    
    cc.model_app_bind(db.nodes[1].unicast_address, 0, mt.ModelId(0x1102))
    
    cc.model_subscription_add(db.nodes[1].unicast_address, db.groups[0].address, mt.ModelId(0x1102))
    cc.model_subscription_get(db.nodes[1].unicast_address, mt.ModelId(0x1102))
    cc.model_publication_set(db.nodes[1].unicast_address, mt.ModelId(0x1102), mt.Publish(db.nodes[1].unicast_address, index=0, ttl=1))
    cc.model_publication_get(db.nodes[1].unicast_address, mt.ModelId(0x1102))

    Hieu

  • Hello Hieu

    No problem. I respect your busy schedule and the effort you put to answer my questions. I will wait for your response in the meantime. Thank You for the commands BTW.

    Regards

  • Hi Sai,

    My sincerest apology for the very long wait. I had some very busy weeks, and it took a while to recover.

    I returned to this case today and regretted not keep trying for just 15-20 minutes the last time I did. The issue was exceedingly simple.

    In my previous script, I setup publication with a TTL of 1. That is not a valid value. I changed TTL to 2, and it works just fine.

    I went over your earlier script and can see that it has the same value and the same error. Thus I believe changing TTL to a value between 2 and 127 should also fix it.

    Here is an update script:

    db = MeshDB("database/example_database.json")
    
    p = Provisioner(device, db)
    p.scan_start()
    p.scan_stop()
    p.provision("b9ed5250206146188612adafdf9e29e7", 0, "Sensor", 0, 0)
    p.provision("f1f09dbd97e649818e0f62426819e67e", 0, "Observer", 0, 0)
    
    cc = ConfigurationClient(db)
    device.model_add(cc)
    
    cc.publish_set(8, 0)
    cc.composition_data_get()
    cc.appkey_add(0)
    
    
    cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1100))
    cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1100), mt.Publish(db.nodes[1].unicast_address, index=0, ttl=2, period=3000))
    cc.model_publication_get(db.nodes[0].unicast_address, mt.ModelId(0x1100))
    
    
    cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1101))
    cc.model_subscription_add(db.nodes[0].unicast_address, db.groups[0].address, mt.ModelId(0x1101))
    cc.model_subscription_get(db.nodes[0].unicast_address, mt.ModelId(0x1101))
    
    
    
    cc.publish_set(9, 1)
    cc.composition_data_get()
    cc.appkey_add(0)
    
    cc.model_app_bind(db.nodes[1].unicast_address, 0, mt.ModelId(0x1102))
    
    cc.model_subscription_add(db.nodes[1].unicast_address, db.groups[0].address, mt.ModelId(0x1102))
    cc.model_subscription_get(db.nodes[1].unicast_address, mt.ModelId(0x1102))
    cc.model_publication_set(db.nodes[1].unicast_address, mt.ModelId(0x1102), mt.Publish(db.nodes[1].unicast_address, index=0, ttl=2))
    cc.model_publication_get(db.nodes[1].unicast_address, mt.ModelId(0x1102))

    Again, I am very sorry for the long wait.

    Regards,

    Hieu

Reply
  • Hi Sai,

    My sincerest apology for the very long wait. I had some very busy weeks, and it took a while to recover.

    I returned to this case today and regretted not keep trying for just 15-20 minutes the last time I did. The issue was exceedingly simple.

    In my previous script, I setup publication with a TTL of 1. That is not a valid value. I changed TTL to 2, and it works just fine.

    I went over your earlier script and can see that it has the same value and the same error. Thus I believe changing TTL to a value between 2 and 127 should also fix it.

    Here is an update script:

    db = MeshDB("database/example_database.json")
    
    p = Provisioner(device, db)
    p.scan_start()
    p.scan_stop()
    p.provision("b9ed5250206146188612adafdf9e29e7", 0, "Sensor", 0, 0)
    p.provision("f1f09dbd97e649818e0f62426819e67e", 0, "Observer", 0, 0)
    
    cc = ConfigurationClient(db)
    device.model_add(cc)
    
    cc.publish_set(8, 0)
    cc.composition_data_get()
    cc.appkey_add(0)
    
    
    cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1100))
    cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1100), mt.Publish(db.nodes[1].unicast_address, index=0, ttl=2, period=3000))
    cc.model_publication_get(db.nodes[0].unicast_address, mt.ModelId(0x1100))
    
    
    cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1101))
    cc.model_subscription_add(db.nodes[0].unicast_address, db.groups[0].address, mt.ModelId(0x1101))
    cc.model_subscription_get(db.nodes[0].unicast_address, mt.ModelId(0x1101))
    
    
    
    cc.publish_set(9, 1)
    cc.composition_data_get()
    cc.appkey_add(0)
    
    cc.model_app_bind(db.nodes[1].unicast_address, 0, mt.ModelId(0x1102))
    
    cc.model_subscription_add(db.nodes[1].unicast_address, db.groups[0].address, mt.ModelId(0x1102))
    cc.model_subscription_get(db.nodes[1].unicast_address, mt.ModelId(0x1102))
    cc.model_publication_set(db.nodes[1].unicast_address, mt.ModelId(0x1102), mt.Publish(db.nodes[1].unicast_address, index=0, ttl=2))
    cc.model_publication_get(db.nodes[1].unicast_address, mt.ModelId(0x1102))

    Again, I am very sorry for the long wait.

    Regards,

    Hieu

Children
  • Hello Hieu

    Firstly no need of apology i understand your busy schedule, and Pyaci is working with server and client when i changed TTL=2 as you said, Thank You very much for getting back to my question and solving it.

    BTW it would be more easier if these info is included in Pyaci instructions itself, so that developers might understand it and it would be less burden on you people.

    I am glad to tell i solved my issue with my code as well with your guidance. Much obliged.

    Regards

    Sai

  • Hello Sai,

    It's excellent to know things are working for you.

    In this particular case, the minimum TTL is a part of the Mesh specification. It is a limit for all Mesh application, not just the PyACI script.
    However, I do agree that it would be nice if there are some comments on the PyACI script code that would remind us of that.

    Yet, the PyACI script and the nRF5 SDK for Mesh are now in maintenance mode, and there likely won't be any change on that. So it will be the state of thing. But we will keep looking out for this kind of improvement in the nRF Connect SDK (NCS), our current solution.

    I recently learn that in NCS, there is the Bluetooth Mesh Shell feature. It is completely different from the PyACI script, but it is capable of the same jobs, and is the recommended solution now. When you have time, please check it out.

    More details on the Mesh Shell feature is going to be a different topic, so I will digress. Please free free to open a new DevZone question if you have any questions about it though.

    Regards,

    Hieu

  • Hello Hieu

    I wanted to express my gratitude for your valuable suggestions and recommendations. I truly appreciate your seamless assistance in addressing my questions. I am particularly interested in trying out the "Bluetooth Mesh Shell Feature" that you mentioned. Once again, thank you for your hard work and support.

    Best Regards

    Sai

Related