mmakaay / esphome-xiaomi_bslamp2

ESPHome integration for the Xiaomi Mijia Bedside Lamp v2.
Other
204 stars 49 forks source link

[BUG] Device can't connect to WPA2 / WPA3 in mixed mode WiFi network #98

Closed sandervankasteel closed 1 year ago

sandervankasteel commented 1 year ago

Describe the bug My Xiaomi Bedside lamps 2's are unable to connect to my WiFi network that is running in WPA2-PSK/WPA3-SAE Mixed mode. It keeps on reporting No matching network found and then reboots.

Logs ``` [21:42:00]ets Jun 8 2016 00:22:57 [21:42:00] [21:42:00]rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT) [21:42:00]configsip: 0, SPIWP:0xee [21:42:00]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 [21:42:00]mode:DIO, clock div:2 [21:42:00]load:0x3fff0018,len:4 [21:42:00]load:0x3fff001c,len:1044 [21:42:00]load:0x40078000,len:8896 [21:42:00]load:0x40080400,len:5828 [21:42:00]entry 0x400806ac [21:42:00]I (318) cpu_start: Pro cpu up. [21:42:00]I (318) cpu_start: Single core mode [21:42:00]I (327) cpu_start: Pro cpu start user code [21:42:00]I (327) cpu_start: cpu freq: 160000000 [21:42:00]I (327) cpu_start: Application information: [21:42:00]I (331) cpu_start: Project name: bedsidelamp-r [21:42:00]I (337) cpu_start: App version: 2022.6.2 [21:42:00]I (342) cpu_start: Compile time: Nov 16 2022 20:39:14 [21:42:01]I (348) cpu_start: ELF file SHA256: ddfc27e4e7d2b62c... [21:42:01]I (354) cpu_start: ESP-IDF: 4.3.2 [21:42:01]I (359) heap_init: Initializing. RAM available for dynamic allocation: [21:42:01]I (366) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM [21:42:01]I (372) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM [21:42:01]I (378) heap_init: At 3FFB7D48 len 000282B8 (160 KiB): DRAM [21:42:01]I (384) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM [21:42:01]I (391) heap_init: At 40078000 len 00008000 (32 KiB): IRAM [21:42:01]I (397) heap_init: At 40094488 len 0000BB78 (46 KiB): IRAM [21:42:01]I (404) spi_flash: detected chip: generic [21:42:01]I (408) spi_flash: flash io: dio [21:42:01]I (413) cpu_[W][esp-idf:000]: I (446) gpio: GPIO[19]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0 [21:42:01] [21:42:01][W][esp-idf:000]: I (447) gpio: GPIO[21]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0 [21:42:01] [21:42:01][W][esp-idf:000]: I (478) gpio: GPIO[33]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 [21:42:01] [21:42:01][W][esp-idf:000]: I (479) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 [21:42:01] [21:42:01][W][esp-idf:000]: I (481) gpio: GPIO[16]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 [21:42:01] [21:42:01][W][esp-idf:000]: I (494) wifi: [21:42:01][W][esp-idf:000]: wifi driver task: 3ffc2b64, prio:23, stack:6656, core=0 [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (512) wifi: [21:42:01][W][esp-idf:000]: wifi firmware version: eb52264 [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (520) wifi: [21:42:01][W][esp-idf:000]: wifi certification version: v7.0 [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (530) wifi: [21:42:01][W][esp-idf:000]: config NVS flash: enabled [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (540) wifi: [21:42:01][W][esp-idf:000]: config nano formating: disabled [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (551) wifi: [21:42:01][W][esp-idf:000]: Init data frame dynamic rx buffer num: 32 [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (571) wifi: [21:42:01][W][esp-idf:000]: Init management frame dynamic rx buffer num: 32 [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (581) wifi: [21:42:01][W][esp-idf:000]: Init management short buffer num: 32 [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (591) wifi: [21:42:01][W][esp-idf:000]: Init dynamic tx buffer num: 32 [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (602) wifi: [21:42:01][W][esp-idf:000]: Init static rx buffer size: 1600 [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (612) wifi: [21:42:01][W][esp-idf:000]: Init static rx buffer num: 10 [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (622) wifi: [21:42:01][W][esp-idf:000]: Init dynamic rx buffer num: 32 [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (633) wifi_init: rx ba win: 6 [21:42:01] [21:42:01][W][esp-idf:000]: I (642) wifi_init: tcpip mbox: 32 [21:42:01] [21:42:01][W][esp-idf:000]: I (643) wifi_init: udp mbox: 6 [21:42:01] [21:42:01][W][esp-idf:000]: I (653) wifi_init: tcp mbox: 6 [21:42:01] [21:42:01][W][esp-idf:000]: I (653) wifi_init: tcp tx win: 5744 [21:42:01] [21:42:01][W][esp-idf:000]: I (663) wifi_init: tcp rx win: 5744 [21:42:01] [21:42:01][W][esp-idf:000]: I (673) wifi_init: tcp mss: 1440 [21:42:01] [21:42:01][W][esp-idf:000]: I (673) wifi_init: WiFi IRAM OP enabled [21:42:01] [21:42:01][W][esp-idf:000]: I (683) wifi_init: WiFi RX IRAM OP enabled [21:42:01] [21:42:01][W][esp-idf:000]: I (695) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07 [21:42:01] [21:42:01][W][esp-idf:000]: I (843) wifi: [21:42:01][W][esp-idf:000]: mode : sta (5c:e5:0c:39:30:f0) [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (845) wifi: [21:42:01][W][esp-idf:000]: enable tsf [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (849) wifi: [21:42:01][W][esp-idf:000]: Set ps type: 1 [21:42:01] [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:01][W][esp-idf:000]: I (862) wifi: [21:42:01][W][esp-idf:000]: Set ps type: 1 [21:42:01] [21:42:01][W][esp-idf:000]: [21:42:01] [21:42:04][W][wifi:455]: No matching network found! [21:42:12][W][wifi:455]: No matching network found! [21:42:20][W][wifi:455]: No matching network found! [21:42:28][W][wifi:455]: No matching network found! [21:42:36][W][wifi:455]: No matching network found! [21:42:44][W][wifi:455]: No matching network found! [21:42:52][W][wifi:455]: No matching network found! [21:42:52][W][wifi:585]: Restarting WiFi adapter... [21:42:52][W][esp-idf:000]: I (51565) wifi: [21:42:52][W][esp-idf:000]: flush txq [21:42:52][W][esp-idf:000]: [21:42:52] [21:42:52][W][esp-idf:000]: I (51566) wifi: [21:42:52][W][esp-idf:000]: stop sw txq [21:42:52][W][esp-idf:000]: [21:42:52] [21:42:52][W][esp-idf:000]: I (51568) wifi: [21:42:52][W][esp-idf:000]: lmac stop hw txq [21:42:52][W][esp-idf:000]: [21:42:52] [21:42:57][W][esp-idf:000]: I (56681) wifi: [21:42:57][W][esp-idf:000]: mode : sta (5c:e5:0c:39:30:f0) [21:42:57][W][esp-idf:000]: [21:42:57] [21:42:57][W][esp-idf:000]: I (56682) wifi: [21:42:57][W][esp-idf:000]: enable tsf [21:42:57][W][esp-idf:000]: [21:42:57] [21:42:57][W][esp-idf:000]: I (56688) wifi: [21:42:57][W][esp-idf:000]: Set ps type: 1 [21:42:57] [21:42:57][W][esp-idf:000]: [21:42:57] [21:43:00][W][wifi:455]: No matching network found! [21:43:08][W][wifi:455]: No matching network found! [21:43:16][W][wifi:455]: No matching network found! [21:43:24][W][wifi:455]: No matching network found! [21:43:32][W][wifi:455]: No matching network found! [21:43:39][W][wifi:455]: No matching network found! [21:43:47][W][wifi:455]: No matching network found! ```
My device YAML ``` # -------------------------------------------------------------------------- # Substitutions # # These are substitutions as used by the configuration packages from below. # You can uncomment and update the ones that you want to modify. # -------------------------------------------------------------------------- substitutions: name: bedsidelamp-r friendly_name: Bedside Lamp R #light_name: ${friendly_name} RGBWW Light #light_mode_text_sensor_name: ${friendly_name} Light Mode #default_transition_length: 800ms # -------------------------------------------------------------------------- # Load configuration packages # # These provide a convenient way to compose your device configuration from # some functional building blocks. Pick and mix the blocks that you need. # # For customization you can override options in your config or you can # copy the contents of these packages directly in your config file as # an example for your own customizations. # # Available packages are: # - core.yaml : core components & hardware setup # - behavior_default.yaml : default device behavior # - ota_feedback.yaml : enable visual feedback during OTA updates # - activate_preset_svc.yaml : 'activate_preset' service for Home Assistant # -------------------------------------------------------------------------- packages: bslamp2: url: https://github.com/mmakaay/esphome-xiaomi_bslamp2 ref: dev files: - packages/core.yaml - packages/behavior_default.yaml - packages/ota_feedback.yaml - packages/activate_preset_svc.yaml refresh: 0s # -------------------------------------------------------------------------- # Use your own preferences for these components. # -------------------------------------------------------------------------- wifi: ssid: !secret wifi_ssid password: !secret wifi_passwd api: password: !secret ha_api_password ota: password: !secret ota_password ```

To Reproduce Steps to reproduce the behavior:

  1. Setup a WPA2-PSK / WPA3-SAE mixed mode network
  2. Try to connect to

Expected behavior I expect it to be able to connect to a WPA2-PSK / WPA3-SAE mixed mode network.

Additional context I am running multiple ESPHome based devices in my network, my Xiaomi Bedside lamps are the only ones that are unable to connect to my network.

There are also other people reporting this same issue: https://github.com/esphome/issues/issues/2736

Also, I am more then happy to help out with some debugging :smile:

sandervankasteel commented 1 year ago

Alright, after some digging. The underlaying esp-idf-framework only recently added support for WPA3-SAE in their 5.0-beta1 release.

@mmakaay is there a way for me, use the a newer version of the esp-idf framework in this project?

mmakaay commented 1 year ago

The main project here is ESPHome. Once this project moves on to ESP-IDF 5.0, you should be able to use it in the lamp. As far as I know, it's not possible to use a newer framework version before that, because of required code changes in ESPHome to be compatible with the new version of ESP-IDF.

sandervankasteel commented 1 year ago

Hi @mmakaay thanks for your reply, in hindsight that totally makes sense 😅.

Feel free to close my issue.