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.

  • I understood the "group" is an address that belong to set of devices that control by one command. In other word, change together devices status that belongs to a specific group address.

    Configure node

    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(0x1000))
    cc.model_subscription_add(db.nodes[0].unicast_address, 0xc001, mt.ModelId(0x1000))

    According to this example:

    infocenter.nordicsemi.com/index.jsp

  • Hi Jawward, 
    So my understanding of your case is that the devices are subscribed to the same group address is considered in a same group.

    Therefore to change the group of a device, device D for example, you just need to call 

    cc.model_subscription_add(NODE D address, GROUP B Address, mt.ModelId(0x1000))

    Usually you don't have to change the app key if they use the same app key. 

Related