Device to Cloud Command Line Interface Device Commands

Overview

This chapter describes the commands of d2c to manage devices. Most of the commands such as add-device or update-device return with a JSON output which data model is described in the d2c client sided domain model .


Available Commands

CommandShortDescription
add-deviceadCreates a new device object in DMO.
add-lwm2m-devicealwm2mdCreates a new LWM2M object in DMO.
get-devicesgdGets a device object by its name or id or a list of all device objects from DMO.
update-deviceudUpdates the attributes of a device object in DMO.
delete-deviceddDeletes a device object by its name or id from DMO.
inject-uplink-messageiumInjects an uplink message for a device.
inject-downlink-messageidmInjects a downlink message for a device.
get-device-messagesgdmsGets one or multiple messages from a device messages store in DMO.
delete-device-messageddmDeletes a single device messages from a message store.

NOTE 1
Before you can access DMO API with d2c you need to configure a DMO access profile and activate it (see Manage DMO access profiles ). Without an active DMO access profile d2c cannot access DMO.
NOTE 2

Before d2c can drop requests to the DMO API you need to create an oneM2M application entity for d2c in DMO. To do so run the command

d2c add-d2ccli-application


add-device

  • Description
  • Options
  • Global Options
  • Samples

With the command d2c add-device you can create new device objects of any protocol type. Currently only LWM2M is supported.

d2c add-device  --name <string> | -n <string>
               [--description <string> | -de <string>]
               [--label <string> | -la <string>]
               [--device-type <string> | -dty <string>]
               [--device-name <string> | -dna <string>]
               [--firmware-version <string> | -fv <string>]
               [--software-version <string> | -sv <string>]
               [--os-version <string> | -ov <string>]
               [--hardware-version <string> | -hv <string>]
               [--location <string> | -lo <string>]
               [--protocol <protocol> | -pr <protocol>]
               [--manufacturer <string> | -ma <string>]
               [--model <string> | -mo <string>]
               [--sub-model <string> | -smo <string>]
               [--iccid <string> | -ic <string>]
               [--country <string> | -cy <string>]
               [--uplink-properties <json-object> | -up <json-object>]
               [--device-properties <json-object> | -dp <json-object>]
               [--credentials-id <string> | -cid <string>]
               [--credentials-secret <string> | -csec <string>]
               [--profile-file <file> | -p <file>]
               [--origin <string> | -o <string>]
               [--help | -h]
               [--debug] 
               [--info] 
               [--outfile <filepath>] 
               [--config-directory <directory>]
               [--config-file <file>] 

--name <string>, -n <string>
The required --name option defines the unique identifier of the device. Normally this is the serial number, the device id or the IMEI.
Valid characters for the device name are: digits (0-9), lower and upper case ascii characters (A-Z and a-z), special characters “-”, “_”.

--description <string>, -de <string>
An additonal description of the device.

--label <string>, -la <string>
An additonal label of the device.

--device-name <string>, -dna <string>
An additonal none identifying name of the device.

--firmware-version <string>, -fv <string>
Firmware version of the device.

--software-version <string>, -sv <string>
Software version of the device.

--os-version <string>, -fv <string>
Verison of the operating system of the device.

--hardware-version <string>, -hv <string>
Hardware version of the device.

--location <string>, -lo <string>
An RFC 5870 compliant location descriptor such as geo:25.245470,51.454009. For more information see: https://en.wikipedia.org/wiki/Geo_URI_scheme

--protocol <protocol>, --pr <protocol>
The protocol the device uses for the communication with . The default protocol is currently LWM2M.
Following protocol identifiers are available

Protocol IdentifierProtocol NameCurrently supported by
LWM2MLight Weight M2Myes
UDPUser Datagram Protocolno (planned for R25/Q3)
UDP DTLSAuthenticated and encrypted UDPno
LoRaWANLong Range Wide Area Networkno (planned for R25/Q3)
MQTTMessage Queuing Telemetry Transportno (planned for R25/Q4)
CoAPConstraint Application Protocolno
CoAP DTlSAuthenticated and encrypted CoAPno
HTTPHypertext Transfer Protocolno

--manufacturer <string>, -ma <string>
Manufacturer of the device.

--model <string>, -mo <string>
Model of the device.

--sub-model <string>, -smo <string>
Sub model of the device.

--iccid <string>, -ic <string>
ICCID of the SIM card for cellular communication of the device.

--country <string>, -cy <string>
Country string of the device.

--uplink-properties <json-object>, -up <json-object>
Key/Value map as json object to define so called uplink properties. Uplink properties are attached to each uplink message of the devcice which is forwared to the registered application endpoints. A sample for such uplink properties could be the address where the device has been installed or the type of the decoder which shall be used to decode uplink messages.

--uplink-properties '{
    "address":"Landgrabenweg 149, 53227 Bonn", 
    "decoding-selector":"adeunis"
}'

--device-properties <json-object>, -dp <json-object>
Key/Value map as json object to define additional device or customer specific device properties.

--credentials-id <string>, -cid <string>
In case the device uses an authenticated protocol such as LWM2M over CoAP with DTLS or MQTT the id and secret of authentication credentials can be defined by the options --credentials-id and credentials-secret. In case of a pre shared key (PSK) for DTLS the option --credentials-id defines the PSK identitiy. In case of MQTT --credentials-id defines the username with which the login to the MQTT broker is performed.
By default --credentials-id is set to the name of the device.

--credentials-secret <string>, -csec <string>
In case the device uses an authenticated protocol such as LWM2M over CoAP with DTLS or MQTT the id and secret of authentication credentials can be defined by the options --credentials-id and credentials-secret. In case of a pre shared key (PSK) for DTLS the option --credentials-secret defines the PSK key. In case of MQTT --credentials-secret defines the password with which the login to the MQTT broker is performed.

--profile-file <file>, -p <file>
DMO access profile file which shall be used instead of the current activated on in the d2c configuration.

--origin <string>, -o <string>
Each request to the DMO API requires the HTTP header field X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.

--help, -h
Displays the help for this command.

--info
Turn on info logging.

--debug
Turn on debug logging.

--outfile <file>
File into which the info or debug outputs shall be written additionaly.

--config-directory <directory>
Path to the directory within which the file config.json can be found. By default this directory is $HOME/.d2c.

--config-file <file>
Path to the configuration file. By default this path is $HOME/.d2c/config.json.

d2c add-device --name roland-20250528-01 
{
    "id": "68371835b5725d3ee5462e96",
    "name": "roland-20250528-01",
    "creationTime": "2025-05-28T14:05:41",
    "lastModificationTime": "2025-05-28T14:05:41",
    "iccid": null,
    "deviceType": "",
    "deviceName": "",
    "location": null,
    "label": "",
    "description": "",
    "firmwareVersion": "",
    "softwareVersion": "",
    "osVersion": "",
    "hardwareVersion": "",
    "protocols": [
        "LWM2M"
    ],        
    "manufacturer": "",
    "model": "",
    "subModel": "",
    "country": "",
    "uplinkProperties": {},
    "deviceProperties": {},
    "credentialsId": "roland-20250528-01",
    "credentialsSecret": "***"
}

d2c add-device \
  --name "918575150422188" \
  --manufacturer "adeunis" \
  --model "NB-IoT Comfort Serenity" \
  --description "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis" \
  --device-type "Temperature, Humidity, CO2, VOC sensor" \
  --label "Demo" \
  --device-name "adeunis NB-IoT Comfort Serenity" \
  --firmware-version "M0B.800005" \
  --software-version "3.2.1_2025" \
  --os-version "" \
  --hardware-version "1.0.4" \
  --location "geo:25.245470,51.454009" \
  --iccid "89363011216407038376" \
  --country "AW" \
  --protocol "LWM2M" \
  --credentials-id "918575150422188" \
  --credentials-secret "ZlBwbzg/NXR6a1kzJjNyVCFB" \
  --uplink-properties '{
    "address":"Landgrabenweg 149, 53227 Bonn, Germany", 
    "decoding-selector":"adeunis"
  }' \
  --device-properties '{
    "installation-date":"2021-01-24",
    "battery-replacement-date":"2025-03-25"
  }'
{
    "id": "6839a25de294aa75732cc464",
    "name": "918575150422188",
    "creationTime": "2025-05-30T12:19:41",
    "lastModificationTime": "2025-05-30T12:19:41",
    "iccid": null,
    "deviceType": "Temperature, Humidity, CO2, VOC sensor",
    "deviceName": "adeunis NB-IoT Comfort Serenity",
    "location": "geo:25.245470,51.454009",
    "label": "Demo",
    "description": "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis",
    "firmwareVersion": "M0B.800005",
    "softwareVersion": "3.2.1_2025",
    "osVersion": "",
    "hardwareVersion": "1.0.4",
    "protocols": [
        "LWM2M"
    ],    
    "manufacturer": "adeunis",
    "model": "NB-IoT Comfort Serenity",
    "subModel": "",
    "country": "AW",
    "uplinkProperties": {
        "address": "Landgrabenweg 149, 53227 Bonn, Germany",
        "decoding-selector": "adeunis"
    },
    "deviceProperties": {
        "installation-date": "2021-01-24",
        "battery-replacement-date": "2025-03-25"
    },
    "credentialsId": "918575150422188",
    "credentialsSecret": "***"
}


add-lwm2m-device

  • Description
  • Options
  • Global Options
  • Samples

With the command d2c add-lwm2m-device you can create new lwm2m device objects. This command is almost the same like d2c add-device. The only difference is, that the options credentils-i and credentials-secret are required and not optional and the --protocol option is set automatically to LWM2M.

d2c add-lwm2m-device  --name <string> | -n <string>
                      --credentials-id <string> | -cid <string>
                      --credentials-secret <string> | -csec <string>
                     [--description <string> | -de <string>]
                     [--label <string> | -la <string>]
                     [--device-type <string> | -dty <string>]
                     [--device-name <string> | -dna <string>]
                     [--firmware-version <string> | -fv <string>]
                     [--software-version <string> | -sv <string>]
                     [--os-version <string> | -ov <string>]
                     [--hardware-version <string> | -hv <string>]
                     [--location <string> | -lo <string>]
                     [--manufacturer <string> | -ma <string>]
                     [--model <string> | -mo <string>]
                     [--sub-model <string> | -smo <string>]
                     [--iccid <string> | -ic <string>]
                     [--country <string> | -cy <string>]
                     [--uplink-properties <json-object> | -up <json-object>]
                     [--device-properties <json-object> | -dp <json-object>]
                     [--profile-file <file> | -p <file>]
                     [--origin <string> | -o <string>]
                     [--help | -h]
                     [--debug] 
                     [--info] 
                     [--outfile <filepath>] 
                     [--config-directory <directory>]
                     [--config-file <file>] 

--name <string>, -n <string>
The required --name option defines the unique identifier of the device. Normally this is the serial number, the device id or the IMEI.
Valid characters for the device name are: digits (0-9), lower and upper case ascii characters (A-Z and a-z), special characters “-”, “_”.

--credentials-id <string>, -cid <string>
Required id of the DTLS PSK which is used for device authentication and LwM2M protocol encryption.

--credentials-secret <string>, -csec <string>
Required secret of the DTLS PSK which is used for device authentication and LwM2M protocol encryption.

--description <string>, -de <string>
An additonal description of the device.

--label <string>, -la <string>
An additonal label of the device.

--device-name <string>, -dna <string>
An additonal none identifying name of the device.

--firmware-version <string>, -fv <string>
Firmware version of the device.

--software-version <string>, -sv <string>
Software version of the device.

--os-version <string>, -fv <string>
Verison of the operating system of the device.

--hardware-version <string>, -hv <string>
Hardware version of the device.

--location <string>, -lo <string>
An RFC 5870 compliant location descriptor such as geo:25.245470,51.454009. For more information see: https://en.wikipedia.org/wiki/Geo_URI_scheme

--protocol <protocol>, --pr <protocol>
The protocol the device uses for the communication with . The default protocol is currently LWM2M.
Following protocol identifiers are available

Protocol IdentifierProtocol NameCurrently supported by
LWM2MLight Weight M2Myes
UDPUser Datagram Protocolno (planned for R25/Q3)
UDP DTLSAuthenticated and encrypted UDPno
LoRaWANLong Range Wide Area Networkno (planned for R25/Q3)
MQTTMessage Queuing Telemetry Transportno (planned for R25/Q4)
CoAPConstraint Application Protocolno
CoAP DTlSAuthenticated and encrypted CoAPno
HTTPHypertext Transfer Protocolno

--manufacturer <string>, -ma <string>
Manufacturer of the device.

--model <string>, -mo <string>
Model of the device.

--sub-model <string>, -smo <string>
Sub model of the device.

--iccid <string>, -ic <string>
ICCID of the SIM card for cellular communication of the device.

--country <string>, -cy <string>
Country string of the device.

--uplink-properties <json-object>, -up <json-object>
Key/Value map as json object to define so called uplink properties. Uplink properties are attached to each uplink message of the devcice which is forwared to the registered application endpoints. A sample for such uplink properties could be the address where the device has been installed or the type of the decoder which shall be used to decode uplink messages.

--uplink-properties '{
    "address":"Landgrabenweg 149, 53227 Bonn", 
    "decoding-selector":"adeunis"
}'

--device-properties <json-object>, -dp <json-object>
Key/Value map as json object to define additional device or customer specific device properties.

--profile-file <file>, -p <file>
DMO access profile file which shall be used instead of the current activated on in the d2c configuration.

--origin <string>, -o <string>
Each request to the DMO API requires the HTTP header field X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.

--help, -h
Displays the help for this command.

--info
Turn on info logging.

--debug
Turn on debug logging.

--outfile <file>
File into which the info or debug outputs shall be written additionaly.

--config-directory <directory>
Path to the directory within which the file config.json can be found. By default this directory is $HOME/.d2c.

--config-file <file>
Path to the configuration file. By default this path is $HOME/.d2c/config.json.

add-lwm2m-device \
  --name roland-20250603-02 \
  --credentials-id roland-20250603-02 \
  --credentials-secret ZGFzMWlzdDJnZWhlaW1uaXMzIw==
{
    "id": "683f0ab83f869e82c1cbe0e3",
    "name": "roland-20250603-02",
    "creationTime": "2025-06-03T14:46:16",
    "lastModificationTime": "2025-06-03T14:46:16",
    "iccid": null,
    "deviceType": "",
    "deviceName": "",
    "location": null,
    "label": "",
    "description": "",
    "firmwareVersion": "",
    "softwareVersion": "",
    "osVersion": "",
    "hardwareVersion": "",
    "protocols": [
        "LWM2M"
    ],
    "manufacturer": "",
    "model": "",
    "subModel": "",
    "country": "",
    "uplinkProperties": {},
    "deviceProperties": {},
    "credentialsId": "roland-20250603-02",
    "credentialsSecret": "***"
}

d2c add-lwm2m-device \
  --name "918575150422192" \
  --credentials-id "918575150422192" \
  --credentials-secret "ZGFzMWlzdDJnZWhlaW1uaXMzIw==" \
  --manufacturer "adeunis" \
  --model "NB-IoT Comfort Serenity" \
  --description "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis" \
  --device-type "Temperature, Humidity, CO2, VOC sensor" \
  --label "Demo" \
  --device-name "adeunis NB-IoT Comfort Serenity" \
  --firmware-version "M0B.800005" \
  --software-version "3.2.1_2025" \
  --os-version "" \
  --hardware-version "1.0.4" \
  --location "geo:25.245470,51.454009" \
  --iccid "89363011216407038376" \
  --country "AW" \
  --uplink-properties '{
    "address":"Landgrabenweg 149, 53227 Bonn, Germany", 
    "decoding-selector":"adeunis"
  }' \
  --device-properties '{
    "installation-date":"2021-01-24",
    "battery-replacement-date":"2025-03-25"
  }'
{
    "id": "683f0b7c970a75320d2f7bc1",
    "name": "918575150422192",
    "creationTime": "2025-06-03T14:49:32",
    "lastModificationTime": "2025-06-03T14:49:32",
    "iccid": null,
    "deviceType": "Temperature, Humidity, CO2, VOC sensor",
    "deviceName": "adeunis NB-IoT Comfort Serenity",
    "location": "geo:25.245470,51.454009",
    "label": "Demo",
    "description": "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis",
    "firmwareVersion": "M0B.800005",
    "softwareVersion": "3.2.1_2025",
    "osVersion": "",
    "hardwareVersion": "1.0.4",
    "protocols": [
        "LWM2M"
    ],
    "manufacturer": "adeunis",
    "model": "NB-IoT Comfort Serenity",
    "subModel": "",
    "country": "AW",
    "uplinkProperties": {
        "address": "Landgrabenweg 149, 53227 Bonn, Germany",
        "decoding-selector": "adeunis"
    },
    "deviceProperties": {
        "installation-date": "2021-01-24",
        "battery-replacement-date": "2025-03-25"
    },
    "credentialsId": "918575150422192",
    "credentialsSecret": "***"
}


get-devices

  • Description
  • Options
  • Global Options
  • Samples

The command d2c get-devices retrievs information about a single or a list of multiple devices from DMO. In case you use the option --name or --id to identify a device the command returns all detail information of the device. In case you don’t identify a specific device the command returns the list of devices with a limit set of information.

d2c get-devices [--name <string> | -n <string> | --id <string> | -i <string>]
                [--select <select fields> | -s <select fields>]
                [--format <CSV | JSON> | -f <CSV | JSON>] 
                [--separator-char <char> | -sc <char>]
                [--result-content-indicator <rci> | -rci <rci>]
                [--limit <int> | -li <int>]
                [--offset <int> | -os <int>]
                [--profile-file <file> | -p <file>]
                [--origin <string> | -o <string>]
                [--help | -h]
                [--debug] 
                [--info] 
                [--outfile <filepath>] 
                [--config-directory <directory>]
                [--config-file <file>] 

--name <string>, -n <string>
In case you want to retriev the detail information of specific device you can use the option --name to identify the device.

--id <string>, -i <string>
In case you want to retriev the detail information of specific device you can use the option --id to identify the device.

--select <select fields>, -s <select fields>
A comma seperated list of element names which shall be selected from the returned objects and written to stdout as CSV or JSON format. To control if the output is written in CSV or JSON format use the –format option. To understand which fields are available to select you can run d2c get-devices without –select option to see which fields are part of the queried devices or you can read the documentation Key Concepts of Device to Cloud .

--format <CSV | JSON>, -f <CSV | JSON>
With the –format option you can control in which format the queried resource objects shall be written to stdout. If you don’t define any select fields with –select option the default format is JSON. If you define select fields with –select option the default format is CSV.

--separator-char <char>
If the –select option is used the selected elements are written to the stdout as CSV. With –separator-char you can control which character shall be used to seperate the different fields from each other in the output. By default ; is used as separator character.

--result-content-indicator <rci>, -rci <rci>
With the option –result-content-indicator you can control the amount of content which is returned as a result. The following indicators can be used:

Result content indicatorShort
return-nothingrn
return-allra
return-modifiedrm
attributesa
attributes-and-childrenac
childrenc

--limit <int>, -li <int>
To controll the number of resource objects in the result you can use the option –limit. With the –limit option in combination with the –offset option, you can implement a pagination process to walk through large amounts of resource objects.

--offset <int>, -offset <int>
With the –offset option you can define the index or offset of the first resource object in the response. Normally you use the –offset option together with the –limit option to implement a pagination process.

--profile-file <file>, -p <file>
DMO access profile file which shall be used instead of the current activated on in the d2c configuration.

--origin <string>, -o <string>
Each request to the DMO API requires the HTTP header field X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.

--help, -h
Displays the help for this command.

--info
Turn on info logging.

--debug
Turn on debug logging.

--outfile <file>
File into which the info or debug outputs shall be written additionaly.

--config-directory <directory>
Path to the directory within which the file config.json can be found. By default this directory is $HOME/.d2c.

--config-file <file>
Path to the configuration file. By default this path is $HOME/.d2c/config.json.

d2c get-devices --name 918575150422192 
{
    "id": "683f0b7c970a75320d2f7bc1",
    "name": "918575150422192",
    "creationTime": "2025-06-03T14:49:32",
    "lastModificationTime": "2025-06-03T14:49:32",
    "iccid": null,
    "deviceType": "Temperature, Humidity, CO2, VOC sensor",
    "deviceName": "adeunis NB-IoT Comfort Serenity",
    "location": "geo:25.245470,51.454009",
    "label": "Demo",
    "description": "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis",
    "firmwareVersion": "M0B.800005",
    "softwareVersion": "3.2.1_2025",
    "osVersion": "",
    "hardwareVersion": "1.0.4",
    "protocols": [
        "LWM2M"
    ],
    "manufacturer": "adeunis",
    "model": "NB-IoT Comfort Serenity",
    "subModel": "",
    "country": "AW",
    "uplinkProperties": {
        "address": "Landgrabenweg 149, 53227 Bonn, Germany",
        "decoding-selector": "adeunis"
    },
    "deviceProperties": {
        "installation-date": "2021-01-24",
        "battery-replacement-date": "2025-03-25"
    },
    "credentialsId": "918575150422192",
    "credentialsSecret": "***"
}

export SHOW_SECRETS=1
d2c get-devices --name 918575150422192 --select "credentialsId,credentialsSecret"

918575150422192;ZGFzMWlzdDJnZWhlaW1uaXMzIw==

export SHOW_SECRETS=1
d2c get-devices --name 918575150422192 --select "credentialsId,credentialsSecret" --format JSON 
{
    "credentialsId": "918575150422192",
    "credentialsSecret": "ZGFzMWlzdDJnZWhlaW1uaXMzIw=="
}

d2c get-devices 
[
{
    "id": "6839a43db5725d3ee5462eb8",
    "name": "roland-20250530-01",
    "labels": {
        "profile": "SCS-LwM2M",
        "ICCID": "282828282828"
    },
    "creationTime": "2025-05-30T12:27:41",
    "lastModificationTime": "2025-05-30T12:27:41"
},
{
    "id": "683f0451970a75320d2f7b93",
    "name": "roland-20250603-01",
    "labels": {
        "profile": "SCS-LwM2M",
        "ICCID": "282828282828"
    },
    "creationTime": "2025-06-03T14:18:57",
    "lastModificationTime": "2025-06-03T14:18:57"
},
{
    "id": "683f0ab83f869e82c1cbe0e3",
    "name": "roland-20250603-02",
    "labels": {
        "profile": "SCS-LwM2M",
        "ICCID": "282828282828"
    },
    "creationTime": "2025-06-03T14:46:16",
    "lastModificationTime": "2025-06-03T14:46:16"
}
]

d2c get-devices --select id,name,labels.ICCID

68371835b5725d3ee5462e96;roland-20250528-01;282828282828 6839a43db5725d3ee5462eb8;roland-20250530-01;282828282828 683f0451970a75320d2f7b93;roland-20250603-01;282828282828 683f0ab83f869e82c1cbe0e3;roland-20250603-02;282828282828


update-device

  • Description
  • Options
  • Global Options
  • Samples

With the command d2c update-device you can update the attributes an existing device objects.

d2c update-device --name <string> | -n <string>  | --id <string> | -i <string>
                  [--description <string> | -de <string>]
                  [--label <string> | -la <string>]
                  [--device-type <string> | -dty <string>]
                  [--device-name <string> | -dna <string>]
                  [--firmware-version <string> | -fv <string>]
                  [--software-version <string> | -sv <string>]
                  [--os-version <string> | -ov <string>]
                  [--hardware-version <string> | -hv <string>]
                  [--location <string> | -lo <string>]
                  [--protocol <protocol> | -pr <protocol>]
                  [--manufacturer <string> | -ma <string>]
                  [--model <string> | -mo <string>]
                  [--sub-model <string> | -smo <string>]
                  [--iccid <string> | -ic <string>]
                  [--country <string> | -cy <string>]
                  [--uplink-properties <json-object> | -up <json-object>]
                  [--device-properties <json-object> | -dp <json-object>]
                  [--credentials-id <string> | -cid <string>]
                  [--credentials-secret <string> | -csec <string>]
                  [--profile-file <file> | -p <file>]
                  [--origin <string> | -o <string>]
                  [--help | -h]
                  [--debug] 
                  [--info] 
                  [--outfile <filepath>] 
                  [--config-directory <directory>]
                  [--config-file <file>] 

--name <string>, -n <string>
The required --name option defines the unique identifier of the device. Alternatively you can use --id option instead of --name to identify the device.

--id <string>, -i <string>
The required --id option defines the unique identifier of the device. Alternatively you can use --name option instead of --id to identify the device.

--description <string>, -de <string>
An additonal description of the device.

--label <string>, -la <string>
An additonal label of the device.

--device-name <string>, -dna <string>
An additonal none identifying name of the device.

--firmware-version <string>, -fv <string>
Firmware version of the device.

--software-version <string>, -sv <string>
Software version of the device.

--os-version <string>, -fv <string>
Verison of the operating system of the device.

--hardware-version <string>, -hv <string>
Hardware version of the device.

--location <string>, -lo <string>
An RFC 5870 compliant location descriptor such as geo:25.245470,51.454009. For more information see: https://en.wikipedia.org/wiki/Geo_URI_scheme

--protocol <protocol>, --pr <protocol>
The protocol the device uses for the communication with . The default protocol is currently LWM2M.
Following protocol identifiers are available

Protocol IdentifierProtocol NameCurrently supported by
LWM2MLight Weight M2Myes
UDPUser Datagram Protocolno (planned for R25/Q3)
UDP DTLSAuthenticated and encrypted UDPno
LoRaWANLong Range Wide Area Networkno (planned for R25/Q3)
MQTTMessage Queuing Telemetry Transportno (planned for R25/Q4)
CoAPConstraint Application Protocolno
CoAP DTlSAuthenticated and encrypted CoAPno
HTTPHypertext Transfer Protocolno

--manufacturer <string>, -ma <string>
Manufacturer of the device.

--model <string>, -mo <string>
Model of the device.

--sub-model <string>, -smo <string>
Sub model of the device.

--iccid <string>, -ic <string>
ICCID of the SIM card for cellular communication of the device.

--country <string>, -cy <string>
Country string of the device.

--uplink-properties <json-object>, -up <json-object>
Key/Value map as json object to define so called uplink properties. Uplink properties are attached to each uplink message of the devcice which is forwared to the registered application endpoints. A sample for such uplink properties could be the address where the device has been installed or the type of the decoder which shall be used to decode uplink messages.

--uplink-properties '{
    "address":"Landgrabenweg 149, 53227 Bonn", 
    "decoding-selector":"adeunis",
    "scale-factor":2.8
}'

To control if a single property shall be added to or deleted from the current map of properties you can prefix the property name with one of the following operation indicators:

Operation IndicatorDescription
No operation indicator defaults to + if the the assign value is NOT null. If the assigned values is null the operation indicator defaults to -.
+Add the property current map of properties.
-Delete the property from the current map of properties.

If only a single property is prefixed with an operation indicator the update operation is performed as an integration operation and by this the complete map of properties are integrated with the existing map of properties of the device.
To replace the current map of properties with a new one just don’t prefix any propery with an operation indicator.

--device-properties <json-object>, -dp <json-object>
Key/Value map as json object to define additional device or customer specific device properties.
To control if a single property shall be added to or deleted from the current map of properties you can prefix the property name with one of the following operation indicators:

Operation IndicatorDescription
No operation indicator defaults to + if the the assign value is NOT null. If the assigned values is null the operation indicator defaults to -.
+Add the property current map of properties.
-Delete the property from the current map of properties.

If only a single property is prefixed with an operation indicator the update operation is performed as an integration operation and by this the complete map of properties are integrated with the existing map of properties of the device.
To replace the current map of properties with a new one just don’t prefix any propery with an operation indicator.

--credentials-id <string>, -cid <string>
In case the device uses an authenticated protocol such as LWM2M over CoAP with DTLS or MQTT the id and secret of authentication credentials can be defined by the options --credentials-id and credentials-secret. In case of a pre shared key (PSK) for DTLS the option --credentials-id defines the PSK identitiy. In case of MQTT --credentials-id defines the username with which the login to the MQTT broker is performed.
By default --credentials-id is set to the name of the device.

--credentials-secret <string>, -csec <string>
In case the device uses an authenticated protocol such as LWM2M over CoAP with DTLS or MQTT the id and secret of authentication credentials can be defined by the options --credentials-id and credentials-secret. In case of a pre shared key (PSK) for DTLS the option --credentials-secret defines the PSK key. In case of MQTT --credentials-secret defines the password with which the login to the MQTT broker is performed.

--profile-file <file>, -p <file>
DMO access profile file which shall be used instead of the current activated on in the d2c configuration.

--origin <string>, -o <string>
Each request to the DMO API requires the HTTP header field X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.

--help, -h
Displays the help for this command.

--info
Turn on info logging.

--debug
Turn on debug logging.

--outfile <file>
File into which the info or debug outputs shall be written additionaly.

--config-directory <directory>
Path to the directory within which the file config.json can be found. By default this directory is $HOME/.d2c.

--config-file <file>
Path to the configuration file. By default this path is $HOME/.d2c/config.json.

d2c update-device \
  --name "918575150422188" \
  --description      "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis" \
  --manufacturer     "adeunis" \
  --model            "NB-IoT Comfort Serenity" \
  --description      "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis" \
  --device-type      "Temperature, Humidity, CO2, VOC sensor" \
  --label            "Demo" \
  --device-name      "adeunis NB-IoT Comfort Serenity" \
  --firmware-version "M0B.800005" \
  --software-version "3.2.1_2025" \
  --os-version       "" \
  --hardware-version "1.0.4" \
  --location         "geo:25.245470,51.454009" \
  --iccid            "89363011216407038376" \
  --country          "AW" \
  --protocol           "LWM2M" \
  --credentials-id     "918575150422188" \
  --credentials-secret "ZlBwbzg/NXR6a1kzJjNyVCFB" \
  --uplink-properties '{
    "address":"Landgrabenweg 149, 53227 Bonn, Germany", 
    "decoding-selector":"adeunis"
  }' \
  --device-properties '{
    "installation-date":"2021-01-24",
    "battery-replacement-date":"2025-03-25"
  }'
Don't Be Supprised About Error 500 Server Error
The credentials are updated by deleting the old credentials and creating new ones. Since DMO performs the delete and create’ operations synchronously it can happen that the d2c update-device command receives an 500 Server Error when it performs the create operation. If this happens you will see the error message on the console and the create operation is re-executed after a little sleep. If you use the --info options you can see the executed steps in more detail.
{
    "id": "6839a3d4e294aa75732cc47a",
    "name": "918575150422188",
    "creationTime": "2025-05-30T12:25:56",
    "lastModificationTime": "2025-06-06T06:44:19",
    "iccid": null,
    "deviceType": "Temperature, Humidity, CO2, VOC sensor",
    "deviceName": "adeunis NB-IoT Comfort Serenity",
    "location": "geo:25.245470,51.454009",
    "label": "Demo",
    "description": "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis",
    "firmwareVersion": "M0B.800005",
    "softwareVersion": "3.2.1_2025",
    "osVersion": "X",
    "hardwareVersion": "1.0.4",
    "protocols": [
        "LWM2M"
    ],
    "manufacturer": "adeunis",
    "model": "NB-IoT Comfort Serenity",
    "subModel": "",
    "country": "AW",
    "uplinkProperties": {
        "address": "Landgrabenweg 149, 53227 Bonn, Germany",
        "decoding-selector": "adeunis"
    },
    "deviceProperties": {
        "installation-date": "2021-01-24",
        "battery-replacement-date": "2025-03-25"
    },
    "credentialsId": "918575150422188",
    "credentialsSecret": "***"
}

export SHOW_SECRETS=1

d2c update-device \
  --id "6839a3d4e294aa75732cc47a" \
  --credentials-id "918575150422188" \
  --credentials-secret "ZlBwbzg/NXR6a1kzJjNyVCFB"
{
    "id": "6839a3d4e294aa75732cc47a",
    "name": "918575150422188",
    "creationTime": "2025-05-30T12:25:56",
    "lastModificationTime": "2025-06-06T06:44:19",
    "iccid": null,
    "deviceType": "Temperature, Humidity, CO2, VOC sensor",
    "deviceName": "adeunis NB-IoT Comfort Serenity",
    "location": "geo:25.245470,51.454009",
    "label": "Demo",
    "description": "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis",
    "firmwareVersion": "M0B.800005",
    "softwareVersion": "3.2.1_2025",
    "osVersion": "X",
    "hardwareVersion": "1.0.4",
    "protocols": [
        "LWM2M"
    ],
    "manufacturer": "adeunis",
    "model": "NB-IoT Comfort Serenity",
    "subModel": "",
    "country": "AW",
    "uplinkProperties": {
        "address": "Landgrabenweg 149, 53227 Bonn, Germany",
        "decoding-selector": "adeunis"
    },
    "deviceProperties": {
        "installation-date": "2021-01-24",
        "battery-replacement-date": "2025-03-25"
    },
    "credentialsId": "918575150422188",
    "credentialsSecret": "ZlBwbzg/NXR6a1kzJjNyVCFB"
}

d2c update-device \
  --name "918575150422188" \
  --uplink-properties '{
    "address":"Kuckhoffstr 114A, 13156 Berlin, Germany", 
    "decoding-selector":"adeunis",
    "scale-factor":2.8
  }' 
{
    "id": "6839a3d4e294aa75732cc47a",
    "name": "918575150422188",
    "creationTime": "2025-05-30T12:25:56",
    "lastModificationTime": "2025-06-06T07:38:22",
    "iccid": "282828282828",
    "deviceType": "Temperature, Humidity, CO2, VOC sensor",
    "deviceName": "adeunis NB-IoT Comfort Serenity",
    "location": "geo:25.245470,51.454009",
    "label": "Demo",
    "description": "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis",
    "firmwareVersion": "M0B.800005",
    "softwareVersion": "3.2.1_2025",
    "osVersion": "X",
    "hardwareVersion": "1.0.4",
    "protocols": [
        "LWM2M"
    ],
    "manufacturer": "adeunis",
    "model": "NB-IoT Comfort Serenity",
    "subModel": "",
    "country": "AW",
    "uplinkProperties": {
        "address": "Kuckhoffstr 114A, 13156 Berlin, Germany",
        "decoding-selector": "adeunis",
        "scale-factor": 2.8
    },
    "deviceProperties": {
        "installation-date": "2021-01-24",
        "battery-replacement-date": "2025-03-25"
    },
    "credentialsId": "918575150422188",
    "credentialsSecret": "***"
}


d2c update-device \
  --name "918575150422188" \
  --uplink-properties '{
    "-scale-factor":null
  }' 
{
    "id": "6839a3d4e294aa75732cc47a",
    "name": "918575150422188",
    "creationTime": "2025-05-30T12:25:56",
    "lastModificationTime": "2025-06-06T07:38:22",
    "iccid": "282828282828",
    "deviceType": "Temperature, Humidity, CO2, VOC sensor",
    "deviceName": "adeunis NB-IoT Comfort Serenity",
    "location": "geo:25.245470,51.454009",
    "label": "Demo",
    "description": "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis",
    "firmwareVersion": "M0B.800005",
    "softwareVersion": "3.2.1_2025",
    "osVersion": "X",
    "hardwareVersion": "1.0.4",
    "protocols": [
        "LWM2M"
    ],
    "manufacturer": "adeunis",
    "model": "NB-IoT Comfort Serenity",
    "subModel": "",
    "country": "AW",
    "uplinkProperties": {
        "address": "Kuckhoffstr 114A, 13156 Berlin, Germany",
        "decoding-selector": "adeunis"
    },
    "deviceProperties": {
        "installation-date": "2021-01-24",
        "battery-replacement-date": "2025-03-25"
    },
    "credentialsId": "918575150422188",
    "credentialsSecret": "***"
}


d2c update-device \
  --name "918575150422188" \
  --uplink-properties '{
    "+scale-factor":99.9
  }' 
{
    "id": "6839a3d4e294aa75732cc47a",
    "name": "918575150422188",
    "creationTime": "2025-05-30T12:25:56",
    "lastModificationTime": "2025-06-06T07:38:22",
    "iccid": "282828282828",
    "deviceType": "Temperature, Humidity, CO2, VOC sensor",
    "deviceName": "adeunis NB-IoT Comfort Serenity",
    "location": "geo:25.245470,51.454009",
    "label": "Demo",
    "description": "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis",
    "firmwareVersion": "M0B.800005",
    "softwareVersion": "3.2.1_2025",
    "osVersion": "X",
    "hardwareVersion": "1.0.4",
    "protocols": [
        "LWM2M"
    ],
    "manufacturer": "adeunis",
    "model": "NB-IoT Comfort Serenity",
    "subModel": "",
    "country": "AW",
    "uplinkProperties": {
        "address": "Kuckhoffstr 114A, 13156 Berlin, Germany",
        "decoding-selector": "adeunis",
        "scale-factor:99.9
    },
    "deviceProperties": {
        "installation-date": "2021-01-24",
        "battery-replacement-date": "2025-03-25"
    },
    "credentialsId": "918575150422188",
    "credentialsSecret": "***"
}

d2c update-device --name "918575150422188" --uplink-properties '{}'
{
    "id": "6839a3d4e294aa75732cc47a",
    "name": "918575150422188",
    "creationTime": "2025-05-30T12:25:56",
    "lastModificationTime": "2025-06-06T07:39:59",
    "iccid": "282828282828",
    "deviceType": "Temperature, Humidity, CO2, VOC sensor",
    "deviceName": "adeunis NB-IoT Comfort Serenity",
    "location": "geo:25.245470,51.454009",
    "label": "Demo",
    "description": "Temperature, Humidity, CO2, VOC NB-IoT sensor from adeunis",
    "firmwareVersion": "M0B.800005",
    "softwareVersion": "3.2.1_2025",
    "osVersion": "X",
    "hardwareVersion": "1.0.4",
    "protocols": [
        "LWM2M"
    ],
    "manufacturer": "adeunis",
    "model": "NB-IoT Comfort Serenity",
    "subModel": "",
    "country": "AW",
    "uplinkProperties": {},
    "deviceProperties": {
        "installation-date": "2021-01-24",
        "battery-replacement-date": "2025-03-25"
    },
    "credentialsId": "918575150422188",
    "credentialsSecret": "ZlBwbzg/NXR6a1kzJjNyVCFB"
}


delete-device

  • Description
  • Options
  • Global Options
  • Samples

With the command d2c delete-device you can delete an existing device object by its name or id. Not only the device object itself is deleted but also all associated data such as stored uplink or downlink messages.

d2c delete-device --name <string> | -n <string> | --id <string> | -i <string>
                  [--profile-file <file> | -p <file>]
                  [--origin <string> | -o <string>]
                  [--help | -h]
                  [--debug] 
                  [--info] 
                  [--outfile <filepath>] 
                  [--config-directory <directory>]
                  [--config-file <file>] 
--name <string>, -n <string>
The required --name option defines the unique identifier of the device which shall be deleted. Alternatively you can use --id option instead of --name to identify the device.

--id <string>, -i <string>
The required --id option defines the unique identifier of the device. Alternatively you can use --name option instead of --id to identify the device.

--profile-file <file>, -p <file>
DMO access profile file which shall be used instead of the current activated on in the d2c configuration.

--origin <string>, -o <string>
Each request to the DMO API requires the HTTP header field X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.

--help, -h
Displays the help for this command.

--info
Turn on info logging.

--debug
Turn on debug logging.

--outfile <file>
File into which the info or debug outputs shall be written additionaly.

--config-directory <directory>
Path to the directory within which the file config.json can be found. By default this directory is $HOME/.d2c.

--config-file <file>
Path to the configuration file. By default this path is $HOME/.d2c/config.json.

d2c delete-device --name 918575150422188 

d2c delete-device --id 6842bf28970a75320d2f7c85 


  • Description
  • Options
  • Global Options
  • Samples

With the command d2c inject-uplink-message you can post messages into device’s uplink message store of . This command is normally used to simulate device uplink communication and to perform system tests.

d2c inject-uplink-message --name <string> | -n <string> | --id <string> | -i <string>
                          [--content <string> | -con <string>]
                          [--content-file <file> | -conf <file>]
                          [--content-type <mime-type> | -cont <mime-type>]
                          [--profile-file <file> | -p <file>]
                          [--origin <string> | -o <string>]
                          [--help | -h]
                          [--debug] 
                          [--info] 
                          [--outfile <filepath>] 
                          [--config-directory <directory>]
                          [--config-file <file>] 
--name <string>, -n <string>
The required --name option defines the unique identifier of the device for which uplink messages shall be injected. Alternatively you can use --id option instead of --name to identify the device.

--id <string>, -i <string>
The required --id option defines the unique identifier of the device. Alternatively you can use --name option instead of --id to identify the device.

--content <string>, -con <string>
The --content option defines content of the message which shall be posted to the uplink message store of the device.
Currently only string content is supported.

--content-file <file>, -conf <file>
With the option --content-file you can let read the d2c inject-uplink-message command the message content from a file.

--content-type <mime-type>, -conf <mime-type>
To define the type of the content by a mime-type you can use the option --content-type.
Currently text/plain and application/json is supported. If the option is not defined it defaults to text/plain.
--profile-file <file>, -p <file>
DMO access profile file which shall be used instead of the current activated on in the d2c configuration.

--origin <string>, -o <string>
Each request to the DMO API requires the HTTP header field X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.

--help, -h
Displays the help for this command.

--info
Turn on info logging.

--debug
Turn on debug logging.

--outfile <file>
File into which the info or debug outputs shall be written additionaly.

--config-directory <directory>
Path to the directory within which the file config.json can be found. By default this directory is $HOME/.d2c.

--config-file <file>
Path to the configuration file. By default this path is $HOME/.d2c/config.json.

d2c inject-uplink-message \
  --name 918575150422191 \
  --content "00000F0DFD0936005900C8"
{
    "id": "6842fa88970a75320d2f7d55",
    "name": "b6469c4a-8163-4eb0-817b-0e8525529a73",
    "creationTime": "2025-06-06T14:26:16",
    "lastModificationTime": "2025-06-06T14:26:16",
    "content": "00000F0DFD0936005900C8",
    "contentInfo": "text/plain:0",
    "contentSize": 22,
    "contentType": "text/plain",
    "contentEncoding": "none"
}

d2c inject-uplink-message 
  --name 918575150422191 \
  --content-type "application/json" \
  --content '{"temperature":27.4}'
{
    "id": "684301ca970a75320d2f7d5b",
    "name": "14e8ca27-115d-466a-b244-7e0e4c68d8c8",
    "creationTime": "2025-06-06T14:57:14",
    "lastModificationTime": "2025-06-06T14:57:14",
    "content": {
        "temperature": 27.4
    },
    "contentInfo": "application/json:0",
    "contentSize": 20,
    "contentType": "application/json",
    "contentEncoding": "none"
}

{
    "topic": "443582399409764/1000001/up/AI/104",
    "payload": {
        "name": "MGB - HG1 - ASP01 - Heizsysteme - Heizwassererzeugung - 2.UG - Raum 0001 - Vorlauftemperatur - Messwert",
        "time": "2025-06-06T02:00:18+0200",
        "value": 27.529999
    }
}
d2c inject-uplink-message \
  --name 918575150422191 \
  --content-type "application/json" \
  --content-file content.json 
{
    "id": "68430056970a75320d2f7d59",
    "name": "98e6147f-17b7-4da6-bb4f-cb6df8b28b5f",
    "creationTime": "2025-06-06T14:51:02",
    "lastModificationTime": "2025-06-06T14:51:02",
    "content": {
        "topic": "443582399409764/1000001/up/AI/104",
        "payload": {
            "name": "MGB - HG1 - ASP01 - Heizsysteme - Heizwassererzeugung - 2.UG - Raum 0001 - Vorlauftemperatur - Messwert",
            "time": "2025-06-06T02:00:18+0200",
            "value": 27.529999
        }
    },
    "contentInfo": "application/json:0",
    "contentSize": 222,
    "contentType": "application/json",
    "contentEncoding": "none"
}


  • Description
  • Options
  • Global Options
  • Samples

With the command d2c inject-downlink-message you can post messages into device’s downlink message store of . You can use this command to send messages to the device.

d2c inject-downlink-message --name <string> | -n <string> | --id <string> | -i <string>
                           [--content <string> | -con <string>]
                           [--content-file <file> | -conf <file>]
                           [--content-type <mime-type> | -cont <mime-type>]
                           [--profile-file <file> | -p <file>]
                           [--origin <string> | -o <string>]
                           [--help | -h]
                           [--debug] 
                           [--info] 
                           [--outfile <filepath>] 
                           [--config-directory <directory>]
                           [--config-file <file>] 
--name <string>, -n <string>
The required --name option defines the unique identifier of the device to which the downlink message shall be injected. Alternatively you can use --id option instead of --name to identify the device.

--id <string>, -i <string>
The required --id option defines the unique identifier of the device. Alternatively you can use --name option instead of --id to identify the device.

--content <string>, -con <string>
The --content option defines content of the message which shall be posted to the downlink message store of the device.
Currently string and JSON content is supported.

--content-file <file>, -conf <file>
With the option --content-file you can let read the d2c inject-downlink-message command the message content from a file.

--content-type <mime-type>, -conf <mime-type>
To define the type of the content by a mime-type you can use the option --content-type.
Currently text/plain and application/json is supported. If the option is not defined it defaults to text/plain.
--profile-file <file>, -p <file>
DMO access profile file which shall be used instead of the current activated on in the d2c configuration.

--origin <string>, -o <string>
Each request to the DMO API requires the HTTP header field X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.

--help, -h
Displays the help for this command.

--info
Turn on info logging.

--debug
Turn on debug logging.

--outfile <file>
File into which the info or debug outputs shall be written additionaly.

--config-directory <directory>
Path to the directory within which the file config.json can be found. By default this directory is $HOME/.d2c.

--config-file <file>
Path to the configuration file. By default this path is $HOME/.d2c/config.json.

d2c inject-downlink-message \
  --name 916362817837104 \
  --content "00000F0DFD0936005900C8"
{
    "id": "685422a8e81f8c583a3a850b",
    "name": "54402039-0581-4522-9140-028b860be5c3",
    "creationTime": "2025-06-19T14:46:00",
    "lastModificationTime": "2025-06-19T14:46:00",
    "content": "00000F0DFD0936005900C8",
    "contentInfo": "text/plain:0",
    "contentSize": 22,
    "contentType": "text/plain",
    "contentEncoding": "none"
}

d2c inject-downlink-message 
  --name 916362817837104 \
  --content-type "application/json" \
  --content '{
    "sendRateSeconds":600
}'
{
    "id": "68542333e81f8c583a3a850d",
    "name": "3593db1f-6053-4aac-ba7d-80d738b2630b",
    "creationTime": "2025-06-19T14:48:19",
    "lastModificationTime": "2025-06-19T14:48:19",
    "content": {
        "sendRateSeconds": 600
    },
    "contentInfo": "application/json:0",
    "contentSize": 23,
    "contentType": "application/json",
    "contentEncoding": "none"
}

{
    "topic": "916362817837104/1000001/dn/AI/104",
    "payload": {
        "unit": "Celcius",
        "rate": 1800,
        "alarmThreshold": 32.0
    }
}
d2c inject-downlink-message \
  --name 916362817837104 \
  --content-type "application/json" \
  --content-file content.json 
{
    "id": "68542402e81f8c583a3a850f",
    "name": "0ce7466d-fcde-4dd2-99fa-6b920c223674",
    "creationTime": "2025-06-19T14:51:46",
    "lastModificationTime": "2025-06-19T14:51:46",
    "content": {
        "topic": "916362817837104/1000001/dn/AI/104",
        "payload": {
            "unit": "Celcius",
            "rate": 1800,
            "alarmThreshold": 32
        }
    },
    "contentInfo": "application/json:0",
    "contentSize": 106,
    "contentType": "application/json",
    "contentEncoding": "none"
}


get-device-messages

  • Description
  • Options
  • Global Options
  • Samples

With the command d2c get-device-messages you can query messages from one of the device’s message stores. Currently manages for each device the message stores for the following type of messages

Type of stored messagesDescription
uplink inbound messagesMessage which have been sent from the device to
downlink inbound messagesMessages which have been received from the application and shall be sent to the device
downlink outbound messagesMessages which have been sent to the device

d2c get-device-messages --name <string> | -n <string> | --id <string> | -i <string>
                        --message-store <message-store> | -ms <message-store>
                        [--message-name <string> | -mn <string>]
                        [--last | -la]
                        [--select <select fields> | -s <select fields>]
                        [--format <CSV | JSON> | -f <CSV | JSON>] 
                        [--separator-char <char> | -sc <char>]
                        [--limit <int> | -li <int>]
                        [--offset <int> | -os <int>]
                        [--profile-file <file> | -p <file>]
                        [--origin <string> | -o <string>]
                        [--help | -h]
                        [--debug] 
                        [--info] 
                        [--outfile <filepath>] 
                        [--config-directory <directory>]
                        [--config-file <file>] 

--name <string>, -n <string>
The required device identity can be defined by the device name with the option --name``. Alternatively you can also use the –id. </br> –id , -i The **required** device identity can be defined by the device id with the option–id``. Alternatively you can also use the --name.

--message-store <message-store>, -ms <message-store>
With the required option --message-store you can define the message store from which the messages shall be get. The following indicators are available:

Long indicatorShort indicatorDescription
uplink-inbounduliMessages which have been received from the device.
uplink-outbounduloMessages from the device which have been sent to the application. CURRENTLY NOT SUPPORTED
downlink-inbounddliMessages which have been received from the application and shall be sent to the device
downling-outbounddloMessages which have been received from the application and have been sent to the device

--message-name <string>, -mn <string>
To get only a single message an not a list of messages you can identify the message by its name with the --message-name option.

--last, -la
In case the --last option is defined only the last message is returned from the message store.

--select <select fields>, -s <select fields>
A comma seperated list of element names which shall be selected from the returned objects and written to stdout as CSV or JSON format. To control if the output is written in CSV or JSON format use the –format option. To understand which fields are available to select you can run d2c get-device-messages without –select option to see which fields are part of the queried messages.

--format <CSV | JSON>, -f <CSV | JSON>
With the –format option you can control in which format the queried objects shall be written to stdout. If you don’t define any select fields with –select option the default format is JSON. If you define select fields with –select option the default format is CSV.

--separator-char <char>
If the –select option is used the selected elements are written to the stdout as CSV. With –separator-char you can control which character shall be used to seperate the different fields from each other in the output. By default ; is used as separator character.

--limit <int>, -li <int>
To controll the number of resource objects in the result you can use the option –limit. With the –limit option in combination with the –offset option, you can implement a pagination process to walk through large amounts of resource objects.

--offset <int>, -offset <int>
With the –offset option you can define the index or offset of the first resource object in the response. Normally you use the –offset option together with the –limit option to implement a pagination process.

--profile-file <file>, -p <file>
DMO access profile file which shall be used instead of the current activated on in the d2c configuration.

--origin <string>, -o <string>
Each request to the DMO API requires the HTTP header field X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.

--help, -h
Displays the help for this command.

--info
Turn on info logging.

--debug
Turn on debug logging.

--outfile <file>
File into which the info or debug outputs shall be written additionaly.

--config-directory <directory>
Path to the directory within which the file config.json can be found. By default this directory is $HOME/.d2c.

--config-file <file>
Path to the configuration file. By default this path is $HOME/.d2c/config.json.

d2c get-device-messages --name 918575150422192 --message-store uplink-inbound
[
{
    "id": "6847f3ae970a75320d2f7dbf",
    "name": "04bfa5ba-1fa3-4820-930a-c10c88dcb7cb",
    "creationTime": "2025-06-10T08:58:22",
    "lastModificationTime": "2025-06-10T08:58:22",
    "content": "Halllo 29",
    "contentInfo": "text/plain:0",
    "contentSize": 9,
    "contentType": "text/plain",
    "contentEncoding": "none"
},
{
    "id": "6847f3af970a75320d2f7dc1",
    "name": "09517850-8437-4d33-a829-e98dc3b27619",
    "creationTime": "2025-06-10T08:58:23",
    "lastModificationTime": "2025-06-10T08:58:23",
    "content": "Halllo 31",
    "contentInfo": "text/plain:0",
    "contentSize": 9,
    "contentType": "text/plain",
    "contentEncoding": "none"
},
{
    "id": "6847f39f970a75320d2f7dad",
    "name": "0c06a32c-39b9-4638-9913-0c64bf9b5a44",
    "creationTime": "2025-06-10T08:58:07",
    "lastModificationTime": "2025-06-10T08:58:07",
    "content": "Halllo 9",
    "contentInfo": "text/plain:0",
    "contentSize": 8,
    "contentType": "text/plain",
    "contentEncoding": "none"
}
]

d2c get-device-messages --name 918575150422192 --message-store uplink-inbound --select "id,creationTime,content"

6847f3ae970a75320d2f7dbf;2025-06-10 08:58:22;Halllo 29 6847f3af970a75320d2f7dc1;2025-06-10 08:58:23;Halllo 31 6847f39f970a75320d2f7dad;2025-06-10 08:58:07;Halllo 9

d2c get-device-messages --name 918575150422192 --message-store uplink-inbound --select id | while read id ; do
    echo "Deleting $id ..."
    d2c dr -ri $id
done

d2c get-device-messages --name 918575150422192 --message-store uplink-inbound --last
{
    "id": "6847f3af970a75320d2f7dc1",
    "name": "09517850-8437-4d33-a829-e98dc3b27619",
    "creationTime": "2025-06-10T08:58:23",
    "lastModificationTime": "2025-06-10T08:58:23",
    "content": "Halllo 31",
    "contentInfo": "text/plain:0",
    "contentSize": 9,
    "contentType": "text/plain",
    "contentEncoding": "none"
}

d2c get-device-messages --name 918575150422192 --message-store uplink-inbound --message-name 0c06a32c-39b9-4638-9913-0c64bf9b5a44
{
    "id": "6847f39f970a75320d2f7dad",
    "name": "0c06a32c-39b9-4638-9913-0c64bf9b5a44",
    "creationTime": "2025-06-10T08:58:07",
    "lastModificationTime": "2025-06-10T08:58:07",
    "content": "Halllo 9",
    "contentInfo": "text/plain:0",
    "contentSize": 8,
    "contentType": "text/plain",
    "contentEncoding": "none"
}


delete-device-message

  • Description
  • Options
  • Global Options
  • Samples

With the command d2c delete-device-message you can delete single device messages from a device message store.

To identify the message you want to delete, you have two options:

  1. Identify the message by its id via the option --message-id.
  2. Identify the message by the device (option --name or --id), the message store (option --message-store) and the message name (option --message-name)

Currently manages for each device the message stores for the following type of messages

Type of stored messagesDescription
uplink inbound messagesMessage which have been sent from the device to
downlink inbound messagesMessages which have been received from the application and shall be sent to the device
downlink outbound messagesMessages which have been sent to the device

d2c delete-device-message --name <string> | -n <string> | --id <string> | -i <string>
                          --message-store <message-store> | -ms <message-store>
                          --message-name <string> | -mn <string>
                          --message-id <string> | -mi <string>
                         [--profile-file <file> | -p <file>]
                         [--origin <string> | -o <string>]
                         [--help | -h]
                         [--debug] 
                         [--info] 
                         [--outfile <filepath>] 
                         [--config-directory <directory>]
                         [--config-file <file>] 

--name <string>, -n <string>
To identify the message to delete by device, message store and message name you can use the option --name to identify the device to which the message belongs to. Alternatively you can also use the --id.

--id <string>, -i <string>
To identify the message to delete by device, message store and message name you can use the option --id to identify the device to which the message belongs to. Alternatively you can also use the --name.

--message-store <message-store>, -ms <message-store>
With the option --message-store you can define the message store from which the messages shall be deleted. The following indicators are available:

Long indicatorShort indicatorDescription
uplink-inbounduliMessages which have been received from the device.
uplink-outbounduloMessages from the device which have been sent to the application. CURRENTLY NOT SUPPORTED
downlink-inbounddliMessages which have been received from the application and shall be sent to the device
downling-outbounddloMessages which have been received from the application and have been sent to the device

--message-name <string>, -mn <string>
To define the name of the message to delete you can use the option --message-name.

--message-id <string>, -mi <string>
Instead of identifying the message to delete by device, message store and message name you can also identify the message only by using the --message-id option.

--profile-file <file>, -p <file>
DMO access profile file which shall be used instead of the current activated on in the d2c configuration.

--origin <string>, -o <string>
Each request to the DMO API requires the HTTP header field X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.

--help, -h
Displays the help for this command.

--info
Turn on info logging.

--debug
Turn on debug logging.

--outfile <file>
File into which the info or debug outputs shall be written additionaly.

--config-directory <directory>
Path to the directory within which the file config.json can be found. By default this directory is $HOME/.d2c.

--config-file <file>
Path to the configuration file. By default this path is $HOME/.d2c/config.json.

d2c delete-device-message --name 508037894436574 --message-store uplink-inbound --message-name f68dd604-5f5b-4eac-bfd2-f372e30a671c

d2c delete-device-message --message-id 684aba1f509e8ffe20f4af45

d2c get-device-messages --name 918575150422192 --message-store uplink-inbound --select id | while read id ; do
    echo "Deleting $id ..."
    d2c delete-device-message --message-id $id
done

Deleting 684aba2dd2a48861fe1a92e5 ... Deleting 684aba2c509e8ffe20f4af55 ... Deleting 684aba1c509e8ffe20f4af41 ... Deleting 684aba24509e8ffe20f4af49 ... Deleting 684aba0cd2a48861fe1a92b5 ... Deleting 684aba17d2a48861fe1a92c7 ... Deleting 684aba0d509e8ffe20f4af37 ... Deleting 684aba26509e8ffe20f4af4d ... Deleting 684aba11d2a48861fe1a92bd ... Deleting 684aba0ed2a48861fe1a92b9 ... Deleting 684aba13d2a48861fe1a92bf ... Deleting 684aba30509e8ffe20f4af5b ... Deleting 684aba27d2a48861fe1a92df ... Deleting 684aba29509e8ffe20f4af51 ...