I moved the ESPHome Device Builder off to a faster machine running in docker. Took me a few minutes to realize that mDNS announcements were not getting to the container.
I figured out two options to get the discovery working, but it left me with a few questions (as I’m no Docker experts at all).
The two options that worked are to either run the container in network_mode: host or to set enable-reflector=yes in /etc/avahi/avahi-daemon.conf.
Questions:
-
Is one option from above better than the other, and why?
-
Is there another (or better) way to get mDNS into the container, e.g. something in the docker-compose.yaml file?
-
Oddly, I have
ESPHOME_DASHBOARD_USE_PING=falsein my docker-compose (I blindly copied from my past notes), but with that false AND no mDNS I’m confused how the Device Builder found any of my on-line devices. Does it work via by looking at the yaml files’ configured host or ip? I guess I’m not understanding how it finds devices. -
Finally, how does the ESPHome device builder determine if a device has already been adopted? I ask because when testing I tried just hiding a device’s config.yaml, but that didn’t make it show up as discoverable.
Thanks.
here's the docker-compose.yaml I'm using:
services:
esphome:
image: ghcr.io/esphome/esphome:latest
container_name: esphome
environment:
- PUID=1000
- PGID=1000
# How does this being false still find devices when mDNS is not available?
- ESPHOME_DASHBOARD_USE_PING=false
- TZ=America/Los_Angeles
volumes:
- ./config:/config
ports:
- 6052:6052
restart: unless-stopped
# Attempt to get mdns down into this container
# This puts the container on the host network, so "ports"
# above doesn't do anything.
# network_mode: host