Skip to content

Cloud Management

Ioto can be used as a stand-alone embedded web server or it can use the full cloud-based device management capabilities. Ioto provides a complete end-to-end cloud-based device management solution including device agent, cloud IoT service and a cloud-based Device Manager.

Running Ioto

After Building Ioto run Ioto via make run:

$ make run
app: info: Starting Ioto 1.4.0 in "cloud" mode using "dev" profile
setup: info: Enabling services: db provision register sync serialize test web
app: info: Device Claim ID: M72DANY8BZ
register: info: Device registered with https://api.admin.embedthis.com/api
{
    "product": "01H4R15D3478JD26YDYK408XE6",
    "id": "M72DANY8BZ",
    "created": "2024-01-23T02:03:57.062Z"
}
register: info: Device not yet claimed
web: info: Listening http://:9090
web: info: Listening https://:4443
app: info: Ioto 1.4.0 ready, Device firmware 1.3.0

When Ioto starts, it registers with the EmbedThis Builder cloud and waits to be claimed by a user for management. Until claimed, the device can only be locally managed locally via the embedded web server.

Device Association

The process of associating a device with a user is called "Claiming" and consists of the user presenting a device claim ID that authorizes the user as the owner of the device. The unique claim ID is typically printed on the manufactured device. However, when evaluating Ioto, the Ioto agent will display the claim ID to the console.

An Ioto enabled device can be claimed by any user. Once claimed, the device is associated with the user, a device manager and the underlying device cloud.

During evalution, it is easiest to use the pre-existing Eval Cloud and Eval Device Manager. The Eval Cloud is a multi-tenant, shared cloud for evaluating Ioto. The Eval Manager is a developer device manager suitable for examining and managing devices and device data.

To claim the device using the Eval manager, navigate to the builder and select the Managers page.

Manager List

Then click the Manage icon for the Eval manager. This will launch the Device Manager.

Manager Login

When you log into the Device Manager, you are logging in as a device user. This is a different account to your Builder login account. Device Manager logins are unique for each device cloud.

Manager Login

Enter your desired username and password and click Register. You will be sent an email confirmation code to complete your manager login.

Claiming a Device

After logging in, you will see the device list, which will be initially empty. Click the Claim Device button and enter your device claim ID to claim your device for management.

Manager Login

The Claim ID is the unique device ID displayed by Ioto when run. This ID is dynamically allocated when first run, but can be initialized via the config/device.json5 configuration file. During production, a generated device claim ID is typically printed on the device packaging and device label.

Read more in the Builder Claiming Devices documentation.

1
2
3
$ make run
...
app: info: Device Claim ID: M72DANY8BZ

While an Ioto-enabled device is waiting to be claimed, Ioto will periodically check with the cloud service to see if it has been claimed.

Once the device is claimed via the Manager, Ioto will display:

provision: info: Device claimed
provision: trace: {
    accountId: "XXXXXXXXXXXXXXXXXXXXXXXXXX",
    certificate: "state/ioto.crt",
    endpoint: "xxxxxxxxxxxxx-ats.iot.xxxxxxxxxxxxxx.amazonaws.com",
    id: "M72DANY8BZ",
    key: "state/ioto.key",
    port: 443
}
provision: info: Device provisioned
checkin: info: Device has no pending updates for version: 1.3.0
mqtt: info: Connected to mqtt: xxxxxxxxxxxxx-ats.iot.xxxxxxxxxxxx-1.amazonaws.com:443
demo: info: Running demo cloud counter from start.c
demo: info: Send counter update via MQTT -- counter 0

When claimed, the Ioto agent will be provisioned with a unique device certificate for secure TLS communications and will connect to the cloud using the MQTT protocol. These will be saved under the ./state directory as ioto.crt and ioto.key.

Demonstration Cloud Messaging

The default Ioto configuration will run a demo routine to update a counter and send the updated value to the cloud. This counter updates every thirty seconds and can be monitored via the Device Manager.

In the Device Manager, select the claimed device from the device list.

Manager Login

This will then display the database tables and dashboard for this device.

Key/Value Store

The default device schema has a key/value table called the "Store". The demo counter, will update a value with the key of "counter". Click on the Store table to display the store contents.

This will display all the data items in the store for claimed devices. From here, you can modify an item by clicking the Edit icon or you can edit in place by clicking on a teal color cell and updating the value and then clicking Save.

Store Table

You can reload the table contents by clicking the table reload icon.

Manager Dashboard

The Device Manager includes the ability to display one or more dashboards with data widgets.

Click the Dashboard tab to display the default dashboard, then click the Add Widget icon to display the add widget panel.

Store Widget

You can display database and metric data using numeric, gauge or graphical widgets.

To display the demo counter as a numberic from the database, enter the following widget configuration:

Field Value
Type Numeric
Namespace Database
Model Store
Field value
Select Item key=counter

This will select the Store table item that has a key value set to "counter" and display the "value" field.

After the ioto agent has run for a minute, there will be sufficient data points for a "COUNTER" metric to be created. Metrics permit the display of current and historical data using graphical widgets.

To display the demo counter as a graph using metrics, enter the following widget configuration:

Field Value
Type Graph
Namespace Embedthis/Device
Metric COUNTER
Statistic avg
Resource Dimensions Device=YOUR-CLAIM-ID

That should get you started with Ioto and posting data to the cloud from your device.

Have a look at the start.c file for the code:

static void demo(void)
{
    static int counter = 0;
    int        i;

    for (i = 0; i < 30; i++) {
        ioSetNum("counter", counter);
        rSleep(30 * TPS);
    }
}

-end-