esp-homekit icon indicating copy to clipboard operation
esp-homekit copied to clipboard

I can't name the switch with different name in same accessory

Open xd94402002 opened this issue 9 months ago • 2 comments

This is part of my accessory code

homekit_characteristic_t cha_auto_change_on = HOMEKIT_CHARACTERISTIC_(ON, true);
homekit_characteristic_t cha_auto_change_on_name = HOMEKIT_CHARACTERISTIC_(NAME, "Auto change");

homekit_characteristic_t all_swing = HOMEKIT_CHARACTERISTIC_(ON, true);
homekit_characteristic_t all_swing_name = HOMEKIT_CHARACTERISTIC_(NAME, "SWING");

homekit_characteristic_t function_name = HOMEKIT_CHARACTERISTIC_(NAME, "Function");

//=============================

HOMEKIT_ACCESSORY(.id=8, .category=homekit_accessory_category_switch, .services=(homekit_service_t*[]) {
    HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics=(homekit_characteristic_t*[]) {	
        HOMEKIT_CHARACTERISTIC(IDENTIFY, my_accessory_identify), 
        &function_name, 
        NULL 
    }),
    HOMEKIT_SERVICE(SWITCH, .primary=true, .characteristics=(homekit_characteristic_t*[]) { 
        &cha_auto_change_on, 
        &cha_auto_change_on_name, 
        NULL
    }),
    HOMEKIT_SERVICE(SWITCH, .primary=false, .characteristics=(homekit_characteristic_t*[]) { 
        &all_swing, 
        &all_swing_name, 
        NULL 
    }),
    NULL
});

IMG_8100

If I don't finish the whole setup it will show as the picture above. Going throw all the pairing process the SWITCH will name at SWITCH1 and SWITCH2 I always get the same result and I can't figure why. sometimes the name predefine will show as recommend in gray word if I delete the default name.

xd94402002 avatar May 07 '24 18:05 xd94402002