Device Management Dashboard

Mongoose OS provides an integrated service for device management. It is located at https://mongoose-os.com/dashboard/ , and provides the following functionality:

  • Device management dashboard
  • 24/7 access and monitoring for your devices in the field
  • Remote control and firmware update (OTA) for your devices
  • Store, view and export device logs
  • Online/Offline status, current firmware, disconnection logs
  • Configuration, file system, hardware peripherals management

This is how it looks like:

This main panel provides three pieces of functionality:

  1. Heartbeat messages
  2. Device logs
  3. Device control commands
  4. Displaying live device data

Heartbeat messages

Devices send periodic heartbeat messages, updating their status information. On each heartbeat interval, devices send the same information as the result of Sys.GetInfo RPC call gets: firmware ID, filesystem and RAM sizes, etc.

Device logs

Devices can send logs. Logs are stored permanently and can be downloaded. Real-time logs are also displayed in the log window:

Device control commands

Click on a device row to toggle device dialog. When dialog shows, it connects to the device and asks for a list of RPC services implemented by the device - both built-in services, provided by Mongoose OS, and custom RPC services, implemented by the app developer.

That list is rendered in the dropdown menu. Select any RPC command, and the command arguments will be rendered in the arguments text input. Alter arguments as required, press Execute button - and see the command output in the logs window:

You can update firmware over-the-air, reboot the device, manage files, manipulate GPIO, and so on.

OTA firmware update

You can upload firmware .zip files for your devices on a dashboard:

And update devices via the Device Panel:

Live device data

A device can send any arbitrary measurements to the dashboard and have that data graphed in real time. For example, in JavaScript:

load('api_dash.js');
Dash.send("temperature", 22.45);

Or, in C/C++:

mgos_dash_send_data("{temperature: %f, humidity: %f}", 1.23, 5.78);

Each hearbeat sends RAM and flash size statistics that are automatically graphed - there is no need to have any special logic on a device side:

Enable management on a device side

There are two options:

  1. To use a pre-built, default Mongoose OS app, OR
  2. Build your own app.

Option 1 - using a pre-built default app

  • Install a default Mongoose OS app on your device by following the instructions on Mongoose OS download page. As a result, you should have your device flashed and WiFi configured.

  • Login to the https://mongoose-os.com/dashboard/, register a new device. That should give you a unique access token.

  • Enable device management via the configuration:

    mos config-set dash.enable=true dash.token=ACCESS_TOKEN
    

That's it! Your device starts sending heartbeats which you could see on your dashboard.

Option 2 - build your own app

  • Edit the mos.yml file of your app, include dash library:

    libs:
      ...
      - origin: https://github.com/mongoose-os-libs/dash  # <-- Add this line!
    
  • Rebuild your app, flash it, and configure WiFi:

    mos build --arch ...
    mos flash
    mos wifi WIFI_NAME WIFI_PASSWORD
    
  • Repeat last 2 steps from the previous section.

Device side configuration overview

The dash library provides a couple of options for fine-tuning. To see full list of configuration options, do:

mos config-get dash
{
  "ca_file": "ca.pem",        # CA certs file for secure cloud TLS connectivity
  "enable": true,             # Enable management 
  "heartbeat_interval": 1,    # Heartbeat interval in seconds
  "send_logs": true,          # Whether to send logs
  "server": "wss://mongoose-os.com/dashboard/rpc",  # Cloud server address
  "token": "xxxxxxxxx"       # Device access token
}

For example, to set heartbeat interval to 1 minute and disable logs:

mos config-set dash.enable=true dash.heartbeat_interval=60 dash.send_logs=false