# Soracom Inventory

Manage and monitor LwM2M device resources.

Soracom Inventory is a device management service based on [LwM2M](http://openmobilealliance.org/iot/lightweight-m2m-lwm2m), a lightweight M2M protocol defined by Open Mobile Alliance. Devices that use Inventory communicate with the Soracom platform, allowing you to `read` and `write` device data, `observe` device status for notifications, and `execute` commands remotely.

![Inventory Overview](https://docs.soracom.io/_astro/overview.DwMbK2zo_Z22iz6E.webp)

## Features

### Remote Management

Inventory allows you to read various data from your device, such as operational status, signal strength, and remaining battery. You can also track the physical location of devices equipped with GPS.

LwM2M also provides capabilities of restarting processes and devices, which through the Soracom platform can be managed directly on the User Console or through the Soracom API. You can also extend command functionality by defining custom commands on the device agent.

### Automated Registration

Device management using LwM2M involves setting up an agent process on the device in order to communicate with Inventory. This process typically requires manual key exchange between Inventory and the device for security and authentication. However, when devices communicate using a Soracom Air cellular connection, key exchange is performed automatically and can be installed remotely on the device.

Once the automated key exchange has taken place, the device agent can continue to communicate with Inventory through other network interfaces, such as wired ethernet and Wifi.

### Cloud Integration

Inventory integrates natively with other Soracom services, allowing you to extend LwM2M management functionality in your application. For example, device notifications reported by the agent (such as when signal strength changes) can be sent directly to Soracom Harvest Data, or forwarded to your server or cloud service using Beam or Funnel.

## Mechanism

Inventory uses the OMA DM (Device Management) protocol, which consists of the following components:

- **Bootstrap Server** - Provides key exchange and authentication functionality necessary for establishing a connection with a managed device.
- **Device Management Server** - Provides the major device management functions featured in Inventory.
- **Agent** - An executable binary or SDK on the managed device that communicates with the Bootstrap Server and Device Management Server.

When registering a device for management with Inventory, the Agent will first communicate with the Bootstrap Server over a Soracom Air cellular connection in order to register device information and perform a key exchange.

Once the registration process is complete, the managed device will appear on the User Console in the list of Inventory devices, and is also accessible using the Soracom API. When performing `read`, `write`, `observe`, and `execute` management tasks, communication will occur between the device Agent and the Device Management Server.

As management tasks use the key established during bootstrapping, management can be performed over other network interfaces, such as Wifi.

## Inventory Servers

When using Inventory, your device should be configured to use the following servers:

| Type | Address | Port | Device Connection |
| - | - | - | - |
| Bootstrap | `bootstrap.soracom.io` | `5683` | Soracom Air |
| Device Management | Global: `g.inventory.soracom.io` Japan: `jp.inventory.soracom.io` | `5684` | Any |

---

### Resource Model

Device management with LwM2M is organized using **Resource Model** format, which has a tree structure consisting of **Object** → **Object Instance** → **Resource**. Each node in this tree is assigned a number, which results in a tree structure such as `/3/0/0`.

For example, the resource `/3/0/0` contains the manufacturer information of the device. A `read` request for this resource will cause the device Agent to return the manufacturer information as a response.

Similarly, the `/3/0/4` resource corresponds to a reboot function. An `execute` request for this resource will command the device to restart.

The [OMA LwM2M Object and Resource Registry](http://www.openmobilealliance.org/wp/OMNA/LwM2M/LwM2MRegistry.html) contains a large number of pre-defined resources that can be used with Inventory.

While the Object and Resource Registry provides numerous pre-defined resource responses, the actual behavior depends on the managed device Agent process. In the example of `read`ing `/3/0/0` to retrieve the device manager, it is up to the Agent to determine how the manufacturer information is obtained from the device.

> [!WARNING]
>
> Soracom Inventory documentation refers to **Eclipse Wakaama** and **Eclipse Leshan**, two LwM2M libraries that are compatible with Inventory. Support for each library is provided by their respective contributors. When implementing custom object models for your device agent, refer to their respective documentation for additional information.

You can also define **custom objects** each with custom-defined resources to manage additional properties of your devices that are not defined in the LwM2M Object and Resource Registry. For more information, refer to the [Custom Object Models](https://docs.soracom.io/en/services/inventory/custom-object-models) documentation.

## Limitations

- Each account is limited to a maximum of 16 custom object definitions
- Each object definition is limited to 20 resource definitions per object

## Free Tier

Soracom provides a free tier for Inventory with each Soracom account. Refer to the [Pricing & Fee Schedule](https://docs.soracom.io/en/pricing#soracom-inventory) for more information.
