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

  • 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

Related