Creating a Custom Application

NOTE: Support for Node-RED/Node.js on Multitech AT91SAM9G25-based products was discontinued within mPower 5.3.  For mPower 5.3.3 to 5.3.8, users can install Node-RED as a custom application. mPower 6.0 or later no longer supports this custom app option. For alternative code examples in Python, see Example Applications below.

Any instructions related to Node-RED/Node.js are still applicable for mPower MTCDT 5.2.1 and MTCAP 5.2.1 and earlier on all devices. And also applies to any non-AT91SAM9G25-based products.

The AEP firmware version 1.3 or later supports installing and running user-created custom applications as well as managing them from DeviceHQ®. You can disable Node-RED to save system resources.

Basic Requirements:

  • Use a supported language: C/C++, Python, Nodejs* (Note: mPower 5.3.8 or lower supports Python 2.7.)
  • For details on the latest supported version of Yocto, refer to Introduction to Yocto.
  • The app can be installed either on an SD card or in flash.
    • You can use an optional boolean variable to manage this or otherwise the app-manager takes care of it automatically based on the presence of an SD card. See manifest.json Details for more information.
  • Application is packaged as a gzipped tar file containing all required files.
  • Use the new app-manager program on the Conduit to manage custom apps
    • This is exclusively used to install, uninstall, start, and stop custom apps.

*Note Nodejs is not supported for Multitech AT91SAM9G25-based products with mPower 5.3 or higher.

Required Application Structure

tarball

All required files must be present for successful installation.

How to Create a Custom Application

  1. Download the custom app SDK template and extract the enclosed template tarball into your application directory.
  2. Modify manifest.json to contain the information about your app. See manifest.json Details for more information.
  3. Set up app dependencies:
    1. If your app doesn’t have dependencies to install, remove the two sample IPK entries in provisioning/p_manifest.json
    2. If your app does have dependencies to install:
      1. Create IPK files of all dependencies and place them in the provisioning directory
      2. Update provisioning/p_manifest.json with all your IPK dependency files.
    3. See p_manifest.json Details for more information
  4. Modify the Install script if you need extra dependency installation or other install setup beyond installing IPK files. This script is used to install and uninstall your app. See Install Script for more details.
  5. Modify the Start script to start and stop your application process(es) as needed. See Start Script for more details.
  6. If you have config files you want to update through DeviceHQ, place them in the config directory.
  7. Modify status.json with the default AppInfo string of your choosing. See status.json Details for more details.
  8. Organize the rest of your application content within this directory any way you like. The Conduit only cares about the location of the required and optional files noted above.
  9. Create a gzipped tar file (tarball) of this directory, ensuring all required files are present and correct. The tarball doesn’t need to match the app name in manifest.json. The first level application content like manifest.json must be at the top level of the tarball just like the custom app template. To create a tarball on Linux:
    $ cd <your_top_level_app_directory>
    $ tar --hard-dereference -hczf <path_to_create_tgz>.tgz *

Example Applications (including Python alternatives to Node-RED)


Use Monit to Monitor Custom Apps

You can also use monit to monitor your custom applications. Refer to the monit page for information on installation of the monit package and its use.

Backup Custom Apps with User-Defined Defaults (UDD)

You can backup/save Custom Apps when you save them in User Defined Defaults of the device. You must install them in the /var/config  directory using the User Defined Defaults feature.