Using the mac addres as part of a config field

Hello and thank you for your time, I am using a esp32 and the device id is automaticity set to esp32_66FC10 which is the last six characters of the MAC address.

I would like to be able to set this as part of some custom fields in mos.yml.
Something like - [“device.batterytopic”, “/home/doorsensor_66FC10”]

This this possible?

Thanks again
Tony

Example here

I also would like to know how to do it in mos.yml.
What I did in this example was using Cfg.get() and Cfg.set() in JS to write them on first boot:

let client_id = Cfg.get('device.id');
let thing_id = tolowercase(client_id.slice(client_id.length-6, client_id.length));
let base_topic = 'homie/ohsb' + thing_id;
let state_topic = base_topic + '/$state';
[...]
// homie-required last will
if(Cfg.get('mqtt.will_topic') !== state_topic) {
	Cfg.set({mqtt: {will_topic: state_topic}});
	Cfg.set({mqtt: {will_message: 'lost'}});
	Cfg.set({mqtt: {client_id: client_id}});
	Log.print(Log.INFO, 'MQTT last will has been updated');
};
 - ["my_config", "s", "my_config_????????", {}]
char *my_config = strdup(mgos_sys_config_get_my_config());
mgos_expand_mac_address_placeholders(my_config);
mgos_sys_config_set_my_config(my_config);
free(my_config);
1 Like

Thank you for the help