# Sending multiple configuration to a device

**URL:** <https://community.cumulocity.com/t/sending-multiple-configuration-to-a-device/1200>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [March 27, 2023, 2:33pm UTC](https://community.cumulocity.com/t/sending-multiple-configuration-to-a-device/1200 "2023-03-27T14:33:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Melanie\_Monnereau](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Melanie\_Monnereau](https://community.cumulocity.com/u/Melanie_Monnereau)\
**Post date:** [March 27, 2023, 2:33pm UTC](https://community.cumulocity.com/t/sending-multiple-configuration-to-a-device/1200/1 "2023-03-27T14:33:43Z")

</div>

Hi

A customer has about 60 different possible configurations types for a device type and he wants to be able to update those configs on ad-hoc basis.  
I was looking at our documentation and thought that potentially the best options would be to

1. Define a new config snapshot and the configuration file would contain all the possible configs.

2. Or use or c8y\_DownloadConfigFile property which seems to allow sending a file to the device

However, I am facing several issues.

With number 1, once I have configured my config snapshot, I cannot find a way to find this config in the Configuration of my device; so basically how do you send an Operation using a defined config snapshot ? (with possibility to edit the config)

With number 2, I added the below to my device:

```auto
"c8y_SupportedOperations": [
        {
            "c8y_SupportedConfigurations": [
                "agent_conf"
            ]
        },
        {
            "c8y_DownloadConfigFile": {
                "type": "agent_conf",
                "url": "https://demos.cumulocity.com/inventory/binaries/156719"
            }
        }
    ],

```

However, I still dont have the option to send the file to the device in the Configuration tab. I actually don’t even have the typed file-based configurations Tab.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/b/c/bcf0e4373a6974ba13da795978868372ac06f0bf.png)

Any hints would be welcome 🙂  
thanks

---

<div class="post-metadata">

**Author:** ![Philipp\_Emmel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/philipp_emmel/32/19455_2.png) [@Philipp\_Emmel](https://community.cumulocity.com/u/Philipp_Emmel)\
**Post date:** [March 27, 2023, 3:00pm UTC](https://community.cumulocity.com/t/sending-multiple-configuration-to-a-device/1200/2 "2023-03-27T15:00:31Z")

</div>

We have three different ways to implement configuration for devices: Text based, legacy file based, and typed file based. For a use case with more than one configuration type in a device only the last one will work as it allows management of separate configuration files based on a type. You can find details about how all of these should be implemented on a device here: [[Device management library - Cumulocity IoT Guides](https://cumulocity.com/guides/reference/device-management-library/#configuration)](Device management library - configuration).

In your specific case problem number 1 seems to be caused by incorrect or incomplete declarations in the device managed object. Please ensure that the fragments `c8y_SupportedConfigurations` `c8y_SupportedOperations` are entered as documented and respective fragments for the configuration type in the format `c8y_Configuration_<config type>` are added.

Regarding problem number 2: Please remember that `c8y_SupportedOperations` is defined as an array of strings. Please only add the operation fragment type strings there. The `c8y_SupportedConfigurations` belongs on the top level, not nested in something else.

---

<div class="post-metadata">

**Author:** ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)\
**Post date:** [March 27, 2023, 3:16pm UTC](https://community.cumulocity.com/t/sending-multiple-configuration-to-a-device/1200/3 "2023-03-27T15:16:13Z")

</div>

Hi @Melanie_Monnereau ,

in addition to Philipps answer you can find an example implementation here:

> <https://github.com/Cumulocity-IoT/cumulocity-devicemanagement-agent/blob/main/c8ydm/agentmodules/configfile_upload_handler.py>

> <https://github.com/Cumulocity-IoT/cumulocity-devicemanagement-agent/blob/main/c8ydm/agentmodules/configfile_download_handler.py>

`c8y_SupportedConfigurations` must be an fragment on root level, same as `c8y_SupportedOperations`

It should look like this when everything is properly configured:

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/2/4/244af8ab7669a8a9621b4f4c3801922ae499dbf3.png)

In parallel the text-based configuration is used, that’s the reason you see two tabs. This can be achieved by setting the c8y\_Configuration fragment on root level:  
So you can use file-based (type) and text-based configuration in parallel if the agent supports that.

---

<div class="post-metadata">

**Author:** ![Melanie\_Monnereau](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Melanie\_Monnereau](https://community.cumulocity.com/u/Melanie_Monnereau)\
**Post date:** [March 27, 2023, 3:38pm UTC](https://community.cumulocity.com/t/sending-multiple-configuration-to-a-device/1200/4 "2023-03-27T15:38:11Z")

</div>

Thanks for the details  
So i have changed my MO to the below fragments

```auto
"c8y_DownloadConfigFile": {
        "type": "test_config",
        "url": "https://mel-development.eu-latest.cumulocity.com/inventory/binaries/24179116"
    },
    "c8y_SupportedOperations": [
        "test_config"
    ],
    "c8y_SupportedConfigurations": [
        "test_config"
    ],

```

I can now see the Configurations menu. However, I still do not have the button to send the configuration to the device (my url binaries is correct). I thought by adding the c8y\_DownloadConfigFile I would be able to see the button?

Also, it now offers me the 2 configurations snapshot i created for my device type. But it seems i cannot update the values of the configurations before sending them? (maybe that s because i dont have a send button)

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/6/8/687036e1f696a29e2211b46e78704e6a3e9c61cb.png)

---

<div class="post-metadata">

**Author:** ![Philipp\_Emmel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/philipp_emmel/32/19455_2.png) [@Philipp\_Emmel](https://community.cumulocity.com/u/Philipp_Emmel)\
**Post date:** [March 27, 2023, 5:20pm UTC](https://community.cumulocity.com/t/sending-multiple-configuration-to-a-device/1200/5 "2023-03-27T17:20:49Z")

</div>

The `c8y_SupportedOperations` fragment should contain the fragment types of all supported operations. The configuration type is not relevant here those belong in the `c8y_SupportedConfigurations` fragment. The two operations relevant for typed file based configuration are `c8y_UploadConfigFile` ([Device management library - Cumulocity IoT Guides](https://cumulocity.com/guides/reference/device-management-library/#upload-current-configuration-file)) for devices to upload their current configuration status to the platform and `c8y_DownloadConfigFile` ([Device management library - Cumulocity IoT Guides](https://cumulocity.com/guides/reference/device-management-library/#install-configuration-file)) for devices to download a configuration from the platform and install it. Note that these are named from a device perspective. In the UI the `c8y_DownloadConfigFile` operation enables the upload to device button and the `c8y_DownloadConfigFile` operation enables the download from device button. Your `c8y_SupportedOperations` fragment should look like this:

```auto
{
    "c8y_SupportedOperations": [
        "c8y_DownloadConfigFile", 
        "c8y_UploadConfigFile"
    ]
}

```

You can find the details about the `c8y_SupportedOperations` fragment here: [Device management library - Cumulocity IoT Guides](https://cumulocity.com/guides/reference/device-management-library/#announcing-capabilities).

For typed file-based configuration the `c8y_DownloadConfigFile` is not relevant in the device’s managed object. There is the `c8y_Configuration_<config type>` fragment which a device should set when it has downloaded and installed a configuration file. It contains information when and from where a config file was installed. See here for details: [Device management library - Cumulocity IoT Guides](https://cumulocity.com/guides/reference/device-management-library/#install-configuration-file). If you are interested in previewing the installed configuration then the device must create an event and attach the configuration file as event binary as described here: [Device management library - Cumulocity IoT Guides](https://cumulocity.com/guides/reference/device-management-library/#upload-current-configuration-file)

We do not offer any way to edit these files in our UI. Editing configuration files must be done externally (e.g. with a text editing program locally on your computer) before the configuration file is uploaded to the platform.

---

<div class="post-metadata">

**Author:** ![Melanie\_Monnereau](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Melanie\_Monnereau](https://community.cumulocity.com/u/Melanie_Monnereau)\
**Post date:** [March 28, 2023, 9:00am UTC](https://community.cumulocity.com/t/sending-multiple-configuration-to-a-device/1200/6 "2023-03-28T09:00:13Z")

</div>

Ok so in my case I dont want a device to send a configuration file to the platform. I only want for the platform to upload a config file to the device.  
So basically I m only interested into the `c8y_DownloadConfigFile`  
I was expecting for the user to:

- define a configuration with multiple param and values
- create an operation to send those configs to the device
- for the device to update its config with the newest values and set to SUCCESSFUL

If I try to only use `c8y_DownloadConfigFile` then I dont have the button to send the config to the devices. I believe, this is because the platform expects for the configuration file to be sent by the `c8y_UploadConfigFile` first.  
For example, here,

```auto
     "c8y_SupportedConfigurations": [
       "agent_conf"
   ],

   "c8y_DownloadConfigFile": {
       "type": "agent_conf",
       "url": "https://mel-development.eu-latest.cumulocity.com/inventory/binaries/24179116"
         },
	"c8y_SupportedOperations": [
        "c8y_DownloadConfigFile"
    ]

```

While my binary exist at the specified url, the UI does not offer me to send this config file to the device.  
I believe i would need to add the `c8y_UploadConfigFile` , and then for the device to send the agent\_conf file via an event with binaries; is that correct? If this is the case, I do not understand why we need to have a fragment url in `c8y_DownloadConfigFile` if this url is actually not being used?

Coming back to your last comment; is not the point of offering a configuration menu in our UI is to allow for a user to change those configurations? If we cannot edit the configurations in the UI, then he must always do it locally in another program which does not seem very user friendly. Does it also mean the user needs to have a role giving him access to the file repository menu in the Admin app?

.

---

<div class="post-metadata">

**Author:** ![Philipp\_Emmel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/philipp_emmel/32/19455_2.png) [@Philipp\_Emmel](https://community.cumulocity.com/u/Philipp_Emmel)\
**Post date:** [March 28, 2023, 12:25pm UTC](https://community.cumulocity.com/t/sending-multiple-configuration-to-a-device/1200/7 "2023-03-28T12:25:47Z")

</div>

I’m sorry but I don’t understand the issue here fully so I tested the functionality like this:  
first I created this managed object:

```auto
{
    "name": "config test",
    "type": "test",
    "com_cumulocity_model_Agent": {},
    "c8y_IsDevice": {},
    "c8y_SupportedOperations": [
        "c8y_DownloadConfigFile"
    ],
    "c8y_SupportedConfigurations": [
        "test1",
        "test2"
    ]
}

```

Then I created a configuration in configuration repository of type “test1” corresponding with one of the supported configuration types on my device like this:

 ![Bildschirmfoto 2023-03-28 um 13.05.08](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/7/8/78c04afa4120ee9a22c28ce0ac18a8bf6c478458.png)

Then when I navigate to my device and I select the “test1” configuration type I see the button to upload this configuration to my device offered here:

 ![Bildschirmfoto 2023-03-28 um 13.08.34](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/b/e/be026ced50dbbea09b94c8fe4ec5e2f05416b4a1.png)

As far as I understood this is what you want achieve.

A few additional comments:  
As I wrote earlier: The `c8y_DownloadConfigFile` fragment in a managed object is not relevant for typed file-based configuration. `c8y_DownloadConfigFile` is the fragment type of the OPERATION to install a configuration. A device can announce its capability to handle such operations by including it in its `c8y_SupportedOperations` fragment. The `c8y_DownloadConfigFile` fragment in the device managed object is only relevant for legacy file-based configuration. There it is used for devices to communicate their current status of installed configuration to the platform. For typed file-based configuration this is handled with the `c8y_Configuration_<config type>` fragment I also mentioned in an earlier post.

The point of the configuration functionality is to monitor and manage configuration installed on devices. Editing or creating the file content in our UI is not intended. In fact devices are often quite particular about the format of such files. Devices may require specific encoding, specific line or file delimiters, or even specific spacing. This often goes beyond any standards for typical configuration files and thus becomes unmanageable for us in a generic way. Configuration files are created much more conveniently in device specific tooling. Users that want to upload configuration files to the platform must of course have the respective permissions to create the necessary binaries.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [September 24, 2023, 12:26pm UTC](https://community.cumulocity.com/t/sending-multiple-configuration-to-a-device/1200/8 "2023-09-24T12:26:23Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
