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

interactive pyaci: load existing DB on new provisioner device

Hey!

I'm using mesh sdk 4.0, nrf5-sdk 16.0 and run the serial example.

currently I successfully provision 2 light server with the ipython  interface, and to configure them to blink even after i shut down everything.

I want to be able to take the Json-DB that represent the current state of the net and load it on new device, but it's failed.

I try re-load the the devices-net keys (resent dev_key_add and addr_publication_add per node) as well as the normal sequence of creating Provisioner (loading subnet keys and appkeys).

still when i try to get again the composion data it's failed, and if I try to send GenericOnOff messages - the provision device log (out trough the segger-debug terminal) "unencrypted data", means it couldn't decrypt the message (that isn't for self decrypt anyway, am I wrong here?).

best regards,

Mattan  

Parents
  • Hi Mattan, 

    By default permanent storage on the serial board is not enabled. So when you reset the serial board or use a different board device state management info is not restored. For example the address handles, appkey handles etc. 

    Could you try to turn on PERSISTENT_STORAGE = 1 on the serial firmware and test again ? 

    This solution is still not ideal as the data should be stored at one place, for example all data should be stored in the .json file and should be restored whenever we start the pyaci regardless if the serial board stores that data or not But we dont have that feature yet. 

Reply
  • Hi Mattan, 

    By default permanent storage on the serial board is not enabled. So when you reset the serial board or use a different board device state management info is not restored. For example the address handles, appkey handles etc. 

    Could you try to turn on PERSISTENT_STORAGE = 1 on the serial firmware and test again ? 

    This solution is still not ideal as the data should be stored at one place, for example all data should be stored in the .json file and should be restored whenever we start the pyaci regardless if the serial board stores that data or not But we dont have that feature yet. 

Children
  • Hi Hung,

    My purpose is to save everything on the json, in order to use it as backup in case the device stop working. the address handlers i set again (by creating new Provisioner subnet_add and appkey_add are sent automatically and manually I sent dev_key_add and addr_publication_add) when lunching.

    setting the net-keys and the app-keys were successfully (I receive success responds) but still it print "unencrypted data".

    what should i do to make the 'json-of-everything' feature that you currently haven't done yet?

  • Hi Mattan, 


    As mentioned, it's not supported to use only the JSON file to restore the database for now. As you already tried, you would need to add the device keys, addresses and the application keys to the node. You will see "unencrypted data" in the log of the serial board. But then in transport layer, you should see it's decrypted. Like this: 

    Have you tried what I suggested, to set PERSISTENT_STORAGE = 1 in the serial firmware ? This way you can reset the board, start pyACI again and still can have everything working. (You still need to add the model to the device but that's all) 

    If you want to switch between boards, you can also read the hex dump from the original board, and flash it to the 2nd board. Or you can just read the dsm flash storage area, and the flash it to the other boards. The draw back is that everytime you provision a new node or add new app keys , you would need to update this hex file. 

  • Hi Hung,

    I think I found the problem: after each message the python shows:

    2020-03-17 13:38:27,942 - INFO - com6: PacketSend: {'token': 1804}
    2020-03-17 13:38:27,974 - INFO - com6: {event: MeshTxComplete, data: {'token': 1804}}

    as the token number is increasing between messages. when restart the device, this counter is change back to 0. any msg with token less or equal failed to be sent even to the net-packet. So this counter is store in the the device's RAM.

    can you recall where? maybe I'll just add a serial setter for it.

  • Wouldn't reset the pyACI be better solution ? (or reset the token in the python script if you don't want to reset the pyACI) 


    Could you give some more information on what exactly you plan to do with multiple provisioner devices ? 

  • I'm planning on using one device to be provisioner for multiple and separated networks.

    other case is when the provision device is damaged and need to be replaced. 

Related