Pi crashes after firsttime using espHome

Hi,
Busy for two weeks now trying to use a esp32-cam in Home Assistant.
“Use the ESPHome integration” they told me. But it will not work.
Everytime I (re)install the ESPHome AddOn and add my first device, after 1 or 2 minutes the Raspberry Pi5 crashes. A powercycle is the only option than.
I have this same issue on all 3 versions.
I even ordered new ESP32-Cam boards with the newer serial chip.
And is the Pi is back after the powercycle I get an error if I try to reinstall the board. (ESP32-Cam).

The error in the dev version is much larger than in the normal and beta versions. I’ll add it at the bottom.

How can I fix this?

Kind regards,

Emil

============ERROR==============================
INFO ESPHome 2026.1.0-dev
INFO Reading configuration /config/esphome/esp32-cam.yaml…
INFO Generating C++ source…
INFO Setting CONFIG_LWIP_MAX_SOCKETS to 11 (registered: api=4, captive_portal=4, mdns=2, ota=1)
INFO Compiling app… Build path: /data/build/esp32-cam
Processing esp32-cam (board: esp32cam; framework: espidf; platform: https://github.com/pioarduino/platform-espressif32/releases/download/55.03.31-2/platform-espressif32.zip)

HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash

  • contrib-piohome @ 3.4.4
  • framework-espidf @ 3.50501.0 (5.5.1)
  • tool-cmake @ 4.0.3
  • tool-esp-rom-elfs @ 2024.10.11
  • tool-esptoolpy @ 5.1.0
  • tool-mklittlefs @ 3.2.0
  • tool-ninja @ 1.13.1
  • tool-scons @ 4.40801.0 (4.8.1)
  • toolchain-xtensa-esp-elf @ 14.2.0+20241119
    Reading CMake configuration…
    JSONDecodeError: Expecting value: line 1 column 1 (char 0):
    File “/usr/local/lib/python3.12/site-packages/platformio/builder/main.py”, line 173:
    env.SConscript(“$BUILD_SCRIPT”)
    File “/data/cache/platformio/packages/tool-scons/scons-local-4.8.1/SCons/Script/SConscript.py”, line 620:
    return _SConscript(self.fs, *files, **subst_kw)
    File “/data/cache/platformio/packages/tool-scons/scons-local-4.8.1/SCons/Script/SConscript.py”, line 280:
    exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
    File “/data/cache/platformio/platforms/espressif32/builder/main.py”, line 666:
    target_elf = env.BuildProgram()
    File “/data/cache/platformio/packages/tool-scons/scons-local-4.8.1/SCons/Util/envs.py”, line 252:
    return self.method(*nargs, **kwargs)
    File “/usr/local/lib/python3.12/site-packages/platformio/builder/tools/piobuild.py”, line 62:
    env.ProcessProgramDeps()
    File “/data/cache/platformio/packages/tool-scons/scons-local-4.8.1/SCons/Util/envs.py”, line 252:
    return self.method(*nargs, **kwargs)
    File “/usr/local/lib/python3.12/site-packages/platformio/builder/tools/piobuild.py”, line 142:
    env.BuildFrameworks(env.get(“PIOFRAMEWORK”))
    File “/data/cache/platformio/packages/tool-scons/scons-local-4.8.1/SCons/Util/envs.py”, line 252:
    return self.method(*nargs, **kwargs)
    File “/usr/local/lib/python3.12/site-packages/platformio/builder/tools/piobuild.py”, line 352:
    SConscript(env.GetFrameworkScript(name), exports=“env”)
    File “/data/cache/platformio/packages/tool-scons/scons-local-4.8.1/SCons/Script/SConscript.py”, line 684:
    return method(*args, **kw)
    File “/data/cache/platformio/packages/tool-scons/scons-local-4.8.1/SCons/Script/SConscript.py”, line 620:
    return _SConscript(self.fs, *files, **subst_kw)
    File “/data/cache/platformio/packages/tool-scons/scons-local-4.8.1/SCons/Script/SConscript.py”, line 280:
    exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
    File “/data/cache/platformio/platforms/espressif32/builder/frameworks/espidf.py”, line 1780:
    project_codemodel = get_cmake_code_model(
    File “/data/cache/platformio/platforms/espressif32/builder/frameworks/espidf.py”, line 541:
    codemodel = json.load(fp)
    File “/usr/local/lib/python3.12/json/init.py”, line 293:
    return loads(fp.read(),
    File “/usr/local/lib/python3.12/json/init.py”, line 346:
    return _default_decoder.decode(s)
    File “/usr/local/lib/python3.12/json/decoder.py”, line 338:
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File “/usr/local/lib/python3.12/json/decoder.py”, line 356:
    raise JSONDecodeError(“Expecting value”, s, err.value) from None
    ========================== [FAILED] Took 2.75 seconds ==========================

A couple of recommendations:

(1) When you post things like logs or code, use the “< / >” icon to format it for viewing in the forum.

(2) Don’t use the HA ESPHome Device Builder add-on. Compile your ESPHome projects on a development machine like a laptop or desktop:

2 Likes

How much ram do your Pi5 have?

1 Like

8gb, 1.2gb gebruikt…
M2 512 gb ssd

Why are you using the dev version of esphome?

Unless you are doing active development of esphome itself, you probably don’t want that. It might or might not be the cause of the issue you are seeing.

While the docs do suggest using the esphome add on for HA, it is not the only path.

It seems you possibly have two issues. One is your configuration/installation of esphome is not working. Two is your rpi is dying when it shouldn’t. The two problems might be related or they could be independent issues.

If I were faced with this, I would start with installing esphome of a different computer and using the command line.

Start here:
https://esphome.io/guides/installing_esphome/

Note that the installation instructions show adding esphome directly to the root install of Python on your system. This might have been a good solution a decade ago, but I would (and do) use pipx to install it in a virtual environment.

pip install pipx
pipx install esphome 

This will likely give you better performance and definitely better debugging ability.

Can you share a (esphome) yaml you use? That is always useful to see if you limit compiling to x cores (advisable if you want your HA responsible while compiling) :mag: