dmitry-cherkas / esphome-danfoss-eco

Extend Danfoss Eco eTRV BLE range over WiFi with ESPHome.
MIT License
21 stars 11 forks source link

Fix bluetooth connection issues with ESPHome 2023.11 #19

Closed ckoca closed 6 months ago

ckoca commented 6 months ago

Fixes bluetooth connection issues occuring after ESPHome 2023.11 update, also mentioned in #18.

I think the issue is caused by this change in esphome: esphome/esphome#5704.

You can try the fix by setting:

external_components:
  - source: github://ckoca/esphome-danfoss-eco@fix/esphome-2023.11-compatibility
ryssel commented 6 months ago

It seams to fix something, but my log ends with: Component esp32_ble took a long time for an operation (0.07 s) ... Disabling BLE client Uploading: [============================================================] 100% Done...

INFO Waiting for result... INFO OTA successful INFO Successfully uploaded program. INFO Starting log output from wemos-esp32.local using esphome API INFO Successfully connected to wemos-esp32 in 10.294s INFO Successful handshake with wemos-esp32 in 0.414s [16:33:36][I][app:102]: ESPHome version 2023.11.2 compiled on Nov 18 2023, 16:31:36

[16:33:36][C][wifi:391]: Local MAC: 4C:EB:D6:75:D5:48 [16:33:36][C][wifi:396]: SSID: [redacted] [16:33:36][C][wifi:397]: IP Address: 192.168.1.88 [16:33:36][C][wifi:399]: BSSID: [redacted]

[16:33:36][C][wifi:402]: Signal strength: -50 dB ▂▄▆█ [16:33:36][C][wifi:406]: Channel: 8 [16:33:36][C][wifi:407]: Subnet: 255.255.255.0 [16:33:36][C][wifi:408]: Gateway: 192.168.1.1 [16:33:36][C][wifi:409]: DNS1: 192.168.1.1 [16:33:36][C][wifi:410]: DNS2: 0.0.0.0 [16:33:36][C][esp32_ble:374]: ESP32 BLE: [16:33:36][C][esp32_ble:376]: MAC address: 4C:EB:D6:75:D5:4A [16:33:36][C][esp32_ble:377]: IO Capability: none [16:33:36][C][esp32_ble_tracker:645]: BLE Tracker: [16:33:37][D][api:102]: Accepted 192.168.1.250 [16:33:37][D][api.connection:1089]: Home Assistant 2023.11.2 (192.168.1.250): Connected successfully [16:34:19][D][esp32_ble_client:053]: [0] [00:04:2F:66:B2:57] Found device [16:34:19][D][esp32_ble_tracker:215]: Pausing scan to make connection... [16:34:19][I][esp32_ble_client:069]: [0] [00:04:2F:66:B2:57] 0x00 Attempting BLE connection [16:34:25][I][esp32_ble_client:201]: [0] [00:04:2F:66:B2:57] Connected [16:34:25][D][esp32_ble_tracker:266]: Starting scan... [16:34:25][D][sensor:094]: 'Stue radiator batteri niveau': Sending state 38.00000 % with 0 decimals of accuracy [16:34:25][D][sensor:094]: 'Stue radiator temperatur': Sending state 22.50000 °C with 1 decimals of accuracy [16:34:25][D][climate:380]: 'Stue radiator' - Sending state: [16:34:25][D][climate:383]: Mode: OFF [16:34:25][D][climate:385]: Action: HEATING [16:34:25][D][climate:403]: Current Temperature: 22.50°C [16:34:25][D][climate:409]: Target Temperature: 23.00°C [16:34:25][D][climate:380]: 'Stue radiator' - Sending state: [16:34:25][D][climate:383]: Mode: AUTO [16:34:25][D][climate:385]: Action: HEATING [16:34:25][D][climate:403]: Current Temperature: 22.50°C [16:34:25][D][climate:409]: Target Temperature: 23.00°C [16:34:25][W][component:214]: Component esp32_ble took a long time for an operation (0.07 s). [16:34:25][W][component:215]: Components should block for at most 20-30ms. [16:34:25][I][ble_client:041]: [00:04:2F:66:B2:57] Disabling BLE client.

dmitry-cherkas commented 6 months ago

@ryssel , Disabling BLE client. is not an issue actually. ESP32 does not maintain open connection with the Eco, it polls for status updates from time to time, establishing a new connection and shutting down the BLE client once done.

So sincy you and @reinisb confirmed this PR solves the problem, I'll merge it and create a new release tag.

Thanks @ckoca for your contribution!