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

Mesh Interactive PyACI script,Interactive mesh provisioning and configuration test fail

Hi,

I followed the instruction on infocenter as bellow,everything goes well ,but the cc.composition_data_get() command,no composition data was received . Any missing steps?

Software Development Kit > nRF5 SDK for Mesh v4.0.0 > Libraries > Serial interface > Interactive PyACI script

  • Hi Hung,

    1.Yes,the board rebooted was I did, so I think I should reset it before start PyACI.

    2.Now,I try again , with a fresh programming of the board and make sure it's reseted before  start the PyACI , but a new issue was happened while calling CMD "cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1000))" the log as bellow:

    In [1]: db = MeshDB("database/example_database.json")                                                                                                   
    
    In [2]: db.provisioners                                                                                                                                 
    Out[2]: [{'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': [{'low_address': 0010, 'high_address': 7fff}], 'allocated_group_range': [{'low_address': c000, 'high_address': feff}]}]
    
    In [3]: p = Provisioner(device, db)                                                                                                                     
    
    In [4]: 2020-03-19 11:26:26,841 - INFO - ttyACM0: Success                                                                                               
    In [4]: 2020-03-19 11:26:26,844 - INFO - ttyACM0: Success
    2020-03-19 11:26:26,850 - INFO - ttyACM0: SubnetAdd: {'subnet_handle': 0}
    2020-03-19 11:26:26,855 - INFO - ttyACM0: AppkeyAdd: {'appkey_handle': 0}
    2020-03-19 11:26:26,860 - INFO - ttyACM0: AppkeyAdd: {'appkey_handle': 1}
    In [4]: p.scan_start()                                                                                                                                  
    
    In [5]: 2020-03-19 11:26:38,981 - INFO - ttyACM0: Success
    2020-03-19 11:26:39,229 - INFO - ttyACM0: Received UUID 00596140001902e4ef3196fc63000600 with RSSI: -60 dB
    2020-03-19 11:26:39,483 - INFO - ttyACM0: Received UUID 00596140281902e5198e12b468000100 with RSSI: -72 dB
    2020-03-19 11:26:39,802 - INFO - ttyACM0: Received UUID 00596128051914d18c6eb7ca81000500 with RSSI: -42 dB
    2020-03-19 11:26:40,473 - INFO - ttyACM0: Received UUID 00596140281902e02cc6e2036e000200 with RSSI: -67 dB
    2020-03-19 11:26:40,482 - INFO - ttyACM0: Received UUID 00596128051914e3218fbd8f6d000500 with RSSI: -56 dB
    2020-03-19 11:26:40,664 - INFO - ttyACM0: Received UUID 00596128051914d11d919aaa7e000300 with RSSI: -72 dB
    2020-03-19 11:26:43,404 - INFO - ttyACM0: Received UUID a2df7006d06cb444a251c32d4ea7b60c with RSSI: -24 dB
    2020-03-19 11:26:45,014 - INFO - ttyACM0: Received UUID 00596128051914ffcef9ea1350000500 with RSSI: -64 dB
    2020-03-19 11:26:45,887 - INFO - ttyACM0: Received UUID 00596140281902f58e3be88bf1000100 with RSSI: -68 dB
    In [5]: p.scan_stop()                                                                                                                                   
    
    In [6]: 2020-03-19 11:26:51,723 - INFO - ttyACM0: Success                                                                                               
    In [6]: p.provision(uuid="a2df7006d06cb444a251c32d4ea7b60c",name="Light bulb")                                                                          
    
    In [7]: 2020-03-19 11:27:42,286 - INFO - ttyACM0: Provision: {'context': 0}                                                                             
    In [7]: 2020-03-19 11:27:42,348 - INFO - ttyACM0: Link established
    2020-03-19 11:27:44,447 - INFO - ttyACM0: Received capabilities
    2020-03-19 11:27:44,447 - INFO - ttyACM0: Number of elements: 1
    2020-03-19 11:27:44,451 - INFO - ttyACM0: OobUse: {'context': 0}                                                                                        
    2020-03-19 11:27:52,742 - INFO - ttyACM0: ECDH request received
    2020-03-19 11:27:52,751 - INFO - ttyACM0: EcdhSecret: {'context': 0}
    2020-03-19 11:27:53,181 - INFO - ttyACM0: Provisioning complete
    2020-03-19 11:27:53,182 - INFO - ttyACM0: 	Address(es): 0x15-0x15
    2020-03-19 11:27:53,182 - INFO - ttyACM0: 	Device key: cd6d8b6ab5b9f993f13b16419a2f1952
    2020-03-19 11:27:53,182 - INFO - ttyACM0: 	Network key: 18eed9c2a56add85049ffc3c59ad0e12
    2020-03-19 11:27:53,182 - INFO - ttyACM0: Adding device key to subnet 0
    2020-03-19 11:27:53,183 - INFO - ttyACM0: Adding publication address of root element
    2020-03-19 11:27:53,189 - INFO - ttyACM0: DevkeyAdd: {'devkey_handle': 8}
    2020-03-19 11:27:53,190 - INFO - ttyACM0: AddrPublicationAdd: {'address_handle': 0}
    2020-03-19 11:27:53,364 - INFO - ttyACM0: Provisioning link closed
    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]: 2020-03-19 11:29:11,550 - INFO - ttyACM0: PacketSend: {'token': 1}                                                                             
    2020-03-19 11:29:11,562 - INFO - ttyACM0: {event: MeshTxComplete, data: {'token': 1}}
    2020-03-19 11:29:11,635 - INFO - ttyACM0.ConfigurationClient: Received composition data (page 0x00): {
      "cid": "0059",
      "pid": "0000",
      "vid": "0000",
      "crpl": 40,
      "features": {
        "relay": 0,
        "proxy": 0,
        "friend": 2,
        "low_power": 2
      },
      "elements": [
        {
          "index": 0,
          "location": "0000",
          "models": [
            {
              "modelId": "0000"
            },
            {
              "modelId": "0002"
            },
            {
              "modelId": "1000"
            }
          ]
        }
      ]
    }
    In [11]: cc.appkey_add(0)                                                                                                                               
    
    In [12]: 2020-03-19 11:29:26,488 - INFO - ttyACM0: PacketSend: {'token': 2}                                                                             
    2020-03-19 11:29:26,560 - INFO - ttyACM0: {event: MeshTxComplete, data: {'token': 2}}
    2020-03-19 11:29:26,590 - INFO - ttyACM0.ConfigurationClient: Appkey status: AccessStatus.SUCCESS
    2020-03-19 11:29:26,596 - INFO - ttyACM0.ConfigurationClient: Appkey add 0 succeded for subnet 0 at node 0015
    In [12]: cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1000))                                                                          
    
    In [13]: 2020-03-19 11:29:40,931 - INFO - ttyACM0: PacketSend: {'token': 3}                                                                             
    2020-03-19 11:29:40,956 - INFO - ttyACM0: {event: MeshTxComplete, data: {'token': 3}}
    2020-03-19 11:29:40,985 - INFO - ttyACM0.ConfigurationClient: Model app bind status: AccessStatus.INVALID_ADDRESS
    In [13]: cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1000))                                                                          
    
    In [14]: 2020-03-19 11:30:01,089 - INFO - ttyACM0: PacketSend: {'token': 4}                                                                             
    2020-03-19 11:30:01,121 - INFO - ttyACM0: {event: MeshTxComplete, data: {'token': 4}}
    2020-03-19 11:30:01,145 - INFO - ttyACM0.ConfigurationClient: Model app bind status: AccessStatus.INVALID_ADDRESS
    In [14]: gc = GenericOnOffClient()                                                                                                                      
    
    In [15]: gc.set(True)                                                                                                                                   
    ---------------------------------------------------------------------------
    RuntimeError                              Traceback (most recent call last)
    ~/Mesh/scripts/interactive_pyaci/interactive_pyaci.py in <module>
    ----> 1 gc.set(True)
    
    ~/Mesh/scripts/interactive_pyaci/models/generic_on_off.py in set(self, value, transition_time_ms, delay_ms, ack)
         53 
         54         if ack:
    ---> 55             self.send(self.GENERIC_ON_OFF_SET, message)
         56         else:
         57             self.send(self.GENERIC_ON_OFF_SET_UNACKNOWLEDGED, message)
    
    ~/Mesh/scripts/interactive_pyaci/mesh/access.py in send(self, opcode, data)
        160     def send(self, opcode, data=bytearray()):
        161         if self.element is None or self.element.access is None:
    --> 162             raise RuntimeError("This model is not bound to an element.")
        163         elif self.key_handle is None:
        164             raise RuntimeError("This model is not bound to a key.")
    
    RuntimeError: This model is not bound to an element.
    

  • Line 95 ,and try again line 100.

    In [12]: cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0x1000))                                                                          
    
    In [13]: 2020-03-19 11:29:40,931 - INFO - ttyACM0: PacketSend: {'token': 3}                                                                             
    2020-03-19 11:29:40,956 - INFO - ttyACM0: {event: MeshTxComplete, data: {'token': 3}}
    2020-03-19 11:29:40,985 - INFO - ttyACM0.ConfigurationClient: Model app bind status: AccessStatus.INVALID_ADDRESS
    

  • Please try with the original .json file. Or use the backup file example_database.json.backup (remove the .backup).

    I suspect that db.nodes[0].unicast_address was not pointed to correct address. You can see the list of nodes by typing "db.nodes"

    You can use the actual address directly as well. So instead of db.nodes[0].unicast_address, you can use 0x15 for example. Anyway, please try to test again with the fresh .json file. 

  • Hi Hung,

    Thank you very much!

    Yes,it works,after using the backup file example_database.json.backup (remove the .backup).

  • python interactive_pyaci.py -d COM1 --no-logfile

    Thankyou so much...It also helped me to solve that issue...But when I give the below code , it never gets connect..

    It works only when log file is enabled...

    What will be the problem.?Can someone explain that..?

Related