HomeACcessoryKid / ESP8266-HomeKit-Demo

User part of the ESP8266-HomeKit foundation
https://www.youtube.com/watch?v=Xnr-utWDIR8
Apache License 2.0
125 stars 27 forks source link

How do I add an MAC address to the device name? #21

Closed kostasoft closed 7 years ago

kostasoft commented 7 years ago

Hello! Sorry for the stupid question.

File: user_main.c Void: hkc_user_init

chas=addService( sers,++iid,APPLE,SWITCH_S); addCharacteristic(chas,aid,++iid,APPLE,NAME_C,"Switch",NULL);

How to add the MAC address so that it was "Switch_01020304"

HomeACcessoryKid commented 7 years ago

use a variation on this: `

char mac[6];
wifi_get_macaddr(STATION_IF, mac);
sprintf(myUsername,"%02X:%02X:%02X:%02X:%02X:%02X",mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);

`

HomeACcessoryKid commented 7 years ago

If you are happy about this answer, then please close the issue?

kostasoft commented 7 years ago

Sorry, thank you!