espressif / esp-homekit-sdk

562 stars 105 forks source link

Lightbulb example not pairing on ESP8266 #40

Closed twlawrenceko closed 3 years ago

twlawrenceko commented 3 years ago

Hello all,

I have tried to flash lightbulb example onto esp-12f variant but pairing with Home app failed with the message Couldn't add Esp-Light. Below is the following serial monitor that showed during the pairing process.

######## Starting Pair Setup ########
Pair Setup M1 Received
Pair Setup M2 Successful
Pair Setup M3 Received
Using pair-setup without MFi.
Pair Setup M4 Successful
Pair Setup M5 Received
Pair Setup Successful for FB660B62-3EF5-4F48-9848-4321FDF7B8D5
Updated state number to 2
Re-announcing _hap._tcp mDNS service
Cleaning Pair Setup Context
Cleaning Pair Setup Context
######## Starting Pair Verify ########
Pair Verify M1 Received
Pair Verify M2 Successful
Pair Verify M3 Received
HomeKit Session active
Pair Verify Successful for FB660B62-3EF5-4F48-9848-4321FDF7B8D5
Decryption error/Connection lost. Marking session as invalid
HomeKit Session terminated
######## Starting Pair Verify ########
Pair Verify M1 Received
Pair Verify M2 Successful

I have got smart outlet example working, it seems like it somehow failed during the decryption error state.

Thank you.

shahpiyushv commented 3 years ago

@twlawrenceko , your issue may be similar to #4 , and the solution can be found here: https://github.com/espressif/esp-homekit-sdk/issues/4#issuecomment-712879446.

Basically, please search for the below config option in your sdkconfig file and change it from y to n.

CONFIG_NEWLIB_NANO_FORMAT=y

Let me know if it fixes the issue for you.

twlawrenceko commented 3 years ago

@shahpiyushv , Thank you, that solved the issue.

twlawrenceko commented 3 years ago

Once I click any button of the esp-light under the Home app, the esp8266 reboots itself, is this normal?

Here is the serial monitor:

Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC      : 0x4024b0e5  PS      : 0x00000030  A0      : 0x402494ac  A1      : 0x3fff7f80  
0x4024b0e5: pwm_get_duty at /home/esp/ESP8266_RTOS_SDK/components/esp8266/driver/pwm.c:209

0x402494ac: ledc_set_duty at /home/esp/ESP8266_RTOS_SDK/components/esp8266/driver/ledc.c:106 (discriminator 2)

A2      : 0x00000000  A3      : 0x401083b8  A4      : 0x00000000  A5      : 0x00000020  
A6      : 0x00000000  A7      : 0x000003e8  A8      : 0x4010a1a8  A9      : 0x00000090  
A10     : 0x00000018  A11     : 0x402d1b25  A12     : 0x00000000  A13     : 0x3ffeae40  
A14     : 0x000009c4  A15     : 0x00000000  SAR     : 0x00000004  EXCCAUSE: 0x0000001c  

Backtrace: 0x4024b0e5:0x3fff7f80 0x402494ac:0x3fff7fa0 0x402324dd:0x3fff7fc0 0x40232584:0x3fff7fd0 0x402325ac:0x3fff8010 0x4023266f:0x3fff8020 0x40232169:0x3fff8030 0x4024e4c9:0x3fff8060 0x4024f8bf:0x3fff8100 
0x4024b0e5: pwm_get_duty at /home/esp/ESP8266_RTOS_SDK/components/esp8266/driver/pwm.c:209

0x402494ac: ledc_set_duty at /home/esp/ESP8266_RTOS_SDK/components/esp8266/driver/ledc.c:106 (discriminator 2)

0x402324dd: lightbulb_set_aim at /home/esp/esp-homekit-sdk/projects/lightbulb/main/lightbulb.c:69

0x40232584: lightbulb_set_aim_hsv at /home/esp/esp-homekit-sdk/projects/lightbulb/main/lightbulb.c:149

0x402325ac: lightbulb_update at /home/esp/esp-homekit-sdk/projects/lightbulb/main/lightbulb.c:157

0x4023266f: lightbulb_set_on at /home/esp/esp-homekit-sdk/projects/lightbulb/main/lightbulb.c:236

0x40232169: lightbulb_write at /home/esp/esp-homekit-sdk/projects/lightbulb_v1/main/app_main.c:114 (discriminator 34)

0x4024e4c9: hap_http_handle_set_char at /home/esp/esp-homekit-sdk/components/homekit/esp_hap_core/src/esp_hap_ip_services.c:818

0x4024f8bf: hap_http_put_characteristics at /home/esp/esp-homekit-sdk/components/homekit/esp_hap_core/src/esp_hap_ip_services.c:925

??*?P*V??ET????T??K??u?U+UZ??UT??T
                                  ????ŪTQT?QQ??jPE*??u?????ZT?(E????Q?UEu?????*?B????B?u??E+??TT)UZV?RUEu????ŪQB???U?*?u???ZT?(UE????QRTT?j*QRTT???UUPRUB?u?
                                                  ?U?**P?+U?U??UU?
U???Ԫ?u?u?UZ??UE??UU?Q?U???Z?UX??i?UP?????UU?TU?U??TU*e?u????ԢJ??(U?j*
                                                                      UZ?)UX??UUU?TU?U??TJU???ZUTU?UT???
                                                                                                        ?UT?UU?TU?U??TE*?u?
                 UTU+UP???
                          ??UUU?TU?U??T?*?u?
                                            UT?Z?UU???UJU?TU?U??TU*?u?
                                                                      Q?????(*RUZ??UE??UU?Q+U???Z?
?T??(???????UP?????.?U?]UZJP?UV????UE??UU?QU???Z???RJ??????ի??kP????U??QQE?QQE?U?TU?U??T?TB?u?
                                                                                              ?
??P?????????????????Q?Q?QQQUQ?U?TU?U??T*U?u?
                                            ??++T????????????????Q
Q?Q?E?QQE?U?TU?U??T??B?u?
                         ??,ծժ
                              ????U)?????????Q
QQ?QQQQ?Q?U?TU?U??T?UB?u?
                         ??++???????]?E,P????Q??(QUQQQ??Q??UE??UU?Q???u?
                                                                        ?
]Z?J(?????]?E,P????Q?*?Q*(Q?Q?QQ?U?TU?U??T???u?
                                               ??UR?Z?Z?P?????????????Q?UEQQQUQ?U?TU?U??Tj??u?
                                                                                              ???Z??Z????UVj?kP???Q
Q?UUQQQ?Q?U?TU?U??T?U?u?
                        ?+??P?K????ZTT?UU?TU?U??T???u?
                                                      ??UR?ZU?VJ????V]?Q??UE??UU?QTUU-?UV???VU?ZQ
                                                                                                 ??T?Q(QETQ??T?QTUETQ?U??\??QQ?UJ?U(JU?????UUPR?U?լ??V???VU?Z?
                                                    ??T?Q(QJ?Ũ???QTUJ?E????qU??(J?UUUB?X??Uť??UUP?TU?լ??V???VU?ZU
       ??T?Q(Q??Q??T?Q???Q?U??\Q?)Q(U?Q?T??UE??UU?Q*U*U-?UV???VU?ZU
                                                                   ??T?Q(QU?T??T?QT?QQ????Q(QQQ(???B?T??UE??UU?Q?U*U-?UV???VU?Z?
                      ??T?Q(QU????T?QT?Q?????Q????BUUTU(u?UUU?TU?U??T??B?u?
                                                                           ?TJPXU몱T??????]UZJPqQQ??U?Keystore initialised
Accessory is Paired with atleast one controller
shahpiyushv commented 3 years ago

@twlawrenceko , the lightbulb example was primarily built for ESP32-Wrover-Kit and the driver part may not work as is on ESP8266, because of difference in the timer/ledc modules. You may have to refer the ledc example under ESP8266-RTOS-SDK and change the lightbulb.c file accordingly.