Getting device ID in mos.yml?

I want to enter my device ID as a variable in mos.yml, to automatically link the correct certificate files and device id for Azure.

I hoped there was a system variable availible for that, like “${mos.version}” is used, but I can’t find any references to those variables in the documentation.

Does a variable like that exist to get the device ID? if not- how would I go about linking my cert files and device id programatically in the mos.yml file?

@Stijn
By default mongoose OS adds device ID, to print what is your device ID you can do this:
printf("Device ID: %s\n", mgos_sys_config_get_device_id());

another method of knowing your device ID is do mos config-get from mos tool.

mgos_sys_config_get_device_id() this type of function call is called as getters in mongoose os

if you want set your own custom ID to your device in your mos.yml file under config schema add this below line of code:
- ["device.id", "custom_device_1"]

after adding above line of code your device ID must change to custom_device_1

And is there a way to get the default device ID within the mos.yml? I require this for my azure authentication and if I were to hardcode it in the mos.yml it wouldnt work for multiple devices.

Read my above reply line by line this will work for all the devices but each and every device you must hardcode device ID in mos.yml file under config-schema.

The only thing I’ve seen that might be able to do it for you is the _?????? that is used for device name. But then I’ve only ever used this in conf files. Have you thought about setting it in conf.json instead of mos.yml?

I asked a question a few days ago about this actually, maybe you could look in the code to see if it could work for you.