Home Assistant and ESPhome in Docker

This is a good start for a Docker setup manual for running everything that is required for a docker setup.
Just a couple notes of differences that I did in my setup.

  1. I have a USB Zigbee unit and Bluetooth adapter, therefore I exposed the usb to the container with the compose file
devices:
  - /dev/ttyUSB0:/dev/ttyUSB0
  - /dev/ttyUSB1:/dev/ttyUSB1
2 Likes

Hi this is a very good tuto. Why do you create a docker compose per docker ? On my side, I have a unique docker compose with all the dockers
Cheers
Phil

2 Likes

That exposing the USBs is very good, I didn’t include it in the tutorial since I haven’t tried it yet for my ESPhome service. But it is useful for setting up new ESPboards. I will surely include it. Thank you for your comment and your contribution!

I hope I understand your question well and I find it very interesting.

Having everything in a single docker compose file is a good option.

But, I use a docker file for each service because I like to manually update my containers without dropping the other. For example, I only want to update ESPHome without stopping Home Assistant. It’s just a habit. Thank you for your question and your contribution!

I do make upgrade on any docker container without stopping any
This is true for esphome, Mariadb, influx, etc ….
Sometimes, I just have some log messages in the HA traces but without any issue
Phil

2 Likes

@Juan_Diego_Tortul - A great guide indeed. Could you pls make a guide for installing HA on Android for 2022? I tried following this guide but got stuck at a point. Would be really helpful to many users who want to run it on their old phones.
Thanks

1 Like

If true, over time I will have more optimal and summarized upgrade steps. I am still studying the method that would be comfortable and safe for me. And so build an update protocol.
What I most wanted to show in the ‘new topic’ is how you can combine the official installation methods and how to backup your previous settings. Without complicating too much (simple to read).
It is for a good start.
At first I had some difficulty porting my HA and ESPHome setup. I’m just looking for others to simplify the concept of moving. Once again, it is only a first step.
On a server there is always a lot to do and improve.
Thank you for all your contributions.
You can share your method or your docker compose. Everything is well received by me!

I wish I could help you, but I’m not familiar with using Android as a server. What step failed you?

Pls check my post here

Would really like someone to help me out as I think I m 70% done.

1 Like

Be patient and at some point you will achieve it or you will have new ideas. Luck!

can u give the method a try on ur Android phone?

Sorry to jump on an old thread, but you can actually manage specific services inside of your compose by specifying them in the command (ex: docker-compose down homeassistant). And bringing up all services with docker-compose upwill only restart those which have changed :slight_smile:

4 Likes

Indeed, there are many ways to manage Docker containers. For example, you can back up data, manage volumes, consumption and images. In this introductory guide to Home Assistant Docker containers, I have tried to use the simplest possible commands based on my experience.

The world of Docker is vast and each user must explore it and adapt it to their needs.
Therefore, it has not been considered appropriate to continue adding commands in this guide.
The decision to have a home automation server in Docker is a great responsibility that requires knowledge, as Home Assistant and ESPHome are very important server.
Each user must assess their situation and deepen their knowledge of container use according to their needs.

Hi,

When you have multiple USB they might swap places.
So I recommend the USB device ID and not the assigned USB port (USBx) because when there are more than 1 USB devices attached on a system reboot assigned USB ports can (and will) change. UDEV can be used also but requires extra work outside the container. Command to show USB devices by ID:

sudo ls -la /dev/serial/by-id

For your docker-container use a logical USB name.

devices:
- /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AK2NEAM6-if00-port0:/dev/ttyUSB_DSMR
2 Likes

Good advice. I have both USB devices exposed as I have both a coral for frigate and a TI zigbee cordinator for ZHA. Can I assume this method will work for both devices?

First question would be “Did you experience it yourself?”

swapping USB port will not happen much, the first time it happened to me last summer I was off course on holiday. Likely my Linux-settings with automatic updates is the root cause why it happened because this process can also initiate a reboot.

I think this is a or mayby the solution to avoid it, so try it out. Your Coral for frigate will be a good “sandbox” and despite you need to recreate this container if you do not change the second part (likely :/dev/ttyUSB2), you do not need to change any Frigate settings. You can always change this later to a more meaningful and non-confusing name.

BTW About

privileged: true

There are topics which advise you not to use this. If I understand it correctly with my NOOBS/DUMMY limited Linix/Docker knowledge your container with this setting will have access to more(/everything?) than the container itself.

This is one of those settings I have had for as long as I can remember, but I don’t remember why I had it enabled. I am in the process of updating this.

Where do I put the fonts required for ESPHome? In my case the Docker data is stored in appdata on UnRaid, but do I store the fonts in the ESPHome folder, the Home Assistant folder or a Font folder in the parent directory?

The ESP32 device tutorial talks about using the File Editor in Home Assistant from Settings/Add-ons to set this up, but I don’t see an add-ons option under settings?

EDIT: Ok, all sorted

I stumbled upon this reading this thread on ESPHome.
This is great :smiley: I ha ve been looking for a solution for ages ! I have two USB dongles on my NUC, one Zigbee and one Z-Wave. Each time the NUC restarts (luckily, not often), they get swapped.
Will try this solution tonite !