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

Serial provisioned mesh saves temporary data with Python ?

hi all

Every time the serial port provision the mesh with python, when the temporary variables disappear are defined when exiting the serial port , how to improve the code, enter the serial port definition variables still exist.

thanks

  • Hi,

    I am sorry but I do not understand what you mean. Can you try to explain in more detail?

    Regards,
    Terje

  • 1.the first we enter the serial port and defined a ‘sc’ alias with SimpleOnoffClient().

    2.when we exit the serial port and again into serial port ,the variable ‘sc’ disappear.

    1. ,how to improve the code , once enter in the serial port and the last defined variable still exists.

     

  • Hi,

    The interactive_pyaci.py is not a serial port. Rather, it is an Interactive Python Application Controller Interface (PyACI). What this means, is that it gives you an interactive environment where you can create variables and use python APIs to do things. When you exit this interactive interface all variables are lost (just like everything in RAM is lost when you exit from any application or turn your computer off). There probably are ways to store the full environment to a file, so that it can be loaded at a later point in time. Other users here on DevZone may have more information about that.

    For some of our examples, some information is saved in a database. For insance in Interactive mesh provisioning and configuration the first thing we do is to open a mesh network database, where the existing state of the network database can be read and where any changes we do to the network database will be stored. That way we can load the database again the next time we use the interactive interface, in order to continue from where we left. We will not get any of the python variables back directly, but we can get back stored values from the db object after loading it.

    Regards,
    Terje

  • Can you tell me the way to get back stored values from the db?Then I can control the node's light on off immediately.

    For example,I create object : sc = SimpleOnOffClient() last time, I can use sc.publish_set(0, 0) to control node's LED,then I close the PyACI. Now I Open again  PyACI, what should I do to restore the object 'sc' from the db? 

    Thanks & Best Regards

  • I mean how to do to load the database again at the next time when i reopen the interactive interface, to control the node devices which have done Provisione and configuration before?

    Thanks & Best Regards

Related