yoziru / esphome-tesla-ble

Interact with Tesla vehicles over BLE using ESPHome and Home Assistant
GNU Affero General Public License v3.0
64 stars 11 forks source link

Charger switch doesn't work reliably #39

Closed PedroKTFC closed 1 month ago

PedroKTFC commented 1 month ago

I have used the Charger switch control to switch charging of my car on and off. However, this does not work reliably and I can't tell if it's worked by simply looking at the UI. The HA control itself changes immediately but I have to look in the logs to see the actual outcome. I've pasted some logs below. I suspect the command often fails because I have a very weak connection to my car. Ideally, the system should retry several times and provide feedback through the UI of the outcome.

[11:40:39][I][restart.button:012]: Restarting device... [11:40:39][I][app:132]: Rebooting safely... INFO Processing expected disconnect from ESPHome API for tesla-ble-2e1480 @ 192.168.0.109 WARNING Disconnected from API WARNING Can't connect to ESPHome API for tesla-ble-2e1480 @ 192.168.0.109: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.0.109', port=6053))]: [Errno 111] Connect call failed ('192.168.0.109', 6053) (SocketAPIError) INFO Trying to connect to tesla-ble-2e1480 @ 192.168.0.109 in the background INFO Successfully connected to tesla-ble-2e1480 @ 192.168.0.109 in 0.015s INFO Successful handshake with tesla-ble-2e1480 @ 192.168.0.109 in 0.183s [11:40:49][I][esp32_ble_client:227]: [0] [snip] Connected [11:40:49][I][tesla_ble_vehicle:859]: Ephemeral key sent to VEHICLE_SECURITY [11:40:49][I][tesla_ble_vehicle:867]: Ephemeral key sent to INFOTAINMENT [11:40:49][I][tesla_ble_vehicle:875]: Sent initial info status request [11:40:49][I][ble_rssi_sensor:049]: ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT RSSI: -99 [11:40:49][W][tesla_ble_vehicle:968]: [x] Dropping message with missing source [11:40:50][I][tesla_ble_vehicle:1054]: [snip] Updated session info for DOMAIN_VEHICLE_SECURITY [11:40:50][W][component:237]: Component esp32_ble took a long time for an operation (273 ms). [11:40:50][W][component:238]: Components should block for at most 30 ms. [11:41:17][I][ble_rssi_sensor:049]: ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT RSSI: -108 [11:41:27][I][tesla_ble_vehicle:1063]: Received message from unknown domain DOMAIN_VEHICLE_SECURITY [11:41:40][I][safe_mode:041]: Boot seems successful; resetting boot loop counter [11:42:15][I][tesla_ble_vehicle:540]: Setting charging switch to ON [11:42:15][E][tesla_ble_vehicle:546]: Failed to build charge message [11:42:15][W][component:237]: Component api took a long time for an operation (65 ms). [11:42:15][W][component:238]: Components should block for at most 30 ms. [11:42:16][I][tesla_ble_vehicle:1054]: [snip] Updated session info for DOMAIN_INFOTAINMENT [11:42:16][W][component:237]: Component esp32_ble took a long time for an operation (275 ms). [11:42:16][W][component:238]: Components should block for at most 30 ms. [11:42:17][I][ble_rssi_sensor:049]: ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT RSSI: -110 [11:42:27][I][tesla_ble_vehicle:1063]: Received message from unknown domain DOMAIN_VEHICLE_SECURITY [11:43:17][I][tesla_ble_vehicle:540]: Setting charging switch to OFF [11:43:17][W][component:237]: Component api took a long time for an operation (60 ms). [11:43:17][W][component:238]: Components should block for at most 30 ms. [11:43:17][I][ble_rssi_sensor:049]: ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT RSSI: -94 [11:43:18][I][tesla_ble_vehicle:1063]: Received message from unknown domain DOMAIN_INFOTAINMENT

[11:43:18][I][tesla_ble_vehicle:573]: result: ERROR [11:43:18][I][tesla_ble_vehicle:579]: reason: not_charging [11:43:27][I][tesla_ble_vehicle:1063]: Received message from unknown domain DOMAIN_VEHICLE_SECURITY [11:43:37][I][tesla_ble_vehicle:540]: Setting charging switch to ON [11:43:38][W][component:237]: Component api took a long time for an operation (61 ms). [11:43:38][W][component:238]: Components should block for at most 30 ms. [11:43:38][I][tesla_ble_vehicle:1063]: Received message from unknown domain DOMAIN_INFOTAINMENT

[11:43:38][I][tesla_ble_vehicle:573]: result: OK

yoziru commented 1 month ago

Fixed by https://github.com/yoziru/esphome-tesla-ble/pull/49