yoziru / esphome-tesla-ble

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

How to flash a esp32 mini board #43

Open perjmolsen opened 3 months ago

perjmolsen commented 3 months ago

Hi I guess I need a bit more help :)

I have a esp mini board that I want to flash with your firmware - how do I do that? I have followed your guide "Building and flashing ESP32 firmware" and have done step 1 connecting the board to my laptop

I am stuck at step 2 - where do I place the "secrets.yaml"?

I have also done step 3 installing esphome manually....

I am running ESPhome in home assistant - it it possible to use that to build firmware file, and flash it with that?

PedroKTFC commented 3 months ago

This is how I built it for the first time (using Windows 10 and I had to install ESPHome). After that, you should find it's auto-detected by your HA and you can adopt it there and build it from there whenever you like as with other ESP 32 devices.

  1. I created a folder, say TeslaBLE
  2. I downloaded all the ESPHome Tesla BLE files to that folder. That gave me a folder esphome-tesla-ble-main under which all of the files are and which you build from. I did a cd to that folder from which I ran the commands below.
  3. You then create the secrets.yaml file there. I set wifi_hotspot_password: "" and ota_password: "".
  4. Make sure your device is plugged in to your local usb port.
  5. I did a esphome discover tesla-ble-esp32-generic.yml just to prove everything was ok (it was).
  6. I compiled the program with esphome compile tesla-ble-esp32-generic.yml
  7. And then uploaded it to my device with esphome upload tesla-ble-esp32-generic.yml

The device should then be found by HA and you should be able to adopt it in ESPHome in HA (but please see #44 as currently it's no longer working for me).

I then moved the device to be closer to the car so I could validate the key with it. That was a bit hit and miss but it did eventually work.

Good luck.

perjmolsen commented 3 months ago

THANKS! I have now flashed my esp mini board It's working great 😊 I am only missing one sensor, the one who displays the state of charge - it would had been great also to have 😊 sensors

PedroKTFC commented 3 months ago

Btw, have you got it adopted into HA ESPHome? I still can't view logs, update it etc.

perjmolsen commented 3 months ago

Yes no problem - HA found the device and asked for the secret key, I typed the one in from the secrets.yaml file - then it worked in HA.

PedroKTFC commented 3 months ago

Hmmm.... what's your ESPHome yaml file? This is mine:

substitutions:
  name: tesla-ble
  friendly_name: ESP32 Tesla BLE
packages:
  yoziru.esphome-tesla-ble: github://yoziru/esphome-tesla-ble/tesla-ble-esp32-generic.yml
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
api:
  encryption:
    key: W3+VZ49/lF9d7F...

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
perjmolsen commented 3 months ago

It looks like yours

substitutions: name: tesla-ble-a04334 friendly_name: ESP32 Tesla BLE a04334 packages: yoziru.esphome-tesla-ble: github://yoziru/esphome-tesla-ble/tesla-ble-esp32-generic.yml esphome: name: ${name} name_add_mac_suffix: false friendly_name: ${friendly_name} api: encryption: key: 2cjftDBGqAuNd............

wifi: ssid: !secret wifi_ssid password: !secret wifi_password