How can I get the mac address of the device

Is there a way to receive the full mac-address of the device which is partly used in the device id?
I would need the whole mac so splitting device.id is not an option. device.mac exists but this seems to be some user/custom setting which is always empty.

EDIT: I just noticed that setting the device.id via code only changes it for anything after that (of course). But how can I change the device.id earlier and not using the mos.yml. I have to flash multiple devices and I want them to change this id dynamically and not manually by me. Is there a way?

device_get_mac_address

and is there also a way to receive it in JS?

There is a set of docs for Mongoose-OS.
Those docs explain how to call functions from JS
Examples show how to call C functions from JS
All functions are equal (though some are more equal than others)

You know what would have really helped here? Maybe a link to that docs? Because obviously I am unable to find them then.
I would also suggest you to revise your docs, make them more clear and structured and fill them with common topics which are asked here. It is quite hard to find anything usefull in there. I always end up digging through code of your repos which takes lots of time.

Hi @scaprile,

@Informaticore and I are trying to find a solution. This is what we have at the moment, looking at the documentation, but the output is empty:

let mac_address = ffi('void device_get_mac_address(int)');
let mac;
mac_address(mac);
print("MAC Address: " + mac);

We assume, that this is, because the function device_get_mac_address(uint8_t mac[6]) expects an array, but we are not able to hand this into the function.

Do we need to incorporate mgos_expand_mac_address_placeholders?

Thanks for your support, this would help us a lot!

Regards,

We just found a solution with this code:

let mac_address = ffi('void mgos_expand_mac_address_placeholders(char *)');
let mac = "??:??:??:??:??:??";
mac_address(mac);
print("MAC Address: " + mac);

Is this the preferred way to get the mac address or is there an easier solution?