Reflash after lost OTA

Hi experts,
I´m very new to ESPHome and for testing I flashed a predefined yaml config where a random OTA password was in. Because I deleted this file I cant reccover the PW nor flashing the device anymore. Also there is no Webserver. Its a “Aoycocr GU10 RGBCCT 4.9w Q3SCWM” with Beken BK7231T.
I still have the xxx.uf2 file. The device is connectetd to my WiFi and I see ports 6053 and 8892 are open.
Is there a way to save the device from garbage?

The yaml was like this but with another PW:

esphome:
  name: aoy-tmp
  friendly_name: aoy-tmp

bk72xx:
  board: generic-bk7231t-qfn32-tuya

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "Z677O9qaQ4SwV7jWShScuKaAxbbmLjnf6HzKi7jH2Iw="

ota:
  - platform: esphome
    password: "a0040d57d25f74e9940529c6bdb6cab3"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Aoy-Tmp Fallback Hotspot"
    password: "ENDaEiDQ2gT1"

captive_portal:

You may be able to get the ota password from looking at the firmware file. Try

strings xxx.uf2|less

Next time don’t delete it forget your password!!

It`s a lot of output and nothing make me assume where it is.

Maybe another plan could be to find some logs from the ESPHome Plugin …
… but where can I find these files? I see a lot of output from the compiler generating the BIN/UF2 but where are these files located?
I`m runnig HA in a docker environment.

You won’t find it in logs.
Do as Nick said, and look around known strings, e.g. your wifi ssid/password

Example of mine:

❯ strings firmware.bin | grep -n5 "Ultima"
998-to_remove_ was %u now: %u items where %zu now %zu. Please report this
999-esp32-ble-proxy-mmwave-hall
1000-ESP32 Proxy & mmWave Hall
1001-May  5 2024, 12:13:35
1002-esp32-ble-proxy-mmwave-hall.lan
1003:Ultima <-- my wifi ssid
1004-<my wifi password>
1005-<the ota key> <--
1006-ld2410 distance resolution
1007-ld2410_distance_resolution
1008-mdi:ruler

Thanks, but this seems not to work with UF2-files.
Either ssid nor wifi-pw will be shown.

If there is no way to find the also created xxx.bin file from the compiler I throw it away because it`s a mess to find the random generated wifi password for the fallback AP as well.

I don’t know about .uf2 files. I guess those are specific to openbeken, while ESP use .bin.

Try this. Disable your local wifi or have it far enough away that it cannot see your wifi and reboot device. If your yaml is set correctly it should create its own access point. Connect to this with your phone or laptop and you can then upload new software from the web page. I’ve used this method a few times. I don’t set any encryption or ap passwords just for this risk.

Got it!
I found the subdirs where the data is stored. In my case:
/usr/share/hassio/addons/data/5c53de3b_esphome/build

There in are the subs from created configs. In the right sub is a file “main.cpp”
Inside this file is any information for generating the firmware.

Also the passwords :smiley:

1 Like