Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

What does mgos_sys_config_get_device_id() do?

I am looking for a way to serialize products using numbers that are embedded in the ESP-32 IC. I know I can use the MAC Address for this purpose, however it seems like overkill. This function works, and seems to return a unique number, however I can't find any information on the meaning of the number returned. Anybody have any experience with this?

Thanks,

JSW

Comments

  • Example code for the default settings:

      struct mg_str mac = mg_mk_str(mgos_sys_ro_vars_get_mac_address());
      LOG(LL_INFO, ("mgos_sys_config_get_device_id: %s (mac: %.*s)",
                    mgos_sys_config_get_device_id(), mac.len, mac.p));
    

    Output:

    mgos_sys_config_get_device_id: esp32_8F21B8 (mac: 30AEA48F21B8)
    

    The part after esp32_ represents the lowest 3 bytes of the mac address.
    AFAIK, you can override device.id

    ["device.id", "s", {title: "Device ID"}],  # Note: Each arch defines a default
    

    in your mos.yml

    Thanked by 2Sergey jstevewood
  • Hi nliviu,

    Thanks for your help. We will use this.

    JSW

Sign In or Register to comment.