Open eaxi opened 3 months ago
I would love that as well.
Edit: see my other comment below.
This is how I did this on Dashboard:
Disclaimer: I have not yet installed the firmware to esp32 (need to find a board). But build was ok so "should" work.
yaml content:
# hack of this file https://github.com/yoziru/esphome-tesla-ble/blob/main/tesla-ble-esp32-generic.yml
packages:
base: github://yoziru/esphome-tesla-ble/packages/base.yml
device_base: github://yoziru/esphome-tesla-ble/boards/esp32-generic.yml
Option2: Other a bit more hackish option that I did first:
I tried to copy and install this script via my ESPHome (2024.7.2 / Docker) but got the following error:
esp32:
board: esp32-c3-devkitm-1
framework:
type: arduino
substitutions:
friendly_name: ESPHome Tesla BLE
device_name: tesla-ble
device_description: Tesla BLE
esphome:
name: ${device_name}
name_add_mac_suffix: true
friendly_name: ${friendly_name}
comment: ${device_description}
project:
name: yoziru.esphome-tesla-ble
version: "2024.7.24"
libraries:
- https://github.com/yoziru/tesla-ble.git#v2.1.0
packages:
common: !include tesla-ble/common.yml
client: !include tesla-ble/client.yml
listener: !include tesla-ble/listener.yml # Uncomment this to scan find your VIN BLE MAC address
logger:
level: INFO
# Enable Home Assistant API
api:
encryption:
key: "..."
# sync time with home assistant
time:
- platform: homeassistant
id: homeassistant_time
ota:
- platform: esphome
password: "..."
esp32_ble_tracker:
scan_parameters:
# Activate scan only after wifi connect, see https://github.com/esphome/issues/issues/2941#issuecomment-1842369092
continuous: false
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32-08-Tesla-Ble"
password: "EuiIlgkmbgWj"
# Activate scan only after wifi connect, see https://github.com/esphome/issues/issues/2941#issuecomment-1842369092
on_connect:
- esp32_ble_tracker.start_scan:
continuous: true
on_disconnect:
- esp32_ble_tracker.stop_scan:
captive_portal:
Got it working on ESPHome Dashboard with option2 from my above comments! Here are details:
Create new device by combining base.yml and esp32-generic.yml (bord specific) -files.
Change package references to github: From...
packages:
common: !include common.yml
client: !include client.yml
# listener: !include listener.yml
...to
packages:
common: github://yoziru/esphome-tesla-ble/packages/common.yml@main
client: github://yoziru/esphome-tesla-ble/packages/client.yml@main
# listener: github://yoziru/esphome-tesla-ble/packages/listener.yml@main
Example of my .yml with these changes: https://pastebin.com/8XeEueZR
Set secrets to ESPHome Dashboard
Install the firmware using ESPHome Dashboard normally. Should probably clean the build files first every time.
Add esp32 tesla ble -device to HE integration with the API key from secrets (step descripted in readme)
Do the BLE pairing with the car as descripted on readme (step descripted in readme)
Limitations:
Thanks a lot for this great integration! <3
I tried to copy and install this script via my ESPHome (2024.7.2 / Docker) but got the following error:
I got the same errors, but still works fine. Did you change the include-rows to reference to github?
I got the same errors, but still works fine. Did you change the include-rows to reference to github?
Issue was the Arduino framework. Changed it to:
board: esp32-c3-devkitm-1
framework:
type: esp-idf
version: 5.2.2
platform_version: 6.7.0
Now the code compiled! :) Lets see if it works ...
ESP32 device logs just show this:
ESPHome YAML File:
esp32:
board: esp32-c3-devkitm-1
framework:
type: esp-idf
version: 5.2.2
platform_version: 6.7.0
substitutions:
friendly_name: ESPHome Tesla BLE
device_name: tesla-ble
device_description: Tesla BLE
esphome:
name: ${device_name}
name_add_mac_suffix: true
friendly_name: ${friendly_name}
comment: ${device_description}
project:
name: yoziru.esphome-tesla-ble
version: "2024.7.24"
libraries:
- https://github.com/yoziru/tesla-ble.git#v2.1.0
packages:
common: github://yoziru/esphome-tesla-ble/packages/common.yml@main
client: github://yoziru/esphome-tesla-ble/packages/client.yml@main
# listener: github://yoziru/esphome-tesla-ble/packages/listener.yml@main # Uncomment this to scan find your VIN BLE MAC address
logger:
level: INFO
api:
encryption:
key: !secret api_encryption_key
# sync time with home assistant
time:
- platform: homeassistant
id: homeassistant_time
ota:
platform: esphome
password: !secret ota_password
esp32_ble_tracker:
scan_parameters:
# Activate scan only after wifi connect, see https://github.com/esphome/issues/issues/2941#issuecomment-1842369092
continuous: false
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
password: !secret wifi_hotspot_password
# Activate scan only after wifi connect, see https://github.com/esphome/issues/issues/2941#issuecomment-1842369092
on_connect:
- esp32_ble_tracker.start_scan:
continuous: true
on_disconnect:
- esp32_ble_tracker.stop_scan:
captive_portal:
I tried to install "BLE Scanner 4.0" on my iPhone but it does not show MAC addresses. As I understand iOS hides MAC addresses in general ...
Thanks, looks great!
Does anybody know if it is possible to leave such a device "in the car" -- e.g. I could power it from one of the USB ports, and use it as a Wifi gateway? Or would it always leave the car unlocked?
I had some errors when building an updated version, probably due file caching (I have ESPHome as add-on in supervised HA). Solved by changing package reference files to to refresh every 60seconds, like this:
packages:
common:
url: https://github.com/yoziru/esphome-tesla-ble/
ref: main
files: packages/common.yml
refresh: 60s
client:
url: https://github.com/yoziru/esphome-tesla-ble/
ref: main
files: packages/client.yml
refresh: 60s
I had some errors when building an updated version, probably due file caching (I have ESPHome as add-on in supervised HA). Solved by changing package reference files to to refresh every 60seconds, like this:
packages: common: url: https://github.com/yoziru/esphome-tesla-ble/ ref: main files: packages/common.yml refresh: 60s client: url: https://github.com/yoziru/esphome-tesla-ble/ ref: main files: packages/client.yml refresh: 60s
Can you post your complete yaml file?
At the end, I have not found reliable way of updating remote package code for the build using esphome add-on dashboard. It seems to use old version of the code, what ever I try (clean build files, reference to specific version tag, setting refresh time, etc). There seems to be some esphome issues how files are cached, maybe related to this (old) pull request to esphome https://github.com/esphome/esphome/pull/5443
At the end, I have not found reliable way of updating remote package code for the build using esphome add-on dashboard. It seems to use old version of the code, what ever I try (clean build files, reference to specific version tag, setting refresh time, etc). There seems to be some esphome issues how files are cached, maybe related to this (old) pull request to esphome esphome/esphome#5443
So basically you recommend to compile the firmware with CMAKE and not ESPHome Dashboard? Is there a short tutorial for that since I am not that experience with that ...
So basically you recommend to compile the firmware with CMAKE and not ESPHome Dashboard? Is there a short tutorial for that since I am not that experience with that ...
I am also not so experienced with that, I would like to use dashboard to keep things simple. But maybe I will also switch to command line (as descripted on readme). It is probably more reliable way. You can use esphome in a docker or install it locally https://esphome.io/guides/getting_started_command_line
But... Now, without changing anything, I was today again able to build using dashboard just fine! I am pretty sure that ESPHome (at least as a add-on) deletes github code "cache" (only) every 24h. So updating firmware once a day might work. Lets see.
My current full .yml: https://pastebin.com/Q8MGxavM
So basically you recommend to compile the firmware with CMAKE and not ESPHome Dashboard? Is there a short tutorial for that since I am not that experience with that ...
I am also not so experienced with that, I would like to use dashboard to keep things simple. But maybe I will also switch to command line (as descripted on readme). It is probably more reliable way. You can use esphome in a docker or install it locally https://esphome.io/guides/getting_started_command_line
But... Now, without changing anything, I was today again able to build using dashboard just fine! I am pretty sure that ESPHome (at least as a add-on) deletes github code "cache" (only) every 24h. So updating firmware once a day might work. Lets see.
My current full .yml: https://pastebin.com/Q8MGxavM
I am running ESPHome as docker. But I get those compile errors with external resources as stated above. And the ESP32 does hang when booting ... -.- Tried two hardware modules laying around ESP32-C3-Mini as well as generic ESP32.
Hey everyone. As you, I've been trying to make this work in ESPHome dashboard (in my case as a HA addon).
The following yaml worked for me:
external_components:
- source: github://yoziru/esphome-tesla-ble/tree/main/components
components: all
packages:
base: github://yoziru/esphome-tesla-ble/packages/base.yml
device_base: github://yoziru/esphome-tesla-ble/boards/esp32-generic.yml
client: github://yoziru/esphome-tesla-ble/packages/client.yml
dashboard_import:
package_import_url: github://yoziru/esphome-tesla-ble/tesla-ble-esp32-generic.dashboard.yml
esphome:
name_add_mac_suffix: false
I included the override to not adding the mac suffix, as it was then showing up in the dashboard as a seperate device, and adopting it tried to install a new firmware to it, and that failed ¯\_(ツ)_/¯. This is my first foray into ESPHome, so I'm new to some of these things.
I never got the listener part to work, but opted to install BLE Radar from F-Droid and deduced that a device with a 20 character seemingly random name starting with "S9" and MAC address starting with B0
was the car.
A recommendation with that app if you're in doubt is to leave the scanning on while driving and check the map. If a device followed you around for the entire drive, it's probably the car.
Hope this helps someone out there :-).
I did get it to work and be adopted, see https://github.com/yoziru/esphome-tesla-ble/issues/70#issuecomment-2318890375 Would it be an idea to add this to the documentation?
Can you do a guide how to build the firmware via the Dashboard ?