Closed cosmos1978 closed 1 month ago
Hi @cosmos1978 , can you check with ESPHome 2024.6.4 Have seen a lot of issues linked to the encryption (not linked at all with my code I fear)
Which config are you using for the api part?
Using a ESP 32 and getting the following error "The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.6)."
I have an encryption key in the code and upload to device.
Can you share the config (differences from the one in my packages)?
I had no encryptrion key configured in the api section. It was empty. I added the encryption key from the secrets file as I did for other esphome devices I i use.
I will do some tests to see if it improves with this change.
Ok, thanks. I just upgraded to the latest esphome version and am still unable to reproduce your issue
Still the same issue.
[20:38:18][W][component:237]: Component esp32_ble took a long time for an operation (77 ms).
[20:38:18][W][component:238]: Components should block for at most 30 ms.
[20:38:20][D][esp32_ble_client:110]: [0] [D9:D9:E7:B1:F6:FC] ESP_GATTC_READ_CHAR_EVT
[20:38:20][D][text_sensor:064]: 'Generic data': Sending state '\xde.\x8cf'
[20:38:22][D][sensor:094]: 'Car P1': Sending state 0.00000 kW with 2 decimals of accuracy
[20:38:22][D][sensor:094]: 'Car P3': Sending state -0.00100 kW with 2 decimals of accuracy
[20:38:22][D][sensor:094]: 'Car Current': Sending state 0.00000 A with 1 decimals of accuracy
[20:38:22][D][sensor:094]: 'Grid Power': Sending state 3260.00000 W with 0 decimals of accuracy
[20:38:23][D][esp32_ble_client:110]: [0] [D9:D9:E7:B1:F6:FC] ESP_GATTC_READ_CHAR_EVT
[20:38:23][D][text_sensor:064]: 'Serial Number': Sending state '2222-00013'
[20:38:23][D][esp32_ble_client:110]: [0] [D9:D9:E7:B1:F6:FC] ESP_GATTC_NOTIFY_EVT
[20:38:23][D][text_sensor:064]: 'nexxtender_charging_car_data': Sending state '//\x8cf'
[20:38:23][D][nexxtender_charging_car_data:075]: 2F.2F.8C.66.00.00.00.00.00.00.00.00.FF.FF.00.00.88.CE (18)
[20:38:23][D][esp32_ble_client:110]: [0] [D9:D9:E7:B1:F6:FC] ESP_GATTC_NOTIFY_EVT
[20:38:23][D][text_sensor:064]: 'nexxtender_charging_grid_data': Sending state '//\x8cf'
[20:38:23][D][nexxtender_charging_grid_data:075]: 2F.2F.8C.66.08.00.18.00.85.00.00.00.07.FF.C0.C3 (16)
[20:38:23][D][esp32_ble_client:110]: [0] [D9:D9:E7:B1:F6:FC] ESP_GATTC_NOTIFY_EVT
[20:38:23][D][text_sensor:064]: 'nexxtender_charging_basic_data': Sending state ''
[20:38:23][D][nexxtender_charging_basic_data:075]: 00.00.03.00.00.00.00.00.00.00.00.00.00.00 (14)
[20:38:23][D][text_sensor:064]: 'Discriminator': Sending state 'Stopped'
[20:38:23][D][text_sensor:064]: 'Status': Sending state 'Unplugged'
[20:38:23][D][sensor:094]: 'Charging Phase Count': Sending state 0.00000 with 0 decimals of accuracy
WARNING nexxtender @ 192.168.129.177: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for nexxtender @ 192.168.129.177
WARNING Disconnected from API
WARNING Can't connect to ESPHome API for nexxtender @ 192.168.129.177: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.129.177', port=6053))]: [Errno 111] Connect call failed ('192.168.129.177', 6053) (SocketAPIError)
INFO Trying to connect to nexxtender @ 192.168.129.177 in the background
INFO Successfully connected to nexxtender @ 192.168.129.177 in 0.031s
WARNING nexxtender @ 192.168.129.177: Connection error occurred: nexxtender @ 192.168.129.177: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.6).
INFO Successfully connected to nexxtender @ 192.168.129.177 in 0.014s
WARNING nexxtender @ 192.168.129.177: Connection error occurred: nexxtender @ 192.168.129.177: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.6).
INFO Successfully connected to nexxtender @ 192.168.129.177 in 0.015s
WARNING nexxtender @ 192.168.129.177: Connection error occurred: nexxtender @ 192.168.129.177: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.6).
INFO Successfully connected to nexxtender @ 192.168.129.177 in 0.014s
WARNING nexxtender @ 192.168.129.177: Connection error occurred: nexxtender @ 192.168.129.177: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.6).
INFO Successfully connected to nexxtender @ 192.168.129.177 in 0.051s
WARNING nexxtender @ 192.168.129.177: Connection error occurred: nexxtender @ 192.168.129.177: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.6).
INFO Successfully connected to nexxtender @ 192.168.129.177 in 0.017s
WARNING nexxtender @ 192.168.129.177: Connection error occurred: nexxtender @ 192.168.129.177: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.6).
INFO Successfully connected to nexxtender @ 192.168.129.177 in 0.013s
config
packages:
nexxtender:
url: https://github.com/geertmeersman/nexxtender
files: [config/nexxtender.yaml, config/nexxtender_packages/webserver.yaml]
refresh: 0s
substitutions:
name: "nexxtender"
friendly_name: nexxtender BLE
## Uncomment and modify when you want to use a different threshold.
# charging_mode_eco_threshold: "8" # Single phase (6A + 2 margin)
# charging_mode_eco_bi_threshold: "14" # Bi-phase (12A + 2 margin)
charging_mode_eco_tri_threshold: "20" # Tri-phase (18A + 2 margin)
# slider_max_car_charging_speed: "32" # The max value of the slider for the maximum car charging speed slider, default set to 32
# slider_max_available_capacity: "40" # The max value of the slider for the maximum available capacity slider, default set to 40
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
project:
name: esphome.web
version: '1.0'
esp32:
board: esp32dev
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret esphome_api_key
# Allow Over-The-Air updates
ota:
# Allow provisioning Wi-Fi via serial
improv_serial:
wifi:
# Set up a wifi access point
ap: {}
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
dashboard_import:
package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
import_full_config: true
# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
authorizer: none
# To have a "next url" for improv serial
web_server:
I now removed everything from the yaml file besides packages: and esphome: like in the example since the api config is included via the url option.
So it had 2 api sections.
lets see if it is more stable now
nope still the same. works for some time and then the error pops up
[21:30:27][D][nexxtender_charging_basic_data:075]: 00.00.03.00.00.00.00.00.00.00.00.00.00.00 (14)
[21:30:27][D][text_sensor:064]: 'Discriminator': Sending state 'Stopped'
[21:30:27][D][text_sensor:064]: 'Status': Sending state 'Unplugged'
[21:30:27][D][sensor:094]: 'Charging Phase Count': Sending state 0.00000 with 0 decimals of accuracy
WARNING nexxtender @ 192.168.129.177: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for nexxtender @ 192.168.129.177
WARNING Disconnected from API
INFO Successfully connected to nexxtender @ 192.168.129.177 in 0.017s
WARNING nexxtender @ 192.168.129.177: Connection error occurred: nexxtender @ 192.168.129.177: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.6).
WARNING Can't connect to ESPHome API for nexxtender @ 192.168.129.177: nexxtender @ 192.168.129.177: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.6). (HandshakeAPIError)
INFO Trying to connect to nexxtender @ 192.168.129.177 in the background
I fear it somehow is linked to esphome and not really to my code...
ah, I see your ota section:
Since june esphome changed the ota configuration.
ota:
- platform: esphome
https://github.com/geertmeersman/nexxtender/commit/fe5bd5264518b33e518cb64923e27c42b7357d93
give it a try
@cosmos1978 , @loispostula is it fixed?
Yes adding the correct ota setting fixed it
I always get this error whenever I synced my charging sessions via the app via bluetooth.
Even restarting the esp32 does not help. The weird thing is that when I reupload the firmware it can create a bluetooth connection again.
INFO ESPHome 2024.6.4 INFO Reading configuration /config/esphome/nexxtender.yaml... INFO Updating https://github.com/geertmeersman/nexxtender@None INFO Detected timezone 'Europe/Brussels' WARNING GPIO0 is a strapping PIN and should only be used for I/O with care. Attaching external pullup/down resistors to strapping pins can cause unexpected failures. See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins INFO Starting log output from 192.168.129.177 using esphome API INFO Successfully connected to nexxtender @ 192.168.129.177 in 0.131s WARNING nexxtender @ 192.168.129.177: Connection error occurred: nexxtender @ 192.168.129.177: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.4). WARNING Can't connect to ESPHome API for nexxtender @ 192.168.129.177: nexxtender @ 192.168.129.177: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.4). (HandshakeAPIError) INFO Trying to connect to nexxtender @ 192.168.129.177 in the background INFO Successfully connected to nexxtender @ 192.168.129.177 in 0.044s WARNING nexxtender @ 192.168.129.177: Connection error occurred: nexxtender @ 192.168.129.177: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.4). INFO Successfully connected to nexxtender @ 192.168.129.177 in 0.074s WARNING nexxtender @ 192.168.129.177: Connection error occurred: nexxtender @ 192.168.129.177: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.6.4). INFO Successfully connected to nexxtender @ 192.168.129.177 in 0.052s