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

how to use Mesh "group" in Serial example

In simple on/off example, the client can turn on several server nodes in the same group in the same time,

but in serial example mix simple on/off server, the info center only show to set on to one server node,

1. is it possible to turn on all the server in same group in the same time in serial example? 

how to add a server to a group ?

and are there serial commands using interactive_pyaci.py to do this function ?

2.what is the difference between "group" and "subnet" in ble MESH?

If those two are the same thing, how to change subnet of a server node in serial example?

3.why in provisioning , devkey start at 8 ? 

how many server nodes can be provisioned in  recent serial example provisioner ?

  • Hello AgathaKuan,

    A1: Yes, it is possible. The procedure is like this:

    1. Provisioned and configured each node
      1. During configure a node, please also set a node to subscribe to a group address
    2. Register the group address to be an active address subscription
    3. Set the SimpleOnOff client model to publish the message to the group address

    db = MeshDB("database/example_database.json")
    db.provisioners
    p = Provisioner(device, db)
    
    p.scan_start()
    p.scan_stop()
    p.provision(uuid = "0059XXXXXXXXXXXXXXXXXXXXXXXXXXXX") #Provisioning for first node
    cc = ConfigurationClient(db)
    cc.publish(8, 0)
    cc.appkey_add(0)
    cc.model_app_bind(db.node[0].unicast_address, 0, mt.ModelId(0, 0x59))
    cc.model_subscription(db.node[0].unicast_address, 0xc001, mt.ModelId(0, 0x59)
    
    p.provision(uuid = "0059YYYYYYYYYYYYYYYYYYYYYYYYYYYY") #Provisioning for second node
    cc.publish(9, 0)
    cc.appkey_add(0)
    cc.model_app_bind(db.node[1].unicast_address, 0, mt.ModelId(0, 0x59))
    cc.model_subscription(db.node[1].unicast_address, 0xc001, mt.ModelId(0, 0x59)
    
    device.send(cmd.AddrsubscriptionAdd(0xc001) # You will get an address handle for 0xc001
    
    sc_group = SimpleOnOffClient()
    device.model_add(sc_group)
    sc_group.publish_set(0, 1) # The second parameter is the group address handle we just got
    sc_group.set(True) 

    A2: If devices are under different subnet, they are using different network key, and messages won't be relayed. Since every relay node will check if it has the correct network key for the received packets. If the network key is not correct, the relay node will drop it simply.

    A3: I believe the reason why device key handle starts from 8 is because this will help developers to distinguish between device key handle and ordinary application key handle easier.

    Hope the upon information can do help.

    Best regards,

    Rick

Related