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

Interactive PyACI

I'd be grateful for some assistance with what I may be doing wrong.

I have programmed the serial example on a device and the server example on another device.

Copied the example_database.backup to example_database.json

Then get the following bunch of errors:

C:\Users\jcris\Desktop\Mesh_V4\nrf5_SDK_for_Mesh_v4.0.0_src\scripts\interactive_pyaci>python interactive_pyaci.py -d COM26 --no-logfile

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.

Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: db = MeshDB("database/example_database.json")

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

In [3]: 2020-03-29 09:04:55,073 - ERROR - COM26: None: ERROR_CMD_UNKNOWN
2020-03-29 09:04:57,073 - INFO - COM26: cmd AddrLocalUnicastSet, timeout waiting for event
2020-03-29 09:04:57,079 - ERROR - COM26: ElemModelsGet: ERROR_INVALID_LENGTH
2020-03-29 09:04:57,082 - ERROR - COM26: None: ERROR_INVALID_LENGTH
2020-03-29 09:04:59,083 - INFO - COM26: cmd AppkeyAdd, timeout waiting for event

Parents
  • Hello John, this is an issue with Jlink 6.7.x, please downgrade your Jlink to version 6.54c or older. and try again

  • I've downgraded to Jlink 6.54

    As evidenced by the following log things are still not working properly:

    C:\Users\jcris\Desktop\Mesh_V4\nrf5_SDK_for_Mesh_v4.0.0_src\scripts\interactive_pyaci>interactive_pyaci.py -d COM26 --no-logfile

    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.

    Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
    Type 'copyright', 'credits' or 'license' for more information
    IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.

    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]: 2020-04-01 17:44:25,153 - ERROR - COM26: None: ERROR_CMD_UNKNOWN
    2020-04-01 17:44:27,153 - INFO - COM26: cmd AddrLocalUnicastSet, timeout waiting for event
    2020-04-01 17:44:29,162 - INFO - COM26: cmd SubnetAdd, timeout waiting for event
    2020-04-01 17:44:31,177 - INFO - COM26: cmd AppkeyAdd, timeout waiting for event
    2020-04-01 17:44:33,192 - INFO - COM26: cmd AppkeyAdd, timeout waiting for event
    2020-04-01 17:45:55,982 - ERROR - COM26: Invalid packet: bytearray(b'\x00')
    2020-04-01 17:45:56,399 - INFO - COM26: Device rebooted.
    In [4]:

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

    In [5]: 2020-04-01 17:46:43,877 - ERROR - COM26: ModelAppGet: ERROR_INVALID_LENGTH
    2020-04-01 17:46:43,893 - ERROR - COM26: None: ERROR_CMD_UNKNOWN
    2020-04-01 17:46:43,893 - ERROR - COM26: None: ERROR_CMD_UNKNOWN
    2020-04-01 17:46:43,893 - INFO - COM26: SubnetAdd: {'subnet_handle': 0}
    2020-04-01 17:46:43,899 - INFO - COM26: AppkeyAdd: {'appkey_handle': 0}
    2020-04-01 17:46:43,899 - INFO - COM26: AppkeyAdd: {'appkey_handle': 1}
    In [5]:

    In [5]: p.scan_start()

    In [6]: 2020-04-01 17:47:21,747 - INFO - COM26: Success
    2020-04-01 17:47:22,424 - INFO - COM26: Received UUID 1b49c41c848fe54fb8bb8f146bd04e32 with RSSI: -32 dB
    2020-04-01 17:47:22,439 - INFO - COM26: Received UUID 1b49c41c848fe54fb8bb8f146bd04e32 with RSSI: -32 dB
    In [6]:

    In [6]: p.scan_stop()

    In [7]: 2020-04-01 17:48:11,116 - INFO - COM26: Success
    In [7]:

    In [7]: p.provision(uuid="1b49c41c848fe54fb8bb8f146bd04e32",name="Light bulb")

    In [8]: 2020-04-01 17:53:56,345 - INFO - COM26: Provision: {'context': 0}
    2020-04-01 17:53:56,392 - INFO - COM26: Link established
    2020-04-01 17:53:56,393 - INFO - COM26: Link established
    2020-04-01 17:53:56,449 - INFO - COM26: Received capabilities
    2020-04-01 17:53:56,451 - INFO - COM26: Number of elements: 1
    2020-04-01 17:53:56,453 - INFO - COM26: Received capabilities
    2020-04-01 17:53:56,455 - INFO - COM26: Number of elements: 1
    2020-04-01 17:53:56,458 - INFO - COM26: OobUse: {'context': 0}
    2020-04-01 17:53:56,460 - ERROR - COM26: OobUse: ERROR_INVALID_STATE
    2020-04-01 17:53:56,677 - INFO - COM26: ECDH request received
    2020-04-01 17:53:56,680 - INFO - COM26: ECDH request received
    2020-04-01 17:53:56,687 - INFO - COM26: EcdhSecret: {'context': 0}
    2020-04-01 17:53:56,691 - ERROR - COM26: EcdhSecret: ERROR_INVALID_STATE
    2020-04-01 17:53:57,124 - INFO - COM26: Provisioning complete
    2020-04-01 17:53:57,126 - INFO - COM26: Address(es): 0x10-0x10
    2020-04-01 17:53:57,129 - INFO - COM26: Device key: ae0186015fc75d35b46cd5fa5ecdca40
    2020-04-01 17:53:57,131 - INFO - COM26: Network key: 18eed9c2a56add85049ffc3c59ad0e12
    2020-04-01 17:53:57,134 - INFO - COM26: Adding device key to subnet 0
    2020-04-01 17:53:57,138 - INFO - COM26: Adding publication address of root element
    2020-04-01 17:53:57,141 - ERROR - COM26: Exception in pkt handler <bound method Provisioner.__event_handler of <mesh.provisioning.Provisioner object at 0x0000025DE2E7F688>>
    2020-04-01 17:53:57,179 - ERROR - COM26: traceback: Traceback (most recent call last):
    File "C:\Users\jcris\Desktop\Mesh_V4\nrf5_SDK_for_Mesh_v4.0.0_src\scripts\interactive_pyaci\aci\aci_uart.py", line 88, in process_packet
    fun(packet)
    File "C:\Users\jcris\Desktop\Mesh_V4\nrf5_SDK_for_Mesh_v4.0.0_src\scripts\interactive_pyaci\mesh\provisioning.py", line 337, in __event_handler
    self.store(self.__session_data)
    File "C:\Users\jcris\Desktop\Mesh_V4\nrf5_SDK_for_Mesh_v4.0.0_src\scripts\interactive_pyaci\mesh\provisioning.py", line 346, in store
    self.prov_db.nodes.append(mt.Node(**self.__session_data))
    TypeError: __init__() missing 5 required positional arguments: 'UUID', 'unicast_address', 'net_keys', 'config_complete', and 'security'

    2020-04-01 17:53:57,184 - INFO - COM26: Provisioning complete
    2020-04-01 17:53:57,185 - INFO - COM26: Address(es): 0x10-0x10
    2020-04-01 17:53:57,186 - INFO - COM26: Device key: ae0186015fc75d35b46cd5fa5ecdca40
    2020-04-01 17:53:57,188 - INFO - COM26: Network key: 18eed9c2a56add85049ffc3c59ad0e12
    2020-04-01 17:53:57,189 - INFO - COM26: Adding device key to subnet 0
    2020-04-01 17:53:57,190 - INFO - COM26: Adding publication address of root element
    2020-04-01 17:53:57,195 - INFO - COM26: DevkeyAdd: {'devkey_handle': 8}
    2020-04-01 17:53:57,197 - INFO - COM26: AddrPublicationAdd: {'address_handle': 0}
    2020-04-01 17:53:57,201 - ERROR - COM26: DevkeyAdd: ERROR_REJECTED
    2020-04-01 17:53:57,206 - INFO - COM26: AddrPublicationAdd: {'address_handle': 0}
    2020-04-01 17:53:57,294 - INFO - COM26: Provisioning link closed
    2020-04-01 17:53:57,295 - INFO - COM26: Provisioning link closed

Reply
  • I've downgraded to Jlink 6.54

    As evidenced by the following log things are still not working properly:

    C:\Users\jcris\Desktop\Mesh_V4\nrf5_SDK_for_Mesh_v4.0.0_src\scripts\interactive_pyaci>interactive_pyaci.py -d COM26 --no-logfile

    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.

    Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
    Type 'copyright', 'credits' or 'license' for more information
    IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.

    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]: 2020-04-01 17:44:25,153 - ERROR - COM26: None: ERROR_CMD_UNKNOWN
    2020-04-01 17:44:27,153 - INFO - COM26: cmd AddrLocalUnicastSet, timeout waiting for event
    2020-04-01 17:44:29,162 - INFO - COM26: cmd SubnetAdd, timeout waiting for event
    2020-04-01 17:44:31,177 - INFO - COM26: cmd AppkeyAdd, timeout waiting for event
    2020-04-01 17:44:33,192 - INFO - COM26: cmd AppkeyAdd, timeout waiting for event
    2020-04-01 17:45:55,982 - ERROR - COM26: Invalid packet: bytearray(b'\x00')
    2020-04-01 17:45:56,399 - INFO - COM26: Device rebooted.
    In [4]:

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

    In [5]: 2020-04-01 17:46:43,877 - ERROR - COM26: ModelAppGet: ERROR_INVALID_LENGTH
    2020-04-01 17:46:43,893 - ERROR - COM26: None: ERROR_CMD_UNKNOWN
    2020-04-01 17:46:43,893 - ERROR - COM26: None: ERROR_CMD_UNKNOWN
    2020-04-01 17:46:43,893 - INFO - COM26: SubnetAdd: {'subnet_handle': 0}
    2020-04-01 17:46:43,899 - INFO - COM26: AppkeyAdd: {'appkey_handle': 0}
    2020-04-01 17:46:43,899 - INFO - COM26: AppkeyAdd: {'appkey_handle': 1}
    In [5]:

    In [5]: p.scan_start()

    In [6]: 2020-04-01 17:47:21,747 - INFO - COM26: Success
    2020-04-01 17:47:22,424 - INFO - COM26: Received UUID 1b49c41c848fe54fb8bb8f146bd04e32 with RSSI: -32 dB
    2020-04-01 17:47:22,439 - INFO - COM26: Received UUID 1b49c41c848fe54fb8bb8f146bd04e32 with RSSI: -32 dB
    In [6]:

    In [6]: p.scan_stop()

    In [7]: 2020-04-01 17:48:11,116 - INFO - COM26: Success
    In [7]:

    In [7]: p.provision(uuid="1b49c41c848fe54fb8bb8f146bd04e32",name="Light bulb")

    In [8]: 2020-04-01 17:53:56,345 - INFO - COM26: Provision: {'context': 0}
    2020-04-01 17:53:56,392 - INFO - COM26: Link established
    2020-04-01 17:53:56,393 - INFO - COM26: Link established
    2020-04-01 17:53:56,449 - INFO - COM26: Received capabilities
    2020-04-01 17:53:56,451 - INFO - COM26: Number of elements: 1
    2020-04-01 17:53:56,453 - INFO - COM26: Received capabilities
    2020-04-01 17:53:56,455 - INFO - COM26: Number of elements: 1
    2020-04-01 17:53:56,458 - INFO - COM26: OobUse: {'context': 0}
    2020-04-01 17:53:56,460 - ERROR - COM26: OobUse: ERROR_INVALID_STATE
    2020-04-01 17:53:56,677 - INFO - COM26: ECDH request received
    2020-04-01 17:53:56,680 - INFO - COM26: ECDH request received
    2020-04-01 17:53:56,687 - INFO - COM26: EcdhSecret: {'context': 0}
    2020-04-01 17:53:56,691 - ERROR - COM26: EcdhSecret: ERROR_INVALID_STATE
    2020-04-01 17:53:57,124 - INFO - COM26: Provisioning complete
    2020-04-01 17:53:57,126 - INFO - COM26: Address(es): 0x10-0x10
    2020-04-01 17:53:57,129 - INFO - COM26: Device key: ae0186015fc75d35b46cd5fa5ecdca40
    2020-04-01 17:53:57,131 - INFO - COM26: Network key: 18eed9c2a56add85049ffc3c59ad0e12
    2020-04-01 17:53:57,134 - INFO - COM26: Adding device key to subnet 0
    2020-04-01 17:53:57,138 - INFO - COM26: Adding publication address of root element
    2020-04-01 17:53:57,141 - ERROR - COM26: Exception in pkt handler <bound method Provisioner.__event_handler of <mesh.provisioning.Provisioner object at 0x0000025DE2E7F688>>
    2020-04-01 17:53:57,179 - ERROR - COM26: traceback: Traceback (most recent call last):
    File "C:\Users\jcris\Desktop\Mesh_V4\nrf5_SDK_for_Mesh_v4.0.0_src\scripts\interactive_pyaci\aci\aci_uart.py", line 88, in process_packet
    fun(packet)
    File "C:\Users\jcris\Desktop\Mesh_V4\nrf5_SDK_for_Mesh_v4.0.0_src\scripts\interactive_pyaci\mesh\provisioning.py", line 337, in __event_handler
    self.store(self.__session_data)
    File "C:\Users\jcris\Desktop\Mesh_V4\nrf5_SDK_for_Mesh_v4.0.0_src\scripts\interactive_pyaci\mesh\provisioning.py", line 346, in store
    self.prov_db.nodes.append(mt.Node(**self.__session_data))
    TypeError: __init__() missing 5 required positional arguments: 'UUID', 'unicast_address', 'net_keys', 'config_complete', and 'security'

    2020-04-01 17:53:57,184 - INFO - COM26: Provisioning complete
    2020-04-01 17:53:57,185 - INFO - COM26: Address(es): 0x10-0x10
    2020-04-01 17:53:57,186 - INFO - COM26: Device key: ae0186015fc75d35b46cd5fa5ecdca40
    2020-04-01 17:53:57,188 - INFO - COM26: Network key: 18eed9c2a56add85049ffc3c59ad0e12
    2020-04-01 17:53:57,189 - INFO - COM26: Adding device key to subnet 0
    2020-04-01 17:53:57,190 - INFO - COM26: Adding publication address of root element
    2020-04-01 17:53:57,195 - INFO - COM26: DevkeyAdd: {'devkey_handle': 8}
    2020-04-01 17:53:57,197 - INFO - COM26: AddrPublicationAdd: {'address_handle': 0}
    2020-04-01 17:53:57,201 - ERROR - COM26: DevkeyAdd: ERROR_REJECTED
    2020-04-01 17:53:57,206 - INFO - COM26: AddrPublicationAdd: {'address_handle': 0}
    2020-04-01 17:53:57,294 - INFO - COM26: Provisioning link closed
    2020-04-01 17:53:57,295 - INFO - COM26: Provisioning link closed

Children
Related