Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index Label in a Stateless programmable switch - buttons #434

Open
rubensx opened this issue Aug 10, 2022 · 1 comment
Open

Index Label in a Stateless programmable switch - buttons #434

rubensx opened this issue Aug 10, 2022 · 1 comment

Comments

@rubensx
Copy link

rubensx commented Aug 10, 2022

Hi Maxim! thanks for sharing your knowledge!

I have a strange result creating 8 stateless programmable buttons, my code:

homekit_accessory_t *accessories[] = {
 HOMEKIT_ACCESSORY(.id = 1, .category = homekit_accessory_category_switch, .services=(homekit_service_t*[]) {
      HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics=(homekit_characteristic_t*[]) {
        &name,
      HOMEKIT_CHARACTERISTIC(NAME, "Buttons_plate"),
                HOMEKIT_CHARACTERISTIC(MANUFACTURER, ACCESSORY_MANUFACTURER),
                &serial_number,
                HOMEKIT_CHARACTERISTIC(MODEL, "Buttons"),
                HOMEKIT_CHARACTERISTIC(FIRMWARE_REVISION, "1.0.1"),
                HOMEKIT_CHARACTERISTIC(IDENTIFY, button_identify),
      NULL
    }),
      HOMEKIT_SERVICE(STATELESS_PROGRAMMABLE_SWITCH, .primary=true, .characteristics=(homekit_characteristic_t*[]) {
      HOMEKIT_CHARACTERISTIC(NAME, "Button01"),
      &button01_switch_event1,
      NULL
    }),
      HOMEKIT_SERVICE(STATELESS_PROGRAMMABLE_SWITCH, .primary=false, .characteristics=(homekit_characteristic_t*[]) {
      HOMEKIT_CHARACTERISTIC(NAME, "Button02"),
      &button02_switch_event2,
      NULL
    }),          
      HOMEKIT_SERVICE(STATELESS_PROGRAMMABLE_SWITCH, .primary=false, .characteristics=(homekit_characteristic_t*[]) {
      HOMEKIT_CHARACTERISTIC(NAME, "Button03"),
      &button03_switch_event3,
      NULL
    }),    
      HOMEKIT_SERVICE(STATELESS_PROGRAMMABLE_SWITCH, .primary=false, .characteristics=(homekit_characteristic_t*[]) {
      HOMEKIT_CHARACTERISTIC(NAME, "Button04"),
      &button04_switch_event4,
      NULL
    }), 
      HOMEKIT_SERVICE(STATELESS_PROGRAMMABLE_SWITCH, .primary=false, .characteristics=(homekit_characteristic_t*[]) {
      HOMEKIT_CHARACTERISTIC(NAME, "Button05"),
      &button05_switch_event5,
      NULL
    }),     
      HOMEKIT_SERVICE(STATELESS_PROGRAMMABLE_SWITCH, .primary=true, .characteristics=(homekit_characteristic_t*[]) {
      HOMEKIT_CHARACTERISTIC(NAME, "Button06"),
      &button06_switch_event6,
      NULL
    }),  
      HOMEKIT_SERVICE(STATELESS_PROGRAMMABLE_SWITCH, .primary=false, .characteristics=(homekit_characteristic_t*[]) {
      HOMEKIT_CHARACTERISTIC(NAME, "Button07"),
      &button07_switch_event7,
      NULL
    }),      
      HOMEKIT_SERVICE(STATELESS_PROGRAMMABLE_SWITCH, .primary=false, .characteristics=(homekit_characteristic_t*[]) {
      HOMEKIT_CHARACTERISTIC(NAME, "Button08"),
      &button08_switch_event8,
      NULL
    }),  
    NULL
  }),
  NULL
 };


In this example, 8 buttos in the same id (because I've got some switches in the scketch after this). All light number an order are ok but I can't make the buttons order in hight place on iOS.

Example "button01" has

Single Click
Double Click
Long Press

In each category you can make a "scene" or automation shortcut, but when I get on the "single click" in "button01" sometimes I see the single click for button04 or other button in ramdom position (weird).

In my google search an others I found a characteristc who I never see a sketch...

"Linking Stateless Programmable Switch with a Service Label"
somenting about "Service Label Index" to order these buttons when iOS populate on the screen

Someone can help me to create or explain to me how this work??

maybe a:

homekit_characteristic_t label = HOMEKIT_CHARACTERISTIC_(SERVICE_LABEL_INDEX, LABEL_INDEX);

??

@renandw
Copy link

renandw commented Aug 19, 2022

Have you checked the pins you are using?
Are you using ESP8266 or ESP32?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants