Provisioning and Controlling Two Dongles, which run Mesh Light Switch Server example using Mesh Serial Example

I have

nRf52840 DK - 1 - Mesh Serail example
nRF52840 Dongle - 2 - Mesh Light Switch Server example.

I used the steps given in the infocenter to provision and configure Dongles using Mesh Serial Example , using DK.I almost get
similar outputs given in the infocenter for provisioning and connecting One Dongle which rum Server example and later another Dongle
which run Client example.

But , when I try to control the two Dongles which rum Server examples , using DK which rum Mesh Serail example , I get error as INVALID ADDRESS
when try to bind second node to the DK .The code is given as follows:

C:\Nordic_Semi\nrf5sdkformeshv500src\scripts\interactive_pyaci>python interactive_pyaci.py -d COM13 --no-logfile
C:\Nordic_Semi\nrf5sdkformeshv500src\scripts\interactive_pyaci\mesh\provisioning.py:31: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python.
  from cryptography.hazmat.primitives.asymmetric import ec

    To control your device, use d[x], where x is the device index.
    Devices are indexed based on the order of the COM ports specified by the -d option.
    The first device, d[0], can also be accessed using device.

    Type d[x]. and hit tab to see the available methods.

2022-06-10 14:52:01,993 - ERROR - COM13: Invalid packet: bytearray(b'\x00')
2022-06-10 14:52:01,996 - ERROR - COM13: Invalid packet: bytearray(b'\x00')
2022-06-10 14:52:01,997 - ERROR - COM13: Invalid packet: bytearray(b'\x00')
2022-06-10 14:52:01,999 - INFO - COM13: {event: MeshSeqnumEntrySetNotification, data: {'next_block': 8192}}
Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.9.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: send(cmd.Echo("123"))

2022-06-10 14:52:04,043 - INFO - COM13: {event: DeviceEchoRsp, data: {'data': '123'}}
In [2]: db = MeshDB("database/example_database.json")

In [3]: db.provisioners
Out[3]: [{'allocated_group_range': [{'high_address': feff, 'low_address': c000}], 'name': 'BT Mesh Provisioner', 'UUID': bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'), 'allocated_unicast_range': [{'high_address': 7fff, 'low_address': 0010}]}]

In [4]: p = Provisioner(device, db)

In [5]: 2022-06-10 14:53:27,631 - INFO - COM13: Success
2022-06-10 14:53:27,634 - INFO - COM13: Success
2022-06-10 14:53:27,638 - INFO - COM13: SubnetAdd: {'subnet_handle': 0}
2022-06-10 14:53:27,639 - INFO - COM13: AppkeyAdd: {'appkey_handle': 0}
2022-06-10 14:53:27,643 - INFO - COM13: AppkeyAdd: {'appkey_handle': 1}
In [5]: p.scan_start()

In [6]: 2022-06-10 14:53:37,600 - INFO - COM13: Success
2022-06-10 14:53:40,568 - INFO - COM13: Received UUID 837f06b893b741e2855476a742d516cd with RSSI: -34 dB
In [6]: p.scan_stop()

In [7]: 2022-06-10 14:53:57,664 - INFO - COM13: Success
In [7]: p.provision(name="Light bulb 1")

In [8]: 2022-06-10 14:54:16,267 - INFO - COM13: Provision: {'context': 0}
2022-06-10 14:54:16,320 - INFO - COM13: Link established
2022-06-10 14:54:16,375 - INFO - COM13: Received capabilities
2022-06-10 14:54:16,377 - INFO - COM13: Number of elements: 1
2022-06-10 14:54:16,382 - INFO - COM13: OobUse: {'context': 0}
2022-06-10 14:54:18,709 - INFO - COM13: ECDH request received
2022-06-10 14:54:18,721 - INFO - COM13: EcdhSecret: {'context': 0}
2022-06-10 14:54:21,161 - INFO - COM13: Provisioning complete
2022-06-10 14:54:21,164 - INFO - COM13:         Address(es): 0x10-0x10
2022-06-10 14:54:21,168 - INFO - COM13:         Device key: de8827e7ad09ca9c92a2ddab51bba209
2022-06-10 14:54:21,170 - INFO - COM13:         Network key: 18eed9c2a56add85049ffc3c59ad0e12
2022-06-10 14:54:21,173 - INFO - COM13: Adding device key to subnet 0
2022-06-10 14:54:21,177 - INFO - COM13: Adding publication address of root element
2022-06-10 14:54:21,189 - INFO - COM13: DevkeyAdd: {'devkey_handle': 8}
2022-06-10 14:54:21,195 - INFO - COM13: AddrPublicationAdd: {'address_handle': 0}
2022-06-10 14:54:21,345 - INFO - COM13: Provisioning link closed
In [8]: cc = ConfigurationClient(db)
   ...:

In [9]: device.model_add(cc)

In [10]: cc.publish_set(8, 0)

In [11]: cc.composition_data_get()

In [12]: 2022-06-10 14:55:21,921 - INFO - COM13: PacketSend: {'token': 1}
2022-06-10 14:55:21,938 - INFO - COM13: {event: MeshTxComplete, data: {'token': 1}}
2022-06-10 14:55:22,028 - INFO - COM13.ConfigurationClient: Received composition data (page 0x00): {
  "cid": "0059",
  "elements": [
    {
      "models": [
        {
          "modelId": "0000"
        },
        {
          "modelId": "0002"
        },
        {
          "modelId": "1000"
        },
        {
          "modelId": "1004"
        },
        {
          "modelId": "1203"
        },
        {
          "modelId": "1204"
        }
      ],
      "index": 0,
      "location": "0000"
    }
  ],
  "pid": "0000",
  "vid": "0000",
  "features": {
    "low_power": 2,
    "friend": 0,
    "relay": 0,
    "proxy": 0
  },
  "crpl": 40
}
In [12]: cc.appkey_add(0)

In [13]: 2022-06-10 14:55:41,396 - INFO - COM13: PacketSend: {'token': 2}
2022-06-10 14:55:41,494 - INFO - COM13.ConfigurationClient: Appkey status: AccessStatus.SUCCESS
2022-06-10 14:55:41,513 - INFO - COM13.ConfigurationClient: Appkey add 0 succeded for subnet 0 at node 0010
2022-06-10 14:55:43,249 - INFO - COM13: {event: MeshTxComplete, data: {'token': 2}}
In [13]: cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1000))

In [14]: 2022-06-10 14:55:55,563 - INFO - COM13: PacketSend: {'token': 3}
2022-06-10 14:55:55,583 - INFO - COM13: {event: MeshTxComplete, data: {'token': 3}}
In [14]: cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1000))

In [15]: 2022-06-10 14:56:00,292 - INFO - COM13: PacketSend: {'token': 4}
2022-06-10 14:56:00,310 - INFO - COM13: {event: MeshTxComplete, data: {'token': 4}}
2022-06-10 14:56:00,348 - INFO - COM13.ConfigurationClient: Model app bind status: AccessStatus.SUCCESS
2022-06-10 14:56:00,358 - INFO - COM13.ConfigurationClient: Appkey bind 0 to model 1000 at 0010
In [15]: gc1 = GenericOnOffClient()

In [16]: device.model_add(gc1)

In [17]: gc1.publish_set(0, 0)

In [18]: gc1.set(True)

In [19]: 2022-06-10 14:56:58,525 - INFO - COM13: PacketSend: {'token': 5}
2022-06-10 14:56:58,542 - INFO - COM13: {event: MeshTxComplete, data: {'token': 5}}
2022-06-10 14:56:58,566 - INFO - COM13.GenericOnOffClient: Present OnOff: on
In [19]: gc1.set(False)

In [20]: 2022-06-10 14:57:08,983 - INFO - COM13: PacketSend: {'token': 6}
2022-06-10 14:57:08,997 - INFO - COM13: {event: MeshTxComplete, data: {'token': 6}}
2022-06-10 14:57:09,029 - INFO - COM13.GenericOnOffClient: off
In [20]: gc1.set(True)

In [21]: 2022-06-10 14:57:59,123 - INFO - COM13: PacketSend: {'token': 7}
2022-06-10 14:57:59,146 - INFO - COM13: {event: MeshTxComplete, data: {'token': 7}}
2022-06-10 14:57:59,180 - INFO - COM13.GenericOnOffClient: Present OnOff: on
In [21]: gc1.set(False)

In [22]: 2022-06-10 14:58:01,383 - INFO - COM13: PacketSend: {'token': 8}
2022-06-10 14:58:01,404 - INFO - COM13: {event: MeshTxComplete, data: {'token': 8}}
2022-06-10 14:58:01,436 - INFO - COM13.GenericOnOffClient: off
In [22]: gc1.set(True)

In [23]: 2022-06-10 14:58:03,101 - INFO - COM13: PacketSend: {'token': 9}
2022-06-10 14:58:03,121 - INFO - COM13: {event: MeshTxComplete, data: {'token': 9}}
2022-06-10 14:58:03,148 - INFO - COM13.GenericOnOffClient: Present OnOff: on
In [23]: gc1.set(False)

In [24]: 2022-06-10 14:58:04,780 - INFO - COM13: PacketSend: {'token': 10}
2022-06-10 14:58:04,802 - INFO - COM13: {event: MeshTxComplete, data: {'token': 10}}
2022-06-10 14:58:04,834 - INFO - COM13.GenericOnOffClient: off
In [24]: p.scan_start()

2022-06-10 14:58:23,588 - INFO - COM13: Success
In [25]: 2022-06-10 14:58:23,918 - INFO - COM13: Received UUID 6e3b906982b9462ab2a3f84e282b43b6 with RSSI: -28 dB
In [25]: p.scan_stop()

In [26]: 2022-06-10 14:58:28,935 - INFO - COM13: Success
In [26]: p.provision(name="Light Bulb 2")

In [27]: 2022-06-10 14:58:55,745 - INFO - COM13: Provision: {'context': 0}
2022-06-10 14:58:55,803 - INFO - COM13: Link established
2022-06-10 14:58:55,888 - INFO - COM13: Received capabilities
2022-06-10 14:58:55,891 - INFO - COM13: Number of elements: 1
2022-06-10 14:58:55,898 - INFO - COM13: OobUse: {'context': 0}
2022-06-10 14:58:58,205 - INFO - COM13: ECDH request received
2022-06-10 14:58:58,218 - INFO - COM13: EcdhSecret: {'context': 0}
2022-06-10 14:58:58,644 - INFO - COM13: Provisioning complete
2022-06-10 14:58:58,647 - INFO - COM13:         Address(es): 0x11-0x11
2022-06-10 14:58:58,651 - INFO - COM13:         Device key: 50327bc9916b6f17c12cb9865aa6bf41
2022-06-10 14:58:58,655 - INFO - COM13:         Network key: 18eed9c2a56add85049ffc3c59ad0e12
2022-06-10 14:58:58,658 - INFO - COM13: Adding device key to subnet 0
2022-06-10 14:58:58,662 - INFO - COM13: Adding publication address of root element
2022-06-10 14:58:58,678 - INFO - COM13: DevkeyAdd: {'devkey_handle': 9}
2022-06-10 14:58:58,682 - INFO - COM13: AddrPublicationAdd: {'address_handle': 1}
2022-06-10 14:58:58,798 - INFO - COM13: Provisioning link closed
In [27]: bb=ConfigurationClient(db)

In [28]: device.model_add(bb)

In [29]: bb.publish_set(9,1)

In [30]: bb.composition_data_get()

In [31]: 2022-06-10 15:01:07,228 - INFO - COM13: PacketSend: {'token': 11}
2022-06-10 15:01:07,245 - INFO - COM13: {event: MeshTxComplete, data: {'token': 11}}
2022-06-10 15:01:07,365 - INFO - COM13.ConfigurationClient: Received composition data (page 0x00): {
  "cid": "0059",
  "elements": [
    {
      "models": [
        {
          "modelId": "0000"
        },
        {
          "modelId": "0002"
        },
        {
          "modelId": "1000"
        },
        {
          "modelId": "1004"
        },
        {
          "modelId": "1203"
        },
        {
          "modelId": "1204"
        }
      ],
      "index": 0,
      "location": "0000"
    }
  ],
  "pid": "0000",
  "vid": "0000",
  "features": {
    "low_power": 2,
    "friend": 0,
    "relay": 0,
    "proxy": 0
  },
  "crpl": 40
}
2022-06-10 15:01:07,388 - INFO - COM13.ConfigurationClient: Received composition data (page 0x00): {
  "cid": "0059",
  "elements": [
    {
      "models": [
        {
          "modelId": "0000"
        },
        {
          "modelId": "0002"
        },
        {
          "modelId": "1000"
        },
        {
          "modelId": "1004"
        },
        {
          "modelId": "1203"
        },
        {
          "modelId": "1204"
        }
      ],
      "index": 0,
      "location": "0000"
    }
  ],
  "pid": "0000",
  "vid": "0000",
  "features": {
    "low_power": 2,
    "friend": 0,
    "relay": 0,
    "proxy": 0
  },
  "crpl": 40
}
In [31]: bb.appkey_add(0)

In [32]: 2022-06-10 15:02:05,994 - INFO - COM13: PacketSend: {'token': 12}
2022-06-10 15:02:06,065 - INFO - COM13: {event: MeshTxComplete, data: {'token': 12}}
2022-06-10 15:02:06,094 - INFO - COM13.ConfigurationClient: Appkey status: AccessStatus.SUCCESS
2022-06-10 15:02:06,106 - INFO - COM13.ConfigurationClient: Appkey bind 0 succeded for subnet 0 at node 0011
2022-06-10 15:02:06,114 - INFO - COM13.ConfigurationClient: Appkey status: AccessStatus.SUCCESS
2022-06-10 15:02:06,133 - INFO - COM13.ConfigurationClient: Appkey add 0 succeded for subnet 0 at node 0011
In [32]: bb.model_app_bind(db.nodes[1].unicast_address + 1, 0, mt.ModelId(0x1000))

2022-06-10 15:03:49,251 - INFO - COM13: PacketSend: {'token': 13}
In [33]: 2022-06-10 15:03:49,273 - INFO - COM13: {event: MeshTxComplete, data: {'token': 13}}
2022-06-10 15:03:49,302 - INFO - COM13.ConfigurationClient: Model app bind status: AccessStatus.INVALID_ADDRESS
2022-06-10 15:03:49,305 - INFO - COM13.ConfigurationClient: Model app bind status: AccessStatus.INVALID_ADDRESS
In [33]: bb.model_app_bind(db.nodes[1].unicast_address + 1, 0, mt.ModelId(0x1000))

In [34]: 2022-06-10 15:04:01,448 - INFO - COM13: PacketSend: {'token': 14}
2022-06-10 15:04:01,472 - INFO - COM13: {event: MeshTxComplete, data: {'token': 14}}
In [34]: bb.model_app_bind(db.nodes[1].unicast_address + 1, 0, mt.ModelId(0x1000))

In [35]: 2022-06-10 15:04:05,134 - INFO - COM13: PacketSend: {'token': 15}
2022-06-10 15:04:05,157 - INFO - COM13: {event: MeshTxComplete, data: {'token': 15}}
2022-06-10 15:04:05,187 - INFO - COM13.ConfigurationClient: Model app bind status: AccessStatus.INVALID_ADDRESS
2022-06-10 15:04:05,192 - INFO - COM13.ConfigurationClient: Model app bind status: AccessStatus.INVALID_ADDRESS


My ultimate goal is to send different messages to different Dongles from DK using Mesh Serial example .There is no clear documentation
for using PyACI .Please provide me steps to do the required things.

Thankyou .

-Vicky

Parents
  • Hi,

    Configuration of a node is always done using the configuration server model on the primary element, for all models (on all elements) on that node.

    For that reason, the address parameter for the PyACI model_app_bind() should be the unicast address of the node that you want to do the configuration on, i.e. the unicast address of the configuration server model, on the primary element of the node.

    I do not know what you attempt at using "db.nodes[1].unicast_address + 1", which would either be the second element on node 1 or if node 1 has only one element (the primary element) the first element on node 2, or possibly there are no nodes using that unicast address at all. Removing the "+ 1" should do the trick.

    Regards,
    Terje

Reply
  • Hi,

    Configuration of a node is always done using the configuration server model on the primary element, for all models (on all elements) on that node.

    For that reason, the address parameter for the PyACI model_app_bind() should be the unicast address of the node that you want to do the configuration on, i.e. the unicast address of the configuration server model, on the primary element of the node.

    I do not know what you attempt at using "db.nodes[1].unicast_address + 1", which would either be the second element on node 1 or if node 1 has only one element (the primary element) the first element on node 2, or possibly there are no nodes using that unicast address at all. Removing the "+ 1" should do the trick.

    Regards,
    Terje

Children
  • I have changed the code as you said,

    bb.model_app_bind(db.nodes[1].unicast_address , 0, mt.ModelId(0x1000)) // First One
    bb.model_app_bind(db.nodes[0].unicast_address , 0, mt.ModelId(0x1000)) // Second One

    I have done all the above mentioned steps with these two codes , one by one in two tests.

    Both of the time , I get to control the LED of the first connected node only ( Address - 0010).It won't control the LED of secondly connected node ( Address - 0011).I have included the output values from PyACI as follows :

    In [1]: send(cmd.Echo("123"))
    
    In [2]: 2022-06-11 11:54:19,267 - INFO - COM13: {event: DeviceEchoRsp, data: {'data': '123'}}
    In [2]: db = MeshDB("database/example_database.json")
    
    In [3]: db.provisioners
    Out[3]: [{'UUID': bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'), 'allocated_group_range': [{'high_address': feff, 'low_address': c000}], 'name': 'BT Mesh Provisioner', 'allocated_unicast_range': [{'high_address': 7fff, 'low_address': 0010}]}]
    
    In [4]: p = Provisioner(device, db)
    
    In [5]: 2022-06-11 11:55:17,069 - INFO - COM13: Success
    2022-06-11 11:55:17,073 - INFO - COM13: Success
    2022-06-11 11:55:17,078 - INFO - COM13: SubnetAdd: {'subnet_handle': 0}
    2022-06-11 11:55:17,083 - INFO - COM13: AppkeyAdd: {'appkey_handle': 0}
    2022-06-11 11:55:17,087 - INFO - COM13: AppkeyAdd: {'appkey_handle': 1}
    In [5]: p.scan_start()
    
    In [6]: 2022-06-11 11:55:24,174 - INFO - COM13: Success
    2022-06-11 11:55:26,103 - INFO - COM13: Received UUID 6e3b906982b9462ab2a3f84e282b43b6 with RSSI: -30 dB
    In [6]: p.scan_stop()
    
    In [7]: 2022-06-11 11:55:32,579 - INFO - COM13: Success
    In [7]: p.provision(name="Light bulb 1")
    
    In [8]: 2022-06-11 11:55:39,530 - INFO - COM13: Provision: {'context': 0}
    2022-06-11 11:55:39,604 - INFO - COM13: Link established
    2022-06-11 11:55:39,677 - INFO - COM13: Received capabilities
    2022-06-11 11:55:39,679 - INFO - COM13: Number of elements: 1
    2022-06-11 11:55:39,685 - INFO - COM13: OobUse: {'context': 0}
    2022-06-11 11:55:41,916 - INFO - COM13: ECDH request received
    2022-06-11 11:55:41,931 - INFO - COM13: EcdhSecret: {'context': 0}
    2022-06-11 11:55:46,381 - INFO - COM13: Provisioning complete
    2022-06-11 11:55:46,384 - INFO - COM13:         Address(es): 0x10-0x10
    2022-06-11 11:55:46,389 - INFO - COM13:         Device key: 86a118c392505ab3e18128ca5776c12d
    2022-06-11 11:55:46,394 - INFO - COM13:         Network key: 18eed9c2a56add85049ffc3c59ad0e12
    2022-06-11 11:55:46,398 - INFO - COM13: Adding device key to subnet 0
    2022-06-11 11:55:46,405 - INFO - COM13: Adding publication address of root element
    2022-06-11 11:55:46,419 - INFO - COM13: DevkeyAdd: {'devkey_handle': 8}
    2022-06-11 11:55:46,424 - INFO - COM13: AddrPublicationAdd: {'address_handle': 0}
    2022-06-11 11:55:46,534 - INFO - COM13: Provisioning link closed
    In [8]: cc = ConfigurationClient(db)
    
    In [9]: device.model_add(cc)
    
    In [10]:  cc.publish_set(8, 0)
    
    In [11]:  cc.composition_data_get()
    
    In [12]: 2022-06-11 11:56:25,691 - INFO - COM13: PacketSend: {'token': 1}
    2022-06-11 11:56:25,713 - INFO - COM13: {event: MeshTxComplete, data: {'token': 1}}
    In [12]:  cc.composition_data_get()
    
    In [13]: 2022-06-11 11:56:31,350 - INFO - COM13: PacketSend: {'token': 2}
    2022-06-11 11:56:31,367 - INFO - COM13: {event: MeshTxComplete, data: {'token': 2}}
    2022-06-11 11:56:31,463 - INFO - COM13.ConfigurationClient: Received composition data (page 0x00): {
      "crpl": 40,
      "vid": "0000",
      "pid": "0000",
      "elements": [
        {
          "models": [
            {
              "modelId": "0000"
            },
            {
              "modelId": "0002"
            },
            {
              "modelId": "1000"
            },
            {
              "modelId": "1004"
            },
            {
              "modelId": "1203"
            },
            {
              "modelId": "1204"
            }
          ],
          "index": 0,
          "location": "0000"
        }
      ],
      "cid": "0059",
      "features": {
        "relay": 0,
        "proxy": 0,
        "low_power": 2,
        "friend": 0
      }
    }
    In [13]: cc.appkey_add(0)
    
    In [14]: 2022-06-11 11:56:53,658 - INFO - COM13: PacketSend: {'token': 3}
    2022-06-11 11:56:53,728 - INFO - COM13: {event: MeshTxComplete, data: {'token': 3}}
    2022-06-11 11:56:53,757 - INFO - COM13.ConfigurationClient: Appkey status: AccessStatus.SUCCESS
    2022-06-11 11:56:53,768 - INFO - COM13.ConfigurationClient: Appkey add 0 succeded for subnet 0 at node 0010
    In [14]: cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1000))
    
    In [15]: 2022-06-11 11:57:19,136 - INFO - COM13: PacketSend: {'token': 4}
    2022-06-11 11:57:19,160 - INFO - COM13: {event: MeshTxComplete, data: {'token': 4}}
    2022-06-11 11:57:19,196 - INFO - COM13.ConfigurationClient: Model app bind status: AccessStatus.SUCCESS
    2022-06-11 11:57:19,207 - INFO - COM13.ConfigurationClient: Appkey bind 0 to model 1000 at 0010
    In [15]: gc1 = GenericOnOffClient()
    
    In [16]: device.model_add(gc1)
    
    In [17]: gc1.publish_set(0, 0)
    
    In [18]: gc1.set(True)
    
    In [19]: 2022-06-11 11:57:52,903 - INFO - COM13: PacketSend: {'token': 5}
    2022-06-11 11:57:52,924 - INFO - COM13: {event: MeshTxComplete, data: {'token': 5}}
    2022-06-11 11:57:52,949 - INFO - COM13.GenericOnOffClient: Present OnOff: on
    In [19]:  gc1.set(False)
    
    In [20]: 2022-06-11 11:58:04,065 - INFO - COM13: PacketSend: {'token': 6}
    2022-06-11 11:58:04,088 - INFO - COM13: {event: MeshTxComplete, data: {'token': 6}}
    2022-06-11 11:58:04,116 - INFO - COM13.GenericOnOffClient: off
    In [20]: p.scan_start()
    
    2022-06-11 11:59:20,973 - INFO - COM13: SuccessIn [21]:                                                                 
    2022-06-11 11:59:22,583 - INFO - COM13: Received UUID 837f06b893b741e2855476a742d516cd with RSSI: -25 dB
    In [21]: p.scan_stop()
    
    2022-06-11 11:59:29,100 - INFO - COM13: SuccessIn [22]:                                                                 
    In [22]: p.provision(name="Light Bulb 2")
    
    In [23]: 2022-06-11 11:59:37,206 - INFO - COM13: Provision: {'context': 0}
    2022-06-11 11:59:37,281 - INFO - COM13: Link established
    2022-06-11 11:59:37,335 - INFO - COM13: Received capabilities
    2022-06-11 11:59:37,338 - INFO - COM13: Number of elements: 1
    2022-06-11 11:59:37,346 - INFO - COM13: OobUse: {'context': 0}
    2022-06-11 11:59:37,601 - INFO - COM13: ECDH request received
    2022-06-11 11:59:37,614 - INFO - COM13: EcdhSecret: {'context': 0}
    2022-06-11 11:59:38,032 - INFO - COM13: Provisioning complete
    2022-06-11 11:59:38,035 - INFO - COM13:         Address(es): 0x11-0x11
    2022-06-11 11:59:38,038 - INFO - COM13:         Device key: f2440878dd6a711439eacc7d328cc0ed
    2022-06-11 11:59:38,042 - INFO - COM13:         Network key: 18eed9c2a56add85049ffc3c59ad0e12
    2022-06-11 11:59:38,045 - INFO - COM13: Adding device key to subnet 0
    2022-06-11 11:59:38,049 - INFO - COM13: Adding publication address of root element
    2022-06-11 11:59:38,063 - INFO - COM13: DevkeyAdd: {'devkey_handle': 9}
    2022-06-11 11:59:38,067 - INFO - COM13: AddrPublicationAdd: {'address_handle': 1}
    2022-06-11 11:59:38,200 - INFO - COM13: Provisioning link closed
    In [23]: bb=ConfigurationClient(db)
    
    In [24]: device.model_add(bb)
    
    In [25]: bb.publish_set(9,1)
    
    In [26]: bb.composition_data_get()
    
    In [27]: 2022-06-11 12:00:43,651 - INFO - COM13: PacketSend: {'token': 7}
    2022-06-11 12:00:43,669 - INFO - COM13: {event: MeshTxComplete, data: {'token': 7}}
    2022-06-11 12:00:43,766 - INFO - COM13.ConfigurationClient: Received composition data (page 0x00): {
      "crpl": 40,
      "vid": "0000",
      "pid": "0000",
      "elements": [
        {
          "models": [
            {
              "modelId": "0000"
            },
            {
              "modelId": "0002"
            },
            {
              "modelId": "1000"
            },
            {
              "modelId": "1004"
            },
            {
              "modelId": "1203"
            },
            {
              "modelId": "1204"
            }
          ],
          "index": 0,
          "location": "0000"
        }
      ],
      "cid": "0059",
      "features": {
        "relay": 0,
        "proxy": 0,
        "low_power": 2,
        "friend": 0
      }
    }
    2022-06-11 12:00:43,792 - INFO - COM13.ConfigurationClient: Received composition data (page 0x00): {
      "crpl": 40,
      "vid": "0000",
      "pid": "0000",
      "elements": [
        {
          "models": [
            {
              "modelId": "0000"
            },
            {
              "modelId": "0002"
            },
            {
              "modelId": "1000"
            },
            {
              "modelId": "1004"
            },
            {
              "modelId": "1203"
            },
            {
              "modelId": "1204"
            }
          ],
          "index": 0,
          "location": "0000"
        }
      ],
      "cid": "0059",
      "features": {
        "relay": 0,
        "proxy": 0,
        "low_power": 2,
        "friend": 0
      }
    }
    In [27]: bb.appkey_add(0)
    
    2022-06-11 12:01:15,531 - INFO - COM13: PacketSend: {'token': 8}
    In [28]: 2022-06-11 12:01:15,614 - INFO - COM13: {event: MeshTxComplete, data: {'token': 8}}
    2022-06-11 12:01:15,648 - INFO - COM13.ConfigurationClient: Appkey status: AccessStatus.SUCCESS
    2022-06-11 12:01:15,664 - INFO - COM13.ConfigurationClient: Appkey bind 0 succeded for subnet 0 at node 0011
    2022-06-11 12:01:15,669 - INFO - COM13.ConfigurationClient: Appkey status: AccessStatus.SUCCESS
    2022-06-11 12:01:15,685 - INFO - COM13.ConfigurationClient: Appkey add 0 succeded for subnet 0 at node 0011
    In [28]: bb.model_app_bind(db.nodes[1].unicast_address , 0, mt.ModelId(0x1000))
    
    In [29]: 2022-06-11 12:02:28,505 - INFO - COM13: PacketSend: {'token': 9}
    2022-06-11 12:02:28,532 - INFO - COM13: {event: MeshTxComplete, data: {'token': 9}}
    2022-06-11 12:02:28,556 - INFO - COM13.ConfigurationClient: Model app bind status: AccessStatus.SUCCESS
    2022-06-11 12:02:28,569 - INFO - COM13.ConfigurationClient: Appkey bind 0 to model 1000 at 0011
    2022-06-11 12:02:28,570 - INFO - COM13.ConfigurationClient: Model app bind status: AccessStatus.SUCCESS
    2022-06-11 12:02:28,578 - INFO - COM13.ConfigurationClient: Appkey bind 0 to model 1000 at 0011
    In [29]: gc2 = GenericOnOffClient()
    
    In [30]: device.model_add(gc2)
    
    In [31]: gc2.publish_set(0, 0)
    
    In [32]: gc2.set(True)
    
    In [33]: 2022-06-11 12:03:41,731 - INFO - COM13: PacketSend: {'token': 10}
    2022-06-11 12:03:41,751 - INFO - COM13: {event: MeshTxComplete, data: {'token': 10}}
    2022-06-11 12:03:41,776 - INFO - COM13.GenericOnOffClient: Present OnOff: on
    2022-06-11 12:03:41,778 - INFO - COM13.GenericOnOffClient: Present OnOff: on
    In [33]: gc3 = GenericOnOffClient()
    
    In [34]: device.model_add(gc3)
    
    In [35]: gc3.publish_set(9, 1)
    
    In [36]: gc3.set(True)
    
    In [37]: 2022-06-11 12:06:37,934 - INFO - COM13: PacketSend: {'token': 11}
    2022-06-11 12:06:37,949 - INFO - COM13: {event: MeshTxComplete, data: {'token': 11}}
    In [37]: gc3.set(True)
    
    In [38]: 2022-06-11 12:06:41,140 - INFO - COM13: PacketSend: {'token': 12}
    2022-06-11 12:06:41,158 - INFO - COM13: {event: MeshTxComplete, data: {'token': 12}}
    In [38]: gc3.set(True)
    
    In [39]: 2022-06-11 12:06:43,724 - INFO - COM13: PacketSend: {'token': 13}
    2022-06-11 12:06:43,739 - INFO - COM13: {event: MeshTxComplete, data: {'token': 13}}
    In [39]: gc3.publish_set(0,0)
    
    In [40]: gc3.set(True)
    
    In [41]: 2022-06-11 12:07:19,260 - INFO - COM13: PacketSend: {'token': 14}
    2022-06-11 12:07:19,283 - INFO - COM13: {event: MeshTxComplete, data: {'token': 14}}
    2022-06-11 12:07:19,311 - INFO - COM13.GenericOnOffClient: Present OnOff: on
    2022-06-11 12:07:19,314 - INFO - COM13.GenericOnOffClient: Present OnOff: on
    2022-06-11 12:07:19,317 - INFO - COM13.GenericOnOffClient: Present OnOff: on
    In [41]: gc3.set(False)
    
    In [42]: 2022-06-11 12:07:26,888 - INFO - COM13: PacketSend: {'token': 15}
    2022-06-11 12:07:26,911 - INFO - COM13: {event: MeshTxComplete, data: {'token': 15}}
    2022-06-11 12:07:26,944 - INFO - COM13.GenericOnOffClient: off
    2022-06-11 12:07:26,949 - INFO - COM13.GenericOnOffClient: off
    2022-06-11 12:07:26,952 - INFO - COM13.GenericOnOffClient: off
    In [42]: ab = GenericOnOffClient()
    
    In [43]: device.model_add(ab)
    
    In [44]: ab.publish_set(0,0)
    
    In [45]: ab.set(True)
    
    In [46]: 2022-06-11 12:08:35,356 - INFO - COM13: PacketSend: {'token': 16}
    2022-06-11 12:08:35,375 - INFO - COM13: {event: MeshTxComplete, data: {'token': 16}}
    2022-06-11 12:08:35,400 - INFO - COM13.GenericOnOffClient: Present OnOff: on
    2022-06-11 12:08:35,402 - INFO - COM13.GenericOnOffClient: Present OnOff: on
    2022-06-11 12:08:35,404 - INFO - COM13.GenericOnOffClient: Present OnOff: on
    2022-06-11 12:08:35,406 - INFO - COM13.GenericOnOffClient: Present OnOff: on

    I have included the video where I control the Dongle with Address - 0010, But I am unable to control the Dongle having Address - 0011 .

    I want to control the LEDs of these two Dongles separetly from commands using PyACI.Please do some help to achieve that.

    Thankyou.

    -Vicky

  • Hi,

    I have looked further into the PyACI. Based on the descriptions of your setup, this is what seems to be the issues:

    When you use db.nodes[0].unicast_address, this is the unicast_address registered in the database file for node 0. This may or may not be the case (it is hard to tell from the log, but you can check the database file at <mesh SDK folder>/scripts/interactive_pyaci/database/example_database.json in order to figure out). This is most likely OK as is, but checking the json database file does not hurt. Alternatively, you should be able to use the unicast address manually.

    When configuring the (local, PyACI side) Generic On Off Client, setting the publish address, you should set app key handle 0 and the address handle for the node. It is such: "publish_set(<appkey_handle>, <address_handle>)" For your example, where you use the app key with index 0 for both nodes, it should be "gc1.publish_set(0, 0)" and "gc2.publish_set(0, 1)".

    Finally I must correct a previous statement, in that it actually is the unicast address of the element that should be used as address argument to model_app_bind(), since the addressing of the message itself is handled by the previous publish_set() on the configuration client. For your example, though, with two nodes having one element each, using the unicast address of the node (as you corrected your code to) is correct. Adding to the primary unicast address is only correct when there are multiple elements on the node.

    Regards,
    Terje

Related