Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presence Sensors not installing ESPHome 2024.5.1 #59

Open
fifthecho opened this issue May 20, 2024 · 36 comments
Open

Presence Sensors not installing ESPHome 2024.5.1 #59

fifthecho opened this issue May 20, 2024 · 36 comments

Comments

@fifthecho
Copy link

When trying to install the latest ESPHome, I get the following message:

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)

I'm using a super-basic config:

substitutions:
  name: athom-presence-sensor-<MAC>
  friendly_name: athom-presence-<LOCATION>
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: <KEY>
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

@jpettitt
Copy link

jpettitt commented May 20, 2024

The binary size jumped from 612k to 660k between 2024.5.0 and 2024.5.1

My Workaround

  1. Downgrade to 5.4.0 (should be in system -> backups in HA)

  2. If 5.4 installs cleanly you're good to go.

  3. If it still complains about not enough space try rebooting the sensor before the update.

  4. If that fails open the config and comment out the encryption in the encryption stanza in the config. (this should produce a binary around 529k)

  5. Rebuild and install, it should now be small enough.

  6. Once it reboots the 5.4 code uncomment the encryption and install again.

This has worked for my sensors.

@tarontop
Copy link
Collaborator

At present, the fastest and most convenient solution is to download the firmware locally to the computer, and then use your own data cable to flash the firmware directly. You only need to connect the data cable.

@tarontop
Copy link
Collaborator

tarontop commented May 21, 2024

We may need to add

 platformio_options:
    board_build.ldscript: eagle.flash.2m.ld
    board_upload.maximum_size = 2097152

The chip is 2MB, while the default configuration is 1MB

example

esphome:
  name: "${name}"
  friendly_name: "${friendly_name}"
  name_add_mac_suffix: true
  project:
    name: "${project_name}"
    version: "${project_version}"
    platformio_options:
       board_build.ldscript: eagle.flash.2m.ld
       board_upload.maximum_size = 2097152

@HaraldGithub
Copy link

At present, the fastest and most convenient solution is to download the firmware locally to the computer, and then use your own data cable to flash the firmware directly. You only need to connect the data cable.

Very good idea, but where could I download the ESP-Firmware?
At this page ( https://github.com/athom-tech/athom-configs/releases/tag/2023.8.3 ) only a FW from Sep2023 is available.

@nickmcgill
Copy link

Within ESPHome, click on the three dots of the device to update, select install, then manual download.

@Mika255
Copy link

Mika255 commented May 22, 2024

We may need to add

 platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

The chip is 2MB, while the default configuration is 1MB

example

esphome:
  name: "${name}"
  friendly_name: "${friendly_name}"
  name_add_mac_suffix: true
  project:
    name: "${project_name}"
    version: "${project_version}"
    platformio_options:
       board_build.ldscript: eagle.flash.2m.ld

@tarontop did this work for you? It didn't help. It's still showing 1mb with the following config

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}
  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

@nickmcgill
Copy link

nickmcgill commented May 22, 2024

I had to do this in two steps.
First ota update with

substitutions:
  name: athom-presence-sensor-xxxxxx
  friendly_name: Athom presence 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}
  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

esp8266:
  board: esp8285
ota:
logger:

api:
  encryption:
    key: xxxxxxxxxxxxxxxx=


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

Second ota update:

substitutions:
  name: athom-presence-sensor-xxxxxx
  friendly_name: Athom presence 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}
  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

#esp8266:
#  board: esp8285
#ota:
#logger:

api:
  encryption:
    key: xxxxxxxxxxxxxxxx=


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

This works for me. I couldn't update in one go. I assume that the existing firmware was compiled for a 1 Mb chip so rejected the modified upgrade. I could be wrong!

Sorry about the multiple edits, struggling with formatting (rtfm!)

@HaraldGithub
Copy link

This works for me.

Sorry for asking, but could you explain how I've to do this steps:

  • where have I to copy the code in
  • how could I start the OTA process
  • what is important

Thank you very much!

@nickmcgill
Copy link

I use ESPHome within HomeAssistant, so I can only help you from that.
HA/ESPHome should have detected and adopted the presence sensor.
From the ESPHome addon (in HA) you will see the ESPHome devices (mine is still called Athom Presence Sensor).
On the bottom of the device card, there is "visit, edit, logs". Click on "edit", edit the code, then top right of the editor is "install"

I hope that makes sense.

@HaraldGithub
Copy link

HaraldGithub commented May 22, 2024

Yes, that make sense and I'm using also HA.

I'll try and report here!

Update:
For me, it doesn't work. I still receive the message: Not enough memory/space.

@nickmcgill
Copy link

I had that initially, then I commented out the "packages" entries and added

esp8266:
  board: esp8285
ota:
logger:

and installed it wirelessly - that's the "minimal" firmware that worked for me.

2nd step was to uncomment the "packages" entries and comment out my additions, then install that.

You will need to set the encryption key to your setting not "xxxxxx" (similarly with the device name)

@HaraldGithub
Copy link

HaraldGithub commented May 22, 2024

Only to make it clear:

Frist I should use this yaml (replaced with my specific key):

substitutions:
name: athom-presence-sensor-xxxxxx
friendly_name: Athom presence 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}
'#' platformio_options:
'#' board_build.ldscript: eagle.flash.2m.ld

esp8266:
board: esp8285
ota:
logger:

api:
encryption:
key: xxxxxxxxxxxxxxxx=

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

than second installation with:

substitutions:
name: athom-presence-sensor-xxxxxx
friendly_name: Athom presence 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}
platformio_options:
board_build.ldscript: eagle.flash.2m.ld

'#'esp8266:
'#' board: esp8285
'#'ota:
'#'logger:

api:
encryption:
key: xxxxxxxxxxxxxxxx=

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

right?

(formation this post is an extra challenge!

@nickmcgill
Copy link

nickmcgill commented May 22, 2024

On the first, do not comment out

  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

because that is what is needed to access more memory (I think).
On the second installation you need to uncomment the "packages" section

You seem to have quotes round the # marks for some reason - they should not be there.
'# is a comment, uncomment by deleting the #'

HTH

@nickmcgill
Copy link

nickmcgill commented May 22, 2024

Formatting:
use

```
text
```

to get the pretty formatting (they are back-ticks)

@HaraldGithub
Copy link

HaraldGithub commented May 22, 2024

Okay than like this:

first:

substitutions:
name: athom-presence-sensor-xxxxxx
friendly_name: Athom presence 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}
 platformio_options:
 board_build.ldscript: eagle.flash.2m.ld

esp8266:
board: esp8285
ota:
logger:

api:
encryption:
key: xxxxxxxxxxxxxxxx=

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

second:

substitutions:
name: athom-presence-sensor-xxxxxx
friendly_name: Athom presence 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}
# platformio_options:
# board_build.ldscript: eagle.flash.2m.ld

#esp8266:
#board: esp8285
#ota:
#logger:

api:
encryption:
key: xxxxxxxxxxxxxxxx=

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

If this is correct, I'll try again.

@nickmcgill
Copy link

nickmcgill commented May 22, 2024

No, second attempt uncomment the packages and platformio sections

substitutions:
name: athom-presence-sensor-xxxxxx
friendly_name: Athom presence 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}
 platformio_options:
   board_build.ldscript: eagle.flash.2m.ld

#esp8266:
#board: esp8285
#ota:
#logger:

api:
encryption:
key: xxxxxxxxxxxxxxxx=

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

The indentations have disappeared - they need to be correct too

@HaraldGithub
Copy link

Thank you, now it work's for me!

@nickmcgill
Copy link

Thank you, now it work's for me!

Yay!

@jpettitt
Copy link

So I did a build using the 2 step method above and it worked, however any attempt to send another build fails with this error

INFO Connecting to 192.168.203.70
INFO Uploading /data/build/athom-presence-sensor-9cee44/.pioenvs/athom-presence-sensor-9cee44/firmware.bin (612256 bytes)
INFO Compressed to 414762 bytes
ERROR Error binary size: Unknown error from ESP

Unless I reboot the device first.

I also noticed that it's still saying I obnly have 1M of flash despite the board_build.ldscript: eagle.flash.2m.ld

HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.2.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
|-- Wire @ 1.0
|-- ArduinoJson @ 6.18.5
RAM:   [=====     ]  49.1% (used 40256 bytes from 81920 bytes)
Flash: [======    ]  58.2% (used 608105 bytes from 1044464 bytes)

What am I missing?

Config I'm using:

substitutions:
  name: athom-presence-sensor-9cee44
  friendly_name: Athom Presence Dining Room
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}
  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

api:
  encryption:
    key: xxxxxxxxxxxx


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

@nickmcgill
Copy link

I'm getting the same reported 1M flash, and initially got errors on subsequent install attempts.
It now installs every time.
I've no idea what's going on.

@propi62
Copy link

propi62 commented May 23, 2024

for me its not installing. i will wait some time and hope it will install one day.

image

@GVDub
Copy link

GVDub commented May 25, 2024

Looks like this worked for me. Guess we'll know for sure at the next ESPHome update, right?

BTW, don't forget to backup your code before editing and validate your new code before trying to install. Great way to make sure that any copy/paste functions didn't hose you indentations.

@HaraldGithub
Copy link

Also for the new ESP-Update 2024.5.3 I've to do the two steps from above!

@nickmcgill
Copy link

My update went through without any problems.
"Update all" from the ESPHome addon worked first time.

@HaraldGithub
Copy link

How look's your yaml-code before you click "Update all"?

Like this:

substitutions:
  name: athom-presence-sensor-xxxxxx
  friendly_name: Athom presence 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}
#  platformio_options:
#    board_build.ldscript: eagle.flash.2m.ld

#esp8266:
#  board: esp8285
#ota:
#logger:

api:
  encryption:
    key: xxxxxxxxxxxxxxxx=


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

@nickmcgill
Copy link

No, you need to uncomment the following lines

#  platformio_options:
#    board_build.ldscript: eagle.flash.2m.ld

so they are

  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

and keep them like that for all subsequent builds otherwise it will revert to the 1M setting (I believe)

@HaraldGithub
Copy link

Okay, thank you, but I think I've had this like you replay - so we'll see at next Update of ESPhome. ;-)

@GVDub
Copy link

GVDub commented May 28, 2024

Just a data point. OTA updates for 2024.5.4 worked flawlessly for me with the revised YAML code.

@HaraldGithub
Copy link

Same here! :-)

@tarontop
Copy link
Collaborator

It seems that this is the problem

esphome/issues#5214

@tarontop
Copy link
Collaborator

因此,我使用上面的两步方法进行了构建,并且成功了,但是尝试发送另一个构建时会失败并出现此错误

INFO Connecting to 192.168.203.70
INFO Uploading /data/build/athom-presence-sensor-9cee44/.pioenvs/athom-presence-sensor-9cee44/firmware.bin (612256 bytes)
INFO Compressed to 414762 bytes
ERROR Error binary size: Unknown error from ESP

除非我先重新启动设备。

我还注意到,尽管board_build.ldscript: eagle.flash.2m.ld

HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.2.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
|-- Wire @ 1.0
|-- ArduinoJson @ 6.18.5
RAM:   [=====     ]  49.1% (used 40256 bytes from 81920 bytes)
Flash: [======    ]  58.2% (used 608105 bytes from 1044464 bytes)

我错过了什么?

我正在使用的配置:

substitutions:
  name: athom-presence-sensor-9cee44
  friendly_name: Athom Presence Dining Room
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}
  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

api:
  encryption:
    key: xxxxxxxxxxxx


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

https://community.platformio.org/t/esp8266-builder-tools-checkuploadsize-ignores-board-upload-maximum-size-override-in-platformio-ini/17948

@fear
Copy link

fear commented Aug 22, 2024

i had the same problem updating to version 2024.8.0. The solution worked for me but i had to add the ota plattform, otherwise it wouldnt compile

1st Flash

substitutions:
  name: athom-presence-<MAC>
  friendly_name: athom-presence-<LOCATION>

#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}
  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

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

api:
  encryption:
    key: mykey

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  domain: .my.home

2nd flash

substitutions:
  name: athom-presence-<MAC>
  friendly_name: athom-presence-<LOCATION>
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}
  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

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

api:
  encryption:
    key: mykey


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  domain: .my.home

@RyanWor
Copy link

RyanWor commented Sep 24, 2024

I had to do this in two steps. First ota update with

substitutions:
  name: athom-presence-sensor-xxxxxx
  friendly_name: Athom presence 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}
  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

esp8266:
  board: esp8285
ota:
logger:

api:
  encryption:
    key: xxxxxxxxxxxxxxxx=


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

Second ota update:

substitutions:
  name: athom-presence-sensor-xxxxxx
  friendly_name: Athom presence 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}
  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

#esp8266:
#  board: esp8285
#ota:
#logger:

api:
  encryption:
    key: xxxxxxxxxxxxxxxx=


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

This works for me. I couldn't update in one go. I assume that the existing firmware was compiled for a 1 Mb chip so rejected the modified upgrade. I could be wrong!

Sorry about the multiple edits, struggling with formatting (rtfm!)

This solution worked perfectly for me as well. Thank you!

@hevel86
Copy link

hevel86 commented Oct 3, 2024

i had the same problem updating to version 2024.8.0. The solution worked for me but i had to add the ota plattform, otherwise it wouldnt compile

1st Flash

substitutions:
  name: athom-presence-<MAC>
  friendly_name: athom-presence-<LOCATION>

#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}
  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

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

api:
  encryption:
    key: mykey

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  domain: .my.home

2nd flash

substitutions:
  name: athom-presence-<MAC>
  friendly_name: athom-presence-<LOCATION>
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}
  platformio_options:
    board_build.ldscript: eagle.flash.2m.ld

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

api:
  encryption:
    key: mykey


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  domain: .my.home

This still did not work for me. I had to flash the stock firmware first, and then it allowed me to flash the latest. However, I am still having to flash the stock firmware each time I want to update.

@marcosikkens
Copy link

I did an update with the usb cable which worked perfectly a couple of months ago. I thought after that the new updates would work perfectly again. But the next time the normal ota update would fail with the same error as above.

I am still confused as why this happens. Does the size of the package only fail on the ota update proces?

Would be nice if this was actually fixed!

@marcosikkens
Copy link

So i tried the way hevel86 mentioned and it does indeed work for a single update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests