Yurik72 / ESPHap

ESP32/ESP8266 Arduino library for native Apple Homekit Accessory Protocol (HAP)
MIT License
264 stars 60 forks source link

NAME characteristics showing on IOS just at time of pairing and then ESP name #132

Closed simkard69 closed 9 months ago

simkard69 commented 1 year ago

Hello,

Seems like something is acting weird in IOS as I successfully define the NAME of my services using this line :

SERVICE1 =  hap_add_hvac_service("SERVICE_NAME_1", CALLBACK_FUNCTION, 0);
SERVICE2 =  hap_add_hvac_service("SERVICE_NAME_2", CALLBACK_FUNCTION, 0);
SERVICE3 =  hap_add_hvac_service("SERVICE_NAME_3", CALLBACK_FUNCTION, 0);
SERVICE4 =  hap_add_hvac_service("SERVICE_NAME_4", CALLBACK_FUNCTION, 0);

Fact is that, at time of pairing in IOS, I can see the names given to my services but then, when I enter the paired accessory containing all the services, I just see my ESP32 hostname.

Any idea of what is going on here ? Do I need to define a new characteristic on each of the services ? Logically it should be OK as long as it is defined using this line on each service in homeintegration.c : NEW_HOMEKIT_CHARACTERISTIC(NAME, szname)

simkard69 commented 9 months ago

Someone already got it working by modifying "homeintegration.c" file >>> #124

homekit_service_t* hap_new_homekit_accessory_service(const char *szname,const char * szserialnumber){
    return NEW_HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics=(homekit_characteristic_t*[]) {
                NEW_HOMEKIT_CHARACTERISTIC(NAME, sz_acc_name),   // TO BE REMOVED
                NEW_HOMEKIT_CHARACTERISTIC(NAME, szname),        // TO BE ADDED
                NEW_HOMEKIT_CHARACTERISTIC(MANUFACTURER, sz_acc_manufacturer),
                NEW_HOMEKIT_CHARACTERISTIC(SERIAL_NUMBER, szserialnumber),
                NEW_HOMEKIT_CHARACTERISTIC(MODEL, sz_acc_models),
simkard69 commented 9 months ago

SOLVED as per last comment