Today I wanted to add a wemos d1 mini with ds18b20 temperature sensors to home assistant. So, after installing the add-on I fired off the compilation for my new device (just the default config).
However a few minutes into the compilation home assistant just crashed.
From google I found the following 2 pages.
1: My issue.
whenever I try to install a .yaml file HA gets unresponsive.
the log is showing this:
INFO Reading configuration /config/esphome/slimmelezer.yaml...
INFO Generating C++ source...
INFO Core config or version changed, cleaning build files...
INFO Deleting /data/slimmelezer/.pioenvs
INFO Deleting /data/slimmelezer/.piolibdeps
INFO Compiling app...
INFO Running: platformio run -d /config/esphome/slimmelezer
Processing slimmelezer (board: d1_mini; framework: arduino; platform: platformio/espressif…
2: Looks quite similar
opened 08:14AM - 19 Jan 22 UTC
closed 12:09AM - 27 Oct 22 UTC
Project: Home Assistant Addon
### The problem
Every time after ESPHome is updated and i initiate a firmware u… pgrade on end device, Home Assistant core instance crashes without notice. This only seems to happen if full compile is needed, not when firmware itself is at the latest version.
Is this due to RAM constraints of Raspberry Pi 3B+ or is something else in play?
### Which version of ESPHome has the issue?
2022.1.0
### What type of installation are you using?
Home Assistant Add-on
### Which version of Home Assistant has the issue?
core-2021.12.7
### What platform are you using?
ESP8266
### Board
nodemcu
### Component causing the issue
core
### Example YAML snippet
_No response_
### Anything in the logs that might be useful for us?
```txt
22-01-19 09:04:30 INFO (SyncWorker_3) [supervisor.docker.interface] Updating image ghcr.io/esphome/esphome-hassio-armv7:2021.12.3 to ghcr.io/esphome/esphome-hassio-armv7:2022.1.0
22-01-19 09:04:30 INFO (SyncWorker_3) [supervisor.docker.interface] Downloading docker image ghcr.io/esphome/esphome-hassio-armv7 with tag 2022.1.0.
22-01-19 09:05:41 INFO (SyncWorker_3) [supervisor.docker.interface] Stopping addon_15ef4d2f_esphome application
22-01-19 09:05:43 INFO (SyncWorker_3) [supervisor.docker.interface] Cleaning addon_15ef4d2f_esphome application
22-01-19 09:05:43 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.9/site-packages/sentry_sdk/integrations/aiohttp.py", line 121, in sentry_app_handle
reraise(*_capture_exception(hub))
File "/usr/local/lib/python3.9/site-packages/sentry_sdk/_compat.py", line 54, in reraise
raise value
File "/usr/local/lib/python3.9/site-packages/sentry_sdk/integrations/aiohttp.py", line 111, in sentry_app_handle
response = await old_handle(self, request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 139, in system_validation
return await handler(request)
File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 205, in token_validation
return await handler(request)
File "/usr/src/supervisor/supervisor/api/utils.py", line 65, in wrap_api
answer = await method(api, *args, **kwargs)
File "/usr/src/supervisor/supervisor/api/addons.py", line 408, in stats
stats: DockerStats = await addon.stats()
File "/usr/src/supervisor/supervisor/addons/addon.py", line 674, in stats
return await self.instance.stats()
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/supervisor/supervisor/docker/interface.py", line 536, in _stats
stats = docker_container.stats(stream=False)
File "/usr/local/lib/python3.9/site-packages/docker/models/containers.py", line 422, in stats
return self.client.api.stats(self.id, **kwargs)
File "/usr/local/lib/python3.9/site-packages/docker/utils/decorators.py", line 19, in wrapped
return f(self, resource_id, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/docker/api/container.py", line 1139, in stats
return self._result(self._get(url, params={'stream': False}),
File "/usr/local/lib/python3.9/site-packages/docker/api/client.py", line 277, in _result
return response.json()
File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 910, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
22-01-19 09:05:43 INFO (MainThread) [supervisor.addons] Add-on '15ef4d2f_esphome' successfully updated
22-01-19 09:05:45 INFO (SyncWorker_2) [supervisor.docker.interface] Cleanup images: ['ghcr.io/esphome/esphome-hassio-armv7:2021.12.3']
22-01-19 09:05:54 INFO (SyncWorker_0) [supervisor.docker.addon] Starting Docker add-on ghcr.io/esphome/esphome-hassio-armv7 with version 2022.1.0
22-01-19 09:06:52 INFO (MainThread) [supervisor.api.middleware.security] /network/info access from a0d7b954_ssh
22-01-19 09:06:52 INFO (MainThread) [supervisor.api.middleware.security] /network/info access from a0d7b954_ssh
22-01-19 09:06:52 INFO (MainThread) [supervisor.api.middleware.security] /host/info access from a0d7b954_ssh
22-01-19 09:06:52 INFO (MainThread) [supervisor.api.middleware.security] /core/info access from a0d7b954_ssh
22-01-19 09:06:59 INFO (MainThread) [supervisor.api.middleware.security] /network/info access from a0d7b954_ssh
22-01-19 09:06:59 INFO (MainThread) [supervisor.api.middleware.security] /network/info access from a0d7b954_ssh
22-01-19 09:06:59 INFO (MainThread) [supervisor.api.middleware.security] /host/info access from a0d7b954_ssh
22-01-19 09:07:00 INFO (MainThread) [supervisor.api.middleware.security] /core/info access from a0d7b954_ssh
22-01-19 09:09:08 WARNING (MainThread) [supervisor.homeassistant.websocket] Connection is closed
22-01-19 09:09:17 WARNING (MainThread) [supervisor.misc.tasks] Watchdog miss API response from Home Assistant
22-01-19 09:09:32 WARNING (MainThread) [supervisor.misc.tasks] Watchdog found a problem with Home Assistant Docker!
22-01-19 09:09:33 INFO (SyncWorker_7) [supervisor.docker.interface] Starting homeassistant
22-01-19 09:09:34 INFO (MainThread) [supervisor.homeassistant.core] Wait until Home Assistant is ready
22-01-19 09:10:12 INFO (MainThread) [supervisor.resolution.evaluate] Starting system evaluation with state CoreState.RUNNING
22-01-19 09:10:12 INFO (MainThread) [supervisor.resolution.evaluate] System evaluation complete
```
### Additional information
_No response_
So from what I understood is that a Pi 3 simply does not have enough RAM to compile esphome. Now I could try to increase the SWAP space as described here but that does not “feel” right.
Increasing the swapfile size (especially on a USB SSD attached to my test RPi 3B) is pretty typical when trying to get a Linux box to perform and generally be more stable…
After hanging around on this GitHub issue and watching the progress, I believe there’s a simple and repeatable way to increase the swapfile size.
This solution will survive reboots and upgrades. You also never have to actually open the shell itself.
Please keep in mind that this is strictly for HA OS not Raspberry Pi OS aka…
Can someone tell me how I can compile this or do I simply have to wait for my home assistant yellow and place my Pi 4 with 4GB or RAM in order to make this work?
The equipment I have:
Chromebook (with Linux and Android)
Windows laptop
Pi 2
Can I run the compilation on one of those or do I really have to wait?
nickrout
(Nick Rout)
August 7, 2022, 11:26am
2
You can use the chromebook or the windows laptop.
bkbartk
(Bkbartk)
August 7, 2022, 11:37am
3
personally I do increase the swap file with 2GB, and yes, I’m waiting for the yellow as well
before that, I compiled with windows, that was about a year ago, So I can’t give you any hints right now.
but it’s possible
What I know is, Increasing the swap file and deploying from HA is way easier.
1 Like
Hi,
I have the same challenge: HA with ESPHome running on RPi 3 with 1 Gb RAM and a Chromebook with linux. Thought to find a solution to ESPHome crashing HA here…
Is there a solution?
nickrout
(Nick Rout)
December 21, 2024, 9:00pm
5
Have you tried increasing your swap?
Also try setting compile_process_limit to 1
I did set compile_process_limit to 1 and was able to compile twice but ran into HA hanging after that multiple times. Did not increase swap because I preferred to try compiling on my Chromebook which succeeded, As I could not find clear instructions how to do so I will share what I did:
Set up Linux on your Chromebook
Start the linux console
To install the esphome package in a python virtual environment:
Make sure you have python3-full installed
Create a directory for your virtual environment(s) if it does not exist yet. Lets call it “path/to/venv”
Create a dedicated virtual environment for esphome:
python3 -m venv path/to/venv/esphome
Change directory into the new virtual environment:
cd path/to/venv/esphome
Install esphome in the virtual environment, using the venv’s pip3:
bin/pip3 install esphome
You can now run esphome in the venv:
bin/python bin/esphome --help
To make esphome easily accessible from any directory:
Create a “bin” directory in your home directory if it does’nt exist
Ensure this bin directory is on PATH, for instance by logging out and in
Create a file in the bin directory called “esphome” with the following contents:
#!/bin/bash
/full/path/to/venv/esphome/bin/python /full/path/to/venv/esphome/bin/esphome "$@"
make this script executable:
sudo chmod u+x esphome
Now you can start using esphome:
By making esphome a bash script in a directory on PATH (~/bin) it can be executed from anywhere. The yaml file you want to compile can thus be stored anywhere.
Navigate to your directory of choice, create a yaml file here and do what you want with esphome, for instance:
esphome -h
esphome config my_first.yaml
esphome run my_first.yaml