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

Parents
  • Hi Sai,

    While getting the PyACI script to work, I ran into the same error.

    The cause of the error, for my case, was that the nodes at index 0 (db.nodes[0]) was not the Light Bulb node that I am trying to interact with.
    When I determine and use the correct node index, things work as it

    should.

    Could you please check your database.json and see if the nodes you want to talk with are not at index 0?

    If you need help with checking that, you could copy the content of the file into a code block here.

    Regards,

    Hieu

  • Hello

    I apologise for my late response. Here is my content and i am trying to provision Sensor Server Example from nordic samples. Still not able to resolve this issue.

    Regards

  • Hello Hieu

    Yeah i did, i dont think so its working correctly. when i chat privately i should get in another screen right? . Also i checked with server and client example same thing happens i get error looks like its not working between 2 devices.

    
    In [1]: db = MeshDB("database/example_database.json")
    
    In [2]: db.provisioners
    Out[2]: [{'name': 'BT Mesh Provisioner', 'UUID': _UUID(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'), 'allocated_unicast_range': [{'low_address': 0010, 'high_address': 7fff}], 'allocated_group_range': [{'low_address': c000, 'high_address': feff}]}]
    
    In [3]: p = Provisioner(device, db)
    
    In [4]: 2023-04-13 15:11:26,751 - INFO - COM6: Success
    2023-04-13 15:11:26,751 - INFO - COM6: Success
    2023-04-13 15:11:26,751 - INFO - COM6: SubnetAdd: {'subnet_handle': 0}
    2023-04-13 15:11:26,766 - INFO - COM6: AppkeyAdd: {'appkey_handle': 0}
    2023-04-13 15:11:26,768 - INFO - COM6: AppkeyAdd: {'appkey_handle': 1}
    In [4]:
    
    In [4]: p.scan_start()
    
    2023-04-13 15:11:34,934 - INFO - COM6: Success
    In [5]: 2023-04-13 15:11:39,722 - INFO - COM6: Received UUID 7faea34d1484433380515cb2eb7b8ccc with RSSI: -61 dB
    In [5]: p.scan_stop()
    
    2023-04-13 15:11:42,136 - INFO - COM6: Success
    In [6]: p.provision(name="chat")
    
    In [7]: 2023-04-13 15:11:47,455 - INFO - COM6: Provision: {'context': 0}
    2023-04-13 15:11:47,499 - INFO - COM6: Link established
    2023-04-13 15:11:47,641 - INFO - COM6: Received capabilities
    2023-04-13 15:11:47,641 - INFO - COM6: Number of elements: 1
    2023-04-13 15:11:47,641 - INFO - COM6: OobUse: {'context': 0}
    2023-04-13 15:11:49,959 - INFO - COM6: ECDH request received
    2023-04-13 15:11:49,971 - INFO - COM6: EcdhSecret: {'context': 0}
    2023-04-13 15:11:50,586 - INFO - COM6: Provisioning complete
    2023-04-13 15:11:50,586 - INFO - COM6:  Address(es): 0x10-0x10
    2023-04-13 15:11:50,586 - INFO - COM6:  Device key: REDACTED
    2023-04-13 15:11:50,586 - INFO - COM6:  Network key: REDACTED
    2023-04-13 15:11:50,586 - INFO - COM6: Adding device key to subnet 0
    2023-04-13 15:11:50,586 - INFO - COM6: Adding publication address of root element
    2023-04-13 15:11:50,586 - INFO - COM6: DevkeyAdd: {'devkey_handle': 8}
    2023-04-13 15:11:50,598 - INFO - COM6: AddrPublicationAdd: {'address_handle': 0}
    2023-04-13 15:11:50,761 - INFO - COM6: Provisioning link closed
    In [7]:
    
    In [7]: cc = ConfigurationClient(db)
    
    In [8]: device.model_add(cc)
    
    In [9]: cc.publish_set(8, 0)
    
    In [10]: cc.composition_data_get()
    
    In [11]: 2023-04-13 15:12:33,072 - INFO - COM6: PacketSend: {'token': 1}
    2023-04-13 15:12:33,097 - INFO - COM6: {event: MeshTxComplete, data: {'token': 1}}
    2023-04-13 15:12:33,242 - INFO - COM6.ConfigurationClient: Received composition data (page 0x00): {
      "cid": "0059",
      "pid": "0000",
      "vid": "0000",
      "crpl": 10,
      "features": {
        "relay": 0,
        "proxy": 0,
        "friend": 0,
        "low_power": 2
      },
      "elements": [
        {
          "index": 0,
          "location": "0001",
          "models": [
            {
              "modelId": "0000"
            },
            {
              "modelId": "0002"
            },
            {
              "modelId": "0059000a"
            }
          ]
        }
      ]
    }
    In [11]:
    
    In [11]: cc.appkey_add(0)
    
    In [12]: 2023-04-13 15:12:40,890 - INFO - COM6: PacketSend: {'token': 2}
    2023-04-13 15:12:40,945 - INFO - COM6: {event: MeshTxComplete, data: {'token': 2}}
    2023-04-13 15:12:41,017 - INFO - COM6.ConfigurationClient: Appkey status: AccessStatus.SUCCESS
    2023-04-13 15:12:41,018 - INFO - COM6.ConfigurationClient: Appkey add 0 succeded for subnet 0 at node 0010
    In [12]:
    
    In [12]: cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x000a,0x0059))
    
    In [13]: 2023-04-13 15:12:49,930 - INFO - COM6: PacketSend: {'token': 3}
    2023-04-13 15:12:49,944 - INFO - COM6: {event: MeshTxComplete, data: {'token': 3}}
    2023-04-13 15:12:49,958 - INFO - COM6.ConfigurationClient: Model app bind status: AccessStatus.SUCCESS
    2023-04-13 15:12:49,967 - INFO - COM6.ConfigurationClient: Appkey bind 0 to model 0059000a at 0010
    In [13]:
    
    In [13]: p.scan_start()
    
    2023-04-13 15:13:53,372 - INFO - COM6: Success
    In [14]: 2023-04-13 15:13:56,384 - INFO - COM6: Received UUID 3442243ef35a46a58bbddbc10ca5395a with RSSI: -53 dB
    In [14]:
    
    In [14]: p.scan_stop()
    
    2023-04-13 15:14:01,005 - INFO - COM6: Success
    In [15]: p.provision(name="chat1")
    
    In [16]: 2023-04-13 15:14:18,193 - INFO - COM6: Provision: {'context': 0}
    2023-04-13 15:14:18,225 - INFO - COM6: Link established
    2023-04-13 15:14:18,364 - INFO - COM6: Received capabilities
    2023-04-13 15:14:18,364 - INFO - COM6: Number of elements: 1
    2023-04-13 15:14:18,364 - INFO - COM6: OobUse: {'context': 0}
    2023-04-13 15:14:20,694 - INFO - COM6: ECDH request received
    2023-04-13 15:14:20,711 - INFO - COM6: EcdhSecret: {'context': 0}
    2023-04-13 15:14:21,333 - INFO - COM6: Provisioning complete
    2023-04-13 15:14:21,335 - INFO - COM6:  Address(es): 0x11-0x11
    2023-04-13 15:14:21,335 - INFO - COM6:  Device key: REDACTED
    2023-04-13 15:14:21,335 - INFO - COM6:  Network key: REDACTED
    2023-04-13 15:14:21,335 - INFO - COM6: Adding device key to subnet 0
    2023-04-13 15:14:21,335 - INFO - COM6: Adding publication address of root element
    2023-04-13 15:14:21,341 - INFO - COM6: DevkeyAdd: {'devkey_handle': 9}
    2023-04-13 15:14:21,341 - INFO - COM6: AddrPublicationAdd: {'address_handle': 1}
    2023-04-13 15:14:21,487 - INFO - COM6: Provisioning link closed
    In [16]: #
    
    In [17]: cc.publish_set(9, 1)
    
    In [18]: cc.composition_data_get()
    
    In [19]: 2023-04-13 15:15:32,144 - INFO - COM6: PacketSend: {'token': 4}
    2023-04-13 15:15:32,152 - INFO - COM6: {event: MeshTxComplete, data: {'token': 4}}
    2023-04-13 15:15:32,310 - INFO - COM6.ConfigurationClient: Received composition data (page 0x00): {
      "cid": "0059",
      "pid": "0000",
      "vid": "0000",
      "crpl": 10,
      "features": {
        "relay": 0,
        "proxy": 0,
        "friend": 0,
        "low_power": 2
      },
      "elements": [
        {
          "index": 0,
          "location": "0001",
          "models": [
            {
              "modelId": "0000"
            },
            {
              "modelId": "0002"
            },
            {
              "modelId": "0059000a"
            }
          ]
        }
      ]
    }
    In [19]:
    
    In [19]: cc.appkey_add(0)
    
    In [20]: 2023-04-13 15:15:39,526 - INFO - COM6: PacketSend: {'token': 5}
    2023-04-13 15:15:39,574 - INFO - COM6: {event: MeshTxComplete, data: {'token': 5}}
    2023-04-13 15:15:39,653 - INFO - COM6.ConfigurationClient: Appkey status: AccessStatus.SUCCESS
    2023-04-13 15:15:39,653 - INFO - COM6.ConfigurationClient: Appkey add 0 succeded for subnet 0 at node 0011
    In [20]:
    
    In [20]: cc.model_app_bind(db.nodes[0].unicast_address + 1, 0, mt.ModelId(0x000a,0x0059))
    
    In [21]: 2023-04-13 15:15:46,199 - INFO - COM6: PacketSend: {'token': 6}
    2023-04-13 15:15:46,220 - INFO - COM6: {event: MeshTxComplete, data: {'token': 6}}
    2023-04-13 15:15:46,229 - INFO - COM6.ConfigurationClient: Model app bind status: AccessStatus.SUCCESS
    2023-04-13 15:15:46,231 - INFO - COM6.ConfigurationClient: Appkey bind 0 to model 0059000a at 0011
    In [21]:
    
    In [21]: cc.model_publication_set(db.nodes[0].unicast_address + 1, mt.ModelId(0x000a,0x0059), mt.Publish(db.nodes[0].unicast_address, index=0, ttl=1))
    
    In [22]: 2023-04-13 15:15:52,625 - INFO - COM6: PacketSend: {'token': 7}
    2023-04-13 15:15:52,677 - INFO - COM6: {event: MeshTxComplete, data: {'token': 7}}
    2023-04-13 15:15:52,817 - INFO - COM6.ConfigurationClient: Model publication status: AccessStatus.SUCCESS
    2023-04-13 15:15:52,817 - INFO - COM6.ConfigurationClient: Publication status for model 0059000a at element 17 to {'address': 0010, 'index': 0, 'ttl': 1, 'period': 0, 'retransmit': {'count': 0, 'interval_steps': 0, 'interval': 50}, 'credentials': <FriendshipCredentials.DISABLED: 0>}
    In [22]:
    
    In [22]: cc.publish_set(8, 0)
    
    In [23]: cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x000a,0x0059), mt.Publish(db.groups[0].address, index=0, ttl=1))
    
    In [24]: 2023-04-13 15:16:05,136 - INFO - COM6: PacketSend: {'token': 8}
    2023-04-13 15:16:05,185 - INFO - COM6: {event: MeshTxComplete, data: {'token': 8}}
    2023-04-13 15:16:05,326 - INFO - COM6.ConfigurationClient: Model publication status: AccessStatus.SUCCESS
    2023-04-13 15:16:05,329 - INFO - COM6.ConfigurationClient: Publication status for model 0059000a at element 16 to {'address': c001, 'index': 0, 'ttl': 1, 'period': 0, 'retransmit': {'count': 0, 'interval_steps': 0, 'interval': 50}, 'credentials': <FriendshipCredentials.DISABLED: 0>}
    In [24]:
    
    In [24]: cc.publish_set(9, 1)
    
    In [25]: cc.model_subscription_add(db.nodes[0].unicast_address + 1, db.groups[0].address, mt.ModelId(0x000a,0x0059))
    
    In [26]: 2023-04-13 15:16:15,850 - INFO - COM6: PacketSend: {'token': 9}
    2023-04-13 15:16:15,870 - INFO - COM6: {event: MeshTxComplete, data: {'token': 9}}
    2023-04-13 15:16:15,870 - INFO - COM6.ConfigurationClient: Model subscription status: AccessStatus.SUCCESS
    2023-04-13 15:16:15,882 - INFO - COM6.ConfigurationClient: Added subscription 'c001' to model 0059000a at element 0011

    this is server and client output, 1st it was like "error getting chip temperature", after i set publish its like "<err> bt_mesh_access: Failed to publish (err -22)". There is problem with this command"cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1101), mt.Publish(db.groups[0].address, index=0, ttl=1))".

    
    In [1]: db = MeshDB("database/example_database.json")
    
    In [2]: db.provisioners
    Out[2]: [{'name': 'BT Mesh Provisioner', 'UUID': _UUID(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'), 'allocated_unicast_range': [{'low_address': 0010, 'high_address': 7fff}], 'allocated_group_range': [{'low_address': c000, 'high_address': feff}]}]
    
    In [3]: p = Provisioner(device, db)
    
    In [4]: 2023-04-13 15:50:23,613 - INFO - COM6: Success
    2023-04-13 15:50:23,617 - INFO - COM6: Success
    2023-04-13 15:50:23,622 - INFO - COM6: SubnetAdd: {'subnet_handle': 0}
    2023-04-13 15:50:23,624 - INFO - COM6: AppkeyAdd: {'appkey_handle': 0}
    2023-04-13 15:50:23,628 - INFO - COM6: AppkeyAdd: {'appkey_handle': 1}
    In [4]:
    
    In [4]: p.scan_start()
    
    2023-04-13 15:50:29,875 - INFO - COM6: Success
    In [5]: 2023-04-13 15:50:33,463 - INFO - COM6: Received UUID 0d49c695b0b444efb2b6396a4f4b8b10 with RSSI: -75 dB
    In [5]:
    
    In [5]: p.scan_stop()
    
    2023-04-13 15:50:35,783 - INFO - COM6: Success
    In [6]: p.provision(name="server")
    
    In [7]: 2023-04-13 15:50:45,992 - INFO - COM6: Provision: {'context': 0}
    2023-04-13 15:50:46,029 - INFO - COM6: Link established
    2023-04-13 15:50:46,190 - INFO - COM6: Received capabilities
    2023-04-13 15:50:46,190 - INFO - COM6: Number of elements: 1
    2023-04-13 15:50:46,200 - INFO - COM6: OobUse: {'context': 0}
    2023-04-13 15:50:48,557 - INFO - COM6: ECDH request received
    2023-04-13 15:50:48,557 - INFO - COM6: EcdhSecret: {'context': 0}
    2023-04-13 15:50:49,454 - INFO - COM6: Provisioning complete
    2023-04-13 15:50:49,454 - INFO - COM6:  Address(es): 0x10-0x10
    2023-04-13 15:50:49,454 - INFO - COM6:  Device key: REDACTED
    2023-04-13 15:50:49,460 - INFO - COM6:  Network key: REDACTED
    2023-04-13 15:50:49,461 - INFO - COM6: Adding device key to subnet 0
    2023-04-13 15:50:49,461 - INFO - COM6: Adding publication address of root element
    2023-04-13 15:50:49,467 - INFO - COM6: DevkeyAdd: {'devkey_handle': 8}
    2023-04-13 15:50:49,467 - INFO - COM6: AddrPublicationAdd: {'address_handle': 0}
    2023-04-13 15:50:49,607 - INFO - COM6: Provisioning link closed
    In [7]:
    
    In [7]: cc = ConfigurationClient(db)
    
    In [8]: device.model_add(cc)
    
    In [9]: cc.publish_set(8, 0)
    
    In [10]: cc.composition_data_get()
    
    In [11]: 2023-04-13 15:51:08,633 - INFO - COM6: PacketSend: {'token': 1}
    2023-04-13 15:51:08,654 - INFO - COM6: {event: MeshTxComplete, data: {'token': 1}}
    2023-04-13 15:51:09,267 - INFO - COM6.ConfigurationClient: Received composition data (page 0x00): {
      "cid": "0059",
      "pid": "0000",
      "vid": "0000",
      "crpl": 10,
      "features": {
        "relay": 0,
        "proxy": 0,
        "friend": 0,
        "low_power": 2
      },
      "elements": [
        {
          "index": 0,
          "location": "0001",
          "models": [
            {
              "modelId": "0000"
            },
            {
              "modelId": "0002"
            },
            {
              "modelId": "1100"
            },
            {
              "modelId": "1101"
            }
          ]
        }
      ]
    }
    In [11]:
    
    In [11]: cc.appkey_add(0)
    
    In [12]: 2023-04-13 15:51:14,601 - INFO - COM6: PacketSend: {'token': 2}
    2023-04-13 15:51:14,661 - INFO - COM6: {event: MeshTxComplete, data: {'token': 2}}
    2023-04-13 15:51:14,740 - INFO - COM6.ConfigurationClient: Appkey status: AccessStatus.SUCCESS
    2023-04-13 15:51:14,740 - INFO - COM6.ConfigurationClient: Appkey add 0 succeded for subnet 0 at node 0010
    In [12]:
    
    In [12]: cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1101))
    
    In [13]: 2023-04-13 15:51:27,709 - INFO - COM6: PacketSend: {'token': 3}
    2023-04-13 15:51:27,723 - INFO - COM6: {event: MeshTxComplete, data: {'token': 3}}
    2023-04-13 15:51:27,757 - INFO - COM6.ConfigurationClient: Model app bind status: AccessStatus.SUCCESS
    2023-04-13 15:51:27,757 - INFO - COM6.ConfigurationClient: Appkey bind 0 to model 1101 at 0010
    In [13]:
    
    In [13]: p.scan_start()
    
    2023-04-13 15:51:44,684 - INFO - COM6: Success
    In [14]: 2023-04-13 15:51:44,721 - INFO - COM6: Received UUID 3442243ef35a46a58bbddbc10ca5395a with RSSI: -65 dB
    In [14]: p.scan_stop()
    
    2023-04-13 15:51:50,034 - INFO - COM6: Success
    In [15]: p.provision(name="client")
    
    In [16]: 2023-04-13 15:52:01,670 - INFO - COM6: Provision: {'context': 0}
    2023-04-13 15:52:01,734 - INFO - COM6: Link established
    2023-04-13 15:52:01,873 - INFO - COM6: Received capabilities
    2023-04-13 15:52:01,873 - INFO - COM6: Number of elements: 1
    2023-04-13 15:52:01,875 - INFO - COM6: OobUse: {'context': 0}
    2023-04-13 15:52:04,203 - INFO - COM6: ECDH request received
    2023-04-13 15:52:04,208 - INFO - COM6: EcdhSecret: {'context': 0}
    2023-04-13 15:52:04,814 - INFO - COM6: Provisioning complete
    2023-04-13 15:52:04,814 - INFO - COM6:  Address(es): 0x11-0x11
    2023-04-13 15:52:04,814 - INFO - COM6:  Device key: REDACTED
    2023-04-13 15:52:04,814 - INFO - COM6:  Network key: REDACTED
    2023-04-13 15:52:04,820 - INFO - COM6: Adding device key to subnet 0
    2023-04-13 15:52:04,820 - INFO - COM6: Adding publication address of root element
    2023-04-13 15:52:04,823 - INFO - COM6: DevkeyAdd: {'devkey_handle': 9}
    2023-04-13 15:52:04,823 - INFO - COM6: AddrPublicationAdd: {'address_handle': 1}
    2023-04-13 15:52:04,986 - INFO - COM6: Provisioning link closed
    In [16]:
    
    In [16]: cc.publish_set(9, 1)
    
    In [17]: cc.composition_data_get()
    
    In [18]: 2023-04-13 15:52:20,886 - INFO - COM6: PacketSend: {'token': 4}
    2023-04-13 15:52:20,908 - INFO - COM6: {event: MeshTxComplete, data: {'token': 4}}
    2023-04-13 15:52:21,058 - INFO - COM6.ConfigurationClient: Received composition data (page 0x00): {
      "cid": "0059",
      "pid": "0000",
      "vid": "0000",
      "crpl": 10,
      "features": {
        "relay": 0,
        "proxy": 0,
        "friend": 0,
        "low_power": 2
      },
      "elements": [
        {
          "index": 0,
          "location": "0001",
          "models": [
            {
              "modelId": "0000"
            },
            {
              "modelId": "0002"
            },
            {
              "modelId": "1102"
            }
          ]
        }
      ]
    }
    In [18]:
    
    In [18]: cc.appkey_add(0)
    
    In [19]: 2023-04-13 15:52:26,776 - INFO - COM6: PacketSend: {'token': 5}
    2023-04-13 15:52:26,875 - INFO - COM6: {event: MeshTxComplete, data: {'token': 5}}
    2023-04-13 15:52:26,973 - INFO - COM6.ConfigurationClient: Appkey status: AccessStatus.SUCCESS
    2023-04-13 15:52:26,973 - INFO - COM6.ConfigurationClient: Appkey add 0 succeded for subnet 0 at node 0011
    In [19]:
    
    In [19]: cc.model_app_bind(db.nodes[0].unicast_address + 1, 0, mt.ModelId(0x1102))
    
    In [20]: 2023-04-13 15:52:40,984 - INFO - COM6: PacketSend: {'token': 6}
    2023-04-13 15:52:41,004 - INFO - COM6: {event: MeshTxComplete, data: {'token': 6}}
    2023-04-13 15:52:41,051 - INFO - COM6.ConfigurationClient: Model app bind status: AccessStatus.SUCCESS
    2023-04-13 15:52:41,066 - INFO - COM6.ConfigurationClient: Appkey bind 0 to model 1102 at 0011
    In [20]:
    
    In [20]: cc.model_publication_set(db.nodes[0].unicast_address + 1, mt.ModelId(0x1102), mt.Publish(db.nodes[0].unicast_address, index=0, ttl=1))
    
    In [21]: 2023-04-13 15:53:44,054 - INFO - COM6: PacketSend: {'token': 7}
    2023-04-13 15:53:44,100 - INFO - COM6: {event: MeshTxComplete, data: {'token': 7}}
    2023-04-13 15:53:44,242 - INFO - COM6.ConfigurationClient: Model publication status: AccessStatus.SUCCESS
    2023-04-13 15:53:44,242 - INFO - COM6.ConfigurationClient: Publication status for model 1102 at element 17 to {'address': 0010, 'index': 0, 'ttl': 1, 'period': 0, 'retransmit': {'count': 0, 'interval_steps': 0, 'interval': 50}, 'credentials': <FriendshipCredentials.DISABLED: 0>}
    In [21]:
    
    In [21]: cc.publish_set(8, 0)
    
    In [22]: cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1101), mt.Publish(db.groups[0].address, index=0, ttl=1))
    
    In [23]: 2023-04-13 15:54:23,177 - INFO - COM6: PacketSend: {'token': 8}
    2023-04-13 15:54:26,576 - INFO - COM6: {event: MeshTxComplete, data: {'token': 8}}
    In [23]:
    
    In [23]: cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1101), mt.Publish(db.groups[0].address, index=0, ttl=1))
    
    In [24]: 2023-04-13 15:54:36,182 - INFO - COM6: PacketSend: {'token': 9}
    In [24]:
    
    In [24]: cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1101), mt.Publish(db.groups[0].address, index=0, ttl=1))
    
    In [25]: 2023-04-13 15:55:37,658 - INFO - COM6: PacketSend: {'token': 10}
    In [25]:
    
    In [25]: cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1101), mt.Publish(db.groups[0].address, index=0, ttl=1))
    
    In [26]: 2023-04-13 15:56:31,375 - INFO - COM6: PacketSend: {'token': 11}
    2023-04-13 15:56:36,100 - INFO - COM6: {event: MeshTxComplete, data: {'token': 11}}
    In [26]:
    
    In [26]: cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1101), mt.Publish(db.groups[0].address, index=0, ttl=1))
    
    In [27]: 2023-04-13 15:58:05,989 - INFO - COM6: PacketSend: {'token': 12}
    2023-04-13 15:58:10,766 - INFO - COM6: {event: MeshTxComplete, data: {'token': 12}}
    In [27]:
    
    In [27]: cc.publish_set(9, 1)
    
    In [28]: cc.model_subscription_add(db.nodes[0].unicast_address + 1, db.groups[0].address, mt.ModelId(0x1102))
    
    In [29]: 2023-04-13 15:58:55,990 - INFO - COM6: PacketSend: {'token': 13}
    2023-04-13 15:58:56,020 - INFO - COM6: {event: MeshTxComplete, data: {'token': 13}}
    2023-04-13 15:58:56,036 - INFO - COM6.ConfigurationClient: Model subscription status: AccessStatus.SUCCESS
    2023-04-13 15:58:56,040 - INFO - COM6.ConfigurationClient: Added subscription 'c001' to model 1102 at element 0011
    In [29]:
    
    In [29]: cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1101), mt.Publish(db.groups[0].address, index=0, ttl=1))
    
    In [30]: 2023-04-13 15:59:01,456 - INFO - COM6: PacketSend: {'token': 14}
    2023-04-13 15:59:01,513 - INFO - COM6: {event: MeshTxComplete, data: {'token': 14}}
    2023-04-13 15:59:01,655 - INFO - COM6.ConfigurationClient: Model publication status: AccessStatus.INVALID_ADDRESS
    In [30]:
    
    In [30]: cc.publish_set(8, 0)
    
    In [31]: cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1101), mt.Publish(db.groups[0].address, index=0, ttl=1))
    
    In [32]: 2023-04-13 15:59:13,116 - INFO - COM6: PacketSend: {'token': 15}

    Regards

  • Hello Sai,

    Nothing obvious stands out from your PyACI log. Did you check if the group address is setup?

    Can you repeat your test with provisioning done by the nRF Mesh mobile app? If the result is the same, then the problem is not relevant to the PyACI script.

    Regards,

    Hieu

  • Hello Hieu

    Works well with mobile app provisioning

    Did you check if the group address is setup?

    no i didn't

    EDIT:

    sorry it works node address is "0x0010 and 0x0011" but not "0x1010 and 0x1111"

    Then i wonder why publish set is not working with server and client example?

    Regards

  • Hello Sai,

    SaSu said:
    Then i wonder why publish set is not working with server and client example?

    Same as before, are they working when using the mobile app to provision?

    I don't remember the Model ID by heart, but between 0x1100 and 0x1101, one is the Sensor Server and the other is a kind of configuration model for the Sensor Server. You need to make sure to set the correct one to publishing.

    Regards,

    Hieu

  • I don't remember the Model ID by heart, but between 0x1100 and 0x1101, one is the Sensor Server and the other is a kind of configuration model for the Sensor Server. You need to make sure to set the correct one to publishing.

    Yeah server is 0x1101 and client is 0x1102. i guess this is correct "cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1101), mt.Publish(db.groups[0].address, index=0, ttl=1))"

    Same as before, are they working when using the mobile app to provision?

    Yeah works with mobile app

    Regards

Reply
  • I don't remember the Model ID by heart, but between 0x1100 and 0x1101, one is the Sensor Server and the other is a kind of configuration model for the Sensor Server. You need to make sure to set the correct one to publishing.

    Yeah server is 0x1101 and client is 0x1102. i guess this is correct "cc.model_publication_set(db.nodes[0].unicast_address, mt.ModelId(0x1101), mt.Publish(db.groups[0].address, index=0, ttl=1))"

    Same as before, are they working when using the mobile app to provision?

    Yeah works with mobile app

    Regards

Children
  • 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