maximkulkin / esp32-homekit-camera

Firmware for esp32-camera module to act as Apple Homekit IP camera
MIT License
395 stars 79 forks source link

Request: Generated custom name and serial number #14

Closed Korcsog closed 5 years ago

Korcsog commented 5 years ago

Hi!

Is it possible to implement the custom mac address based Name and serial number generation?

void create_accessory_name() {
    //printf("RC > Creating accessory name\n");

    uint8_t macaddr[6];
    **system_efuse_read_mac(macaddr);**

    char *name_value = malloc(17);
    snprintf(name_value, 17, "Camera-%02X%02X%02X", macaddr[3], macaddr[4], macaddr[5]);
    name.value = HOMEKIT_STRING(name_value);

    char *serial_value = malloc(13);
    snprintf(serial_value, 13, "%02X%02X%02X%02X%02X%02X", macaddr[0], macaddr[1], macaddr[2], macaddr[3], macaddr[4], macaddr[5]);
    serial.value = HOMEKIT_STRING(serial_value);
}

Also is system_efuse_read_mac() enough for this purpose? Or Wifi mac needed?

Thanks!

Korcsog commented 5 years ago

Tried it, works well so I close this!