Example: Update MicroPython from Remote Manager using an automation

You can create an automation to update the MicroPython application. In this example, you want to add FTP client capability to the MicroPython application. You will need to add the library uftp.py and then update the main.py application.

Note Digi Remote Manager requires TCP and will not work with NB-IoT, unless the carrier supports TCP.

  1. Log into Remote Manager.

  2. Make sure that SM/UDP is enabled. See Enable SM/UDP.

  3. Click Automations.

  4. Click Create to launch the wizard.

  5. In the Details section:

    1. In the Name field, enter a descriptive name for the automation, such as "Update application".

    2. Click Save and Continue.

  6. In the Steps section:

    1. Click the garbage icon to delete any existing steps.

    2. Click + to add a step, and select SM/UDP Request Connect.

    3. Click + again to add another step, and select RCI.

      1. In the RCI Payload field, enter:

        <set_setting>
        <remote_manager>
        <MO>7</MO>
        </remote_manager>
        </set_setting>
      2. Enable Allow Offline.

      3. From the On Error list box, select Continue.

        This step disables the MicroPython application so the MicroPython files can be updated, and configures the device to keep the connection open to remote manager.

    4. Click + again to add another step, and select Reboot.

      1. Enable Allow Offline.

      2. From the On Error list box, select Continue.

    5. Click + again to add another step, and select Upload Files.

      1. From the Choose File list box, select main.py from the FTP sample application.

      2. In the Destination File Path field, enter: ~/MicroPython/main.py

      3. Enable Allow Offline.

      4. From the On Error list box, select Continue.

    6. Click + again to add another step, and select Upload Files.

      1. From the Choose File list box, select the uftp.py file from the FTP sample application.

      2. In the Destination File Path field, enter: ~/MicroPython/uftp.py

      3. Enable Allow Offline.

      4. From the On Error list box, select Continue.

    7. Click + again to add another step, and select RCI.

      1. In the RCI Payload field, enter:

        <set_setting>
        <micropython> <PS>1</PS> </micropython> <remote_manager>
        <MO>6</MO>
        </remote_manager>
        </set_setting>
      2. Enable Allow Offline.

      3. From the On Error list box, select Continue.

    8. Click + again to add another step, and select Reboot.

      1. Enable Allow Offline.

      2. From the On Error list box, select Continue.

    9. Click + to add a step, and select Disconnect.

    10. Click Save and Continue.

  7. In the Targets section, click Skip to skip this section.

  8. In the Triggers section, click Skip to skip this section.

  9. Start the automation on a set of devices.

    1. Click Automations to show the list of available automations.

    2. Select the automation that you just created.

    3. Click Action > Run Automation. The Run Automations window displays.

    4. Click the Devices tab.

    5. Select all of the devices you want to run the automation on.

    6. Click Confirm to start the automation.

  10. Verify the results of running the automation.

    1. Click Automations to show the list of automations.

    2. Click on the name of the automation you just ran to display the status window.

    3. Click the Runs tab to see all of the runs for this automation.

    4. Click on the run you are interested in to display a details for each device.

    5. For the device you are interested in, click the Status link under the Summary column to see more details and the responses.