Cannot use esphome on docker installation of HA

I have a docker compose file:
version: ‘3.0’

services:
  portainer:
    container_name: portainer
    image: portainer/portainer-ce
    restart: always
    ports:
      - "9000:9000/tcp"
    environment:
      - TZ=Europe/Rome
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /opt/portainer:/data
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /opt/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
    restart: unless-stopped
    privileged: true
    network_mode: host
  esphome:
    container_name: esphome
    image: esphome/esphome
    volumes:
      - /opt/esphome/config:/config
    restart: always
    privileged: true
    network_mode: host

I’m able to see the esphome page at <local.IP>:6052 but i struggle with adding that to HA panel, i found something on internet and add:

panel_iframe:
esphome:
title: “ESPHome”
url: “https://192.168.1.10:6052
icon: “mdi:network”

to my configuration.yaml of home assistant container, but doesen’t work. Someone can help?

I don’t think iframe will connect to ssl without valid certificate. It definitely won’t work outside your local network

Is HA in docker also? You should use docker network and connect using Hostname:port of container, but again, this won’t work for iframe

Also, look into docker and macvlans. It is far superior to using host network as you can give unique IP address / mac on your network and mdns works.

EDIT

I couldn’t find iframe. I think it was deprecated.

I add webpages as dashboards. This can be
Found under settings>>dashboards

Or maybe webpage card also available in ui

Pretty sure both need ssl cert.

If you are just adding the esp devices, add the integration under settings>>devices&services>>add integration

I used to have similar setup with my dockerised HA and ESPHome.

The snippet you put into your configuration is almost identical to what I had…

# iframe panels
panel_iframe:
  router:
    title: "ESPHome"
    url: "http://<ESPHOME HOST>:6052"
    icon: mdi:chip

This worked nicely, until I switched HA to using SSL… :frowning:
The iframe will not load a non-SSL page inside an SSL page. And ESPHome does not support SSL.
You could probably make it work using a reverse proxy to handle the SSL, but I have not tried this.
Cheers.

See here

Hello,

do you have all in place, proxy certificates etc… for https?
If not in docker it will work with http://your_ip:6052.