HELP- ESP32 stopped working

I would be very grateful for help solving this problem which is driving me mad!:

I have an ESP32 which I am using in my greenhouse to receive temperature inputs and output to relay for opening vents. I have been slowly developing this and updating the config file via wifi with each change. All was good until today when it has stopped connecting. I have brought it back inside and connected via USB and ESPhome Web: it connects but cannot install or update: Failed to initialize. Try reseting or holding down boot.
Trying connecting via the headless machine running HA:
esptool.py v4.6.2
Serial port /dev/ttyUSB0
Connecting…
ERROR Running command failed: Failed to connect to ESP32: No serial data received.

I cannot get any logs from either source.

Also I have noticed the ESP32 board itself has a blue led as well as the red - not sure if that has always been lit but never noticed it before.

Does this mean anything to someone?
Thanks

Was this after pushing new firmware to it or just random?

I assume you’ve been doing this when trying to flash serially?

This is pretty common, red being power and the blue being one of the pins. Without seeing your YAML, no way of knowing if you defined a status pin to control the blue LED.

Hi Ben,
The problem started when I returned it to the greenhouse after having it working indoors. I had added a DC motor controller. It had been connected via wifi indoors and seemed to be fine. Plugged it back in the greenhouse and it didn’t connect from then on…
Yes I’ve tried holding down the boot button.

I haven’t intentionally set any GPIO to the LED but I did add the last 2 sections in the yaml: outputs and fan just before it stopped working - could that be to blame? Here is my yaml.

THanks for your help

esphome:
name: esphome-web-f29800
friendly_name: ESP32a

esp32:
board: esp32dev
framework:
type: arduino

Enable logging

logger:

Enable Home Assistant API

api:
encryption:
key: “CAzB6femGpkNd12Ch/JwXCktDc7YWJj6S7nM0yKYhyo=”

ota:

wifi:
ssid: Hinckleystar2
password: ************

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: “Esphome-Web-F29800”
password: “ZI97yBWCoUmR”

captive_portal:

switch:

  • platform: gpio
    name: “Switch1”
    pin: 33

  • platform: gpio
    name: “Switch2”
    pin: 32

esp32_ble_tracker:

sensor:

  • platform: inkbird_ibsth1_mini
    mac_address: 49:23:04:14:0B:4E
    temperature:
    name: “Inkbird IBS-TH1 Temperature1”
    external_temperature:
    name: “Water Tank”

  • platform: inkbird_ibsth1_mini
    mac_address: 49:23:04:14:0F:8B
    temperature:
    name: “Inkbird IBS-TH1 Temperature2”
    external_temperature:
    name: “Outdoor temperature”

  • platform: inkbird_ibsth1_mini
    mac_address: 49:23:04:08:1F:76
    temperature:
    name: “Greenhouse Internal temperature”
    on_value_range:
    - below: 24
    then:
    - logger.log: “Internal temp below 24”

  • platform: inkbird_ibsth1_mini
    mac_address: 49:23:04:14:0B:7A
    temperature:
    name: “NA”
    external_temperature:
    name: “Water Drum temperature”
    on_value_range:
    - above: 21
    then:
    - logger.log: “Drum temp above 21”

output:

  • platform: ledc
    pin: GPIO18
    id: motor_speed_pin
  • platform: ledc
    id: motor_forward_pin
    pin: GPIO22
    frequency: 32Hz
  • platform: ledc
    id: motor_reverse_pin
    pin: GPIO23
    frequency: 32Hz

fan:

  • platform: hbridge
    id: my_fan
    name: “Speed”
    pin_a: motor_forward_pin
    pin_b: motor_reverse_pin
    enable_pin: motor_speed_pin
    decay_mode: slow # slow decay mode (braking) or fast decay (coasting).

Please format your code correctly, I can’t read it as-is. Point number 10 says how to:

But I also don’t see anything about the last additions that should cause it to crash.

Sorry about that, I forgot about formatting in my haste.

Novice question - is there a way or fully erasing an ESP32? Like a factory reset. Then I could start again.

esphome:
  name: esphome-web-f29800
  friendly_name: ESP32a

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "CAzB6femGpkNd12Ch/JwXCktDc7YWJj6S7nM0yKYhyo="

ota:


wifi:
  ssid: Hinckleystar2
  password: *************


  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-F29800"
    password: "ZI97yBWCoUmR"

captive_portal:
    
switch:
  - platform: gpio
    name: "Switch1"
    pin: 33

  - platform: gpio
    name: "Switch2"
    pin: 32


esp32_ble_tracker:


sensor:
  - platform: inkbird_ibsth1_mini
    mac_address: 49:23:04:14:0B:4E
    temperature:
      name: "Inkbird IBS-TH1 Temperature1"
    external_temperature:
      name: "Water Tank"


  - platform: inkbird_ibsth1_mini
    mac_address: 49:23:04:14:0F:8B
    temperature: 
      name: "Inkbird IBS-TH1 Temperature2"
    external_temperature:
      name: "Outdoor temperature"

  - platform: inkbird_ibsth1_mini
    mac_address: 49:23:04:08:1F:76
    temperature: 
      name: "Greenhouse Internal temperature"
      on_value_range: 
        - below: 24
          then:
            - logger.log: "Internal temp below 24"


  - platform: inkbird_ibsth1_mini
    mac_address: 49:23:04:14:0B:7A
    temperature: 
      name: "NA"
    external_temperature:
      name: "Water Drum temperature"
      on_value_range: 
        - above: 21
          then:
            - logger.log: "Drum temp above 21"

output:
  - platform: ledc
    pin: GPIO18
    id: motor_speed_pin
  - platform: ledc
    id: motor_forward_pin
    pin: GPIO22
    frequency: 32Hz
  - platform: ledc
    id: motor_reverse_pin
    pin: GPIO23
    frequency: 32Hz

fan:
- platform: hbridge
  id: my_fan
  name: "Speed"
  pin_a: motor_forward_pin
  pin_b: motor_reverse_pin
  enable_pin: motor_speed_pin
  decay_mode: slow   # slow decay mode (braking) or fast decay (coasting).

Just reflash the board or swap snother board in there. Sometimes you can delete the problem esp node then do a HA restart and see if it discovers it. Sometimes its just better to grab a new board too. These things are dirt cheap and they do fail from time to time.