How to Fix the “ESP Does Not Have Enough Space” Error When Flashing Athom Human Presence Sensors with ESPHome

I’ve been dealing with an intermittent but persistent issue when flashing ESPHome devices on Home Assistant. When I tried to flash my Athom Human Presence Sensors with the latest firmware, I’d receive this error:

ERROR Error binary size: Error: ESP does not have enough space to store OTA file. Please try flashing a minimal firmware (remove everything except ota).

After some research, I found the solution on the Athom Configs GitHub page. While the original solution was helpful, I wanted to break it down into clearer steps for others.

Here’s what worked for me.


Step 1: Comment Out the Packages

First, locate the packages section in your YAML file and comment it out. For my sensor, it looked like this:

Original YAML File:

substitutions:
  name: bathroom-athom-sensor
  friendly_name: Bathroom Athom Sensor
packages:
  Athom_Technology.Presence_Sensor: github://athom-tech/athom-configs/athom-presence-sensor.yaml
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}

api:
  encryption:
    key: [my key here]

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

Modified YAML File (Step 1):

substitutions:
  name: bathroom-athom-sensor
  friendly_name: Bathroom Athom Sensor
#packages:
#  Athom_Technology.Presence_Sensor: github://athom-tech/athom-configs/athom-presence-sensor.yaml
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}

api:
  encryption:
    key: [my key here]

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

Step 2: Add a Minimal Configuration

Next, add a minimal configuration to reduce the firmware size. I placed mine above the api section.

Add These Lines:

esp8266:
  board: esp8285
ota:
  platform: esphome
logger:

This provides just enough functionality to flash the device with a smaller binary.


Step 3: Flash the Device

Your YAML file should now look like this:

Full YAML File (Before Flashing):

substitutions:
  name: bathroom-athom-sensor
  friendly_name: Bathroom Athom Sensor
#packages:
#  Athom_Technology.Presence_Sensor: github://athom-tech/athom-configs/athom-presence-sensor.yaml
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}

esp8266:
  board: esp8285
ota:
  platform: esphome
logger:

api:
  encryption:
    key: [my key here]

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

Flash this configuration to your device.


Step 4: Restore the Original Configuration

After the initial flash, you can uncomment the original packages section and remove the minimal configuration. Your YAML file should return to its original state for the second flash:

Full YAML File (Second Flash):

substitutions:
  name: bathroom-athom-sensor
  friendly_name: Bathroom Athom Sensor
packages:
  Athom_Technology.Presence_Sensor: github://athom-tech/athom-configs/athom-presence-sensor.yaml
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}

#esp8266:
#  board: esp8285
#ota:
#  platform: esphome
#logger:

api:
  encryption:
    key: [my key here]

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

Flash the device again, and you should now have the full firmware with all the original features enabled.


Conclusion

And that’s it! This two-step flashing process worked for my Athom Human Presence Sensors.

Have you resolved this issue in a different way? If so, I’d love to hear about your solution—feel free to send an email!

Reply by email