Updates fail

I like my systems updated, so with every new version of ESPHome I update my devices (also to get rid of number next to Settings). I’ve got several devices that won’t update unless I edit the config to it’s bare necessities, update the device, edit the config again and update it again. I used to run Tasmota and they had a different approach (without the hard manual labor), they first installed a tasmota-minimal and then uploaded the version you needed.

Am I the only one facing this issue or is it just me?

Sounds like you don’t have enough memory on your devices to hold the existing config and the OTA config. You have a few options:

  1. Buy devices that have more flash memory.

  2. Cut back unneeded devices from your config (especially large components like web server, wake word, Bluetooth Proxy, etc…), or if they are needed split them off onto other devices.

  3. Keep doing your minimal config dance.

I got that in the update to 2024.8.3 today.

You could create a minimal firmware file for the device and do exactly what you say. Update to the minimal, then the updated version.

Which ESP board are you using?

This one for me, but you may have been asking @hebom

Either of you. Unfortunately that does not say how much flash it has

Unfortunately not many suppliers will be that specific. I’ve got a MOES WS UEU16-M from AliExpress a few years ago, nothing on their site mentioned that they replaced the ESP8285 and put in a Beken WB2S. Opening up that device to replace the Beken chipset with a ESP will cause some issues with the build quality of the device (you can smash the metal against a hard object and the thing will pop open, but it will be looser when you close it).

Tasmota also had issues with space, they’ve solved it by installing a minimal version before updating to the updated version. I think that having to edit the config to minimize the build and then again edit the config to install the build for that device is very user friendly, ESPHome could probably take care of that.

While typing this response I thought of something:

substitutions:
  name: "zolder--wasmachine"
  friendly_name: "Zolder - wasmachine"

esphome:
  name: "${name}"
  friendly_name: "${friendly_name}"
  project:
    name: esphome.moes-ws-ueu16-m-template
    version: "1.0"

bk72xx:
  board: wb2s

preferences:
  flash_write_interval: 0s

logger:
  baud_rate: 0

packages:
  api: !include ./includes/api.yaml
  ota: !include ./includes/ota.yaml
  wifi: !include ./includes/wifi.yaml
  time: !include ./includes/time.yaml
#  web_server: !include ./includes/web_server.yaml
  text_sensor: !include ./includes/text_sensor.yaml
  sensor: !include ./includes/sensor.yaml
  switch: !include ./includes/switch.yaml
  binary_sensor: !include ./includes/binary_sensor.yaml

captive_portal:

binary_sensor:
  - platform: gpio
    pin:
      number: P10
      inverted: true
    id: button
    on_click:
      - switch.toggle: outlet
switch:
  - platform: gpio
    name: Device - Relay
    id: outlet
    pin: P26
    icon: mdi:power-socket-eu
    restore_mode: RESTORE_DEFAULT_OFF

sensor:
    # PC191HA includes a BL0937 chip for measuring power consumption
    #     and BL0937 is a variation of hlw8012, but using inverted SEL pin functionality
  - platform: hlw8012
    model: BL0937     # note that the model must be specified to use special calculation parameters
    sel_pin:          # I believe that cf_pin reports either Voltage or Current depending on this select pin
      inverted: true  # determine whether true reports Voltage
      number: P24
    cf_pin:           # current or voltage (ele_pin: 7)
      inverted: true  # the logic of BL0937 is opposite from HLW8012
      number: P7
    cf1_pin:          #  Power (vi_pin: 8)
      inverted: true  # the logic of BL0937 is opposite from HLW8012
      number: P8
    update_interval: 1s # How often to measure and report values

    # PC191HA measures and returns Voltage OR Current according to the value of sel_pin,
    #     but it can change the value of sel_pin periodically
    initial_mode: "VOLTAGE"             # reports VOLTAGE or CURRENT
    change_mode_every: "4294967295"            # do NOT swap between reporting Volts or Amps (well, swap after 4000 years)
        #   reporting Voltage or Current. Note that the first value reported should be ignored as inaccurate

    # Adjust according to the actual resistor values on board to calibrate the specific unit
    voltage_divider:  891       # LOWER VALUE GIVES LOWER VOLTAGE
    current_resistor: 0.00098     # HIGHER VALUE GIVES LOWER WATTAGE

# how the power monitoring values are returned to ESPHome
    voltage:
      name: "Device - Voltage"
      id: voltage
      unit_of_measurement: V
      accuracy_decimals: 1
      filters:
        - skip_initial: 2
    power:
      name: "Device - Power"
      id: power
      unit_of_measurement: W
      accuracy_decimals: 1
      filters:
        - skip_initial: 2

    # power is simply current x voltage -- except that the pc191ha doesn't follow that formula.
        # Setting current_resistor to give an accurate Amperage does NOT also give the correct Wattage
        # my work-around is to calculate current from power / voltage
  - platform: template  
    name: "Device - Current"
    unit_of_measurement: A
    accuracy_decimals: 2
    update_interval: 5s
    lambda: |-
      return (id(power).state / id(voltage).state);
    filters:  
      - skip_initial: 5     # give time for data to settle to avoid Nan

I could try to put part of the config in a file and include it just like I did with api, ota, etc. Whenever I face issues updating I can just comment out that !include and build my minimal version.

Btw. the config before updating had the webserver enabled. I had to comment out all below my WiFi config to update the device, then revert the changes to update to my device specific version.

looks like an esp8285

HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.2.2
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.6
|-- Wire @ 1.0
|-- ArduinoJson @ 6.18.5
RAM:   [=====     ]  47.8% (used 39120 bytes from 81920 bytes)
Flash: [======    ]  60.0% (used 614065 bytes from 1023984 bytes)
========================= [SUCCESS] Took 1.68 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.20.48
INFO Uploading /data/build/athom-presence-sensor-9bd37b/.pioenvs/athom-presence-sensor-9bd37b/firmware.bin (618224 bytes)
INFO Compressed to 420481 bytes
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)

Maybe a quicker workaround,
compile the minimum version, but so not use ota, use download instead, and save it somewhere.

Then upgrade the device using the downloaded bin using the devices web interface, and then run the ota upgrade as usual :thinking:

(and just keep the minimal bin to use at next update…or just don’t update at all :thinking:)

yeah i fixed it by editing the yaml to make a minimal version, installed that via ota.

then restored the yaml changes, installed that via ota.

I should keep the bin from the minimal, but haven;t yet.

Do you really need this?

web_server:
  port: 80

If you never use the web server just remove that from the config and you should be fine to flash OTA with out loading a minimal version first.

1 Like

No I probably don’t, it was in the default firmware that came with the device.

Hi @nickrout

I have the same issue where I can’t update, same device, athom Prescense Senso, it says

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)

What do you include in the minimal yaml? Can you please share an example

You could open an issue with the supplier/manufacturer to get them to remove it.

Hi @Harish_Hirani , I am away from home and don’t have easy access to my yaml, I’ll figure it out and post for you.

Any updates on this?

I too have an athom-presence-sensor and can’t update to the latest firmware since version 7.3.

What is the very minimal needed in the YAML file to attempt this to make it work?

i heard also you can take the device and just physically plug it into the same machine running home assistant and do the upgrade that way?

Hi, @bmac6996 - Athom Presence sensors is what I use, too. I had issues updating from 2024.7.3, but managed to get it to 2024.8.3 at some point. According to posts in various places, 8.3 apparently solved the issue, but I can confirm that it hasn’t.