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

Using PyACI how to model app unbind and bind again

I have devices within an same group that bind with same app key, all are working normal together. But I want one device to be unbind and bind with another app key(out of the group) to control seperately.

After restart script, I tried these commands step by step, but doesn't work.

db = MeshDB("database/example_database.json")

p = Provisioner(device, db)
device.send(cmd.DevkeyAdd(db.nodes[0].unicast_address, 0, db.nodes[0].device_key))
device.send(cmd.AddrPublicationAdd(db.nodes[0].unicast_address))

cc = ConfigurationClient(db)
device.model_add(cc)
cc.publish_set(8, 0)

cc.composition_data_get()
cc.appkey_add(0)

cc.appkey_add(1)

cc.model_app_unbind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1000))

cc.model_app_bind(db.nodes[0].unicast_address, 1, mt.ModelId(0x1000))

But nothing happned, anyone have an idea or please share step by step command.

Parents
  • Hi Jawwad. 

    I'm not sure I understood correctly but why do you unbind the key before you bind anything to the model ? 
    If you call 
    cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1000))

    and 
    cc.model_app_unbind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1000))

    cc.model_app_bind(db.nodes[0].unicast_address, 1, mt.ModelId(0x1000))

    Would this work ? 

    Please check on the peer node if you receive the CONFIG_OPCODE_MODEL_APP_UNBIND command from the provisioner. 

  • Thanks for your response.

    Actually I want to test to control all lights in a group and then move one node to another group, and then test individually.

    Next, I want to reverse back this step. The purpose of this test to check how PYACI command can use to control nodes within a group or without group.

    If I restart pycai script, I am not sure what commands need to follow to archive above task.

    db = MeshDB("database/example_database.json")
    db.provisioners
    p = Provisioner(device, db)

    ???

Reply
  • Thanks for your response.

    Actually I want to test to control all lights in a group and then move one node to another group, and then test individually.

    Next, I want to reverse back this step. The purpose of this test to check how PYACI command can use to control nodes within a group or without group.

    If I restart pycai script, I am not sure what commands need to follow to archive above task.

    db = MeshDB("database/example_database.json")
    db.provisioners
    p = Provisioner(device, db)

    ???

Children
Related