This project sets up an ESPHome camera interface with HTTPS support using Nginx as a reverse proxy. It uses self-signed certificates for secure access both locally and over your LAN.
- Docker and Docker Compose
- OpenSSL
- Linux/Unix environment (for automatic LAN IP detection)
- Chrome/Chromium-based browser (for certificate management instructions)
-
Clone the repository:
git clone <your-repo-url> cd ESPHome-Camera
-
Generate SSL certificates:
chmod +x generate_certs.sh ./generate_certs.sh
This script will:
- Create a Root CA certificate
- Generate a server certificate signed by the Root CA
- Automatically detect and include your LAN IP in the certificate
- Set appropriate permissions for the certificate files
-
Import the Root CA certificate:
- Download the certificate from
https://<your-lan-ip>:6052/root-ca.crt - Double-click the downloaded
root-ca.crtfile - Click "Install Certificate"
- Select "Local Machine" (requires admin rights)
- Click "Next"
- Select "Place all certificates in the following store"
- Click "Browse"
- Select "Trusted Root Certification Authorities"
- Click "OK", then "Next", then "Finish"
- Restart your browser
- Option 1: Download from the server
- Start the containers (step 4)
- Visit
https://<your-lan-ip>:6052/root-ca.crt - Import the downloaded certificate
- Option 2: Import directly from filesystem
- Open Chrome and go to
chrome://settings/security - Click on "Manage certificates"
- Go to the "Authorities" tab
- Click "Import"
- Select the
certs/root-ca.crtfile (NOT certificate.crt)
- Open Chrome and go to
After importing:
- Check all boxes when prompted and click "OK"
- Restart your browser completely
- Download the certificate from
-
Start the containers:
docker compose up -d
After setup, you can access your ESPHome interface using either:
- Local:
https://localhost:6052 - LAN:
https://<your-lan-ip>:6052
- The certificates are valid for 365 days
- The Root CA certificate is valid for 10 years
- Never share your
root-ca.keyorprivate.keyfiles - The certificates are self-signed and only trusted on devices where you've imported the Root CA
To access the interface from other devices on your network:
- Download the root CA certificate by visiting
https://<your-lan-ip>:6052/root-ca.crt - Import it into the device's certificate store
- Access using
https://<your-lan-ip>:6052
docker-compose.yaml: Container configurationnginx.conf: Nginx reverse proxy configurationgenerate_certs.sh: Certificate generation scriptcerts/: Directory containing SSL certificates (not in git)config/: ESPHome configuration directory
-
Certificate Issues:
- Make sure you've imported
root-ca.crt, notcertificate.crt - Ensure you've checked all trust boxes during import
- Restart your browser completely after importing
- Make sure you've imported
-
Connection Issues:
- Verify the containers are running:
docker compose ps - Check container logs:
docker compose logs - Ensure port 6052 is not blocked by your firewall
- Verify the containers are running:
- Regenerate certificates before they expire (365 days)
- Keep your Root CA certificate safe
- Regularly update your Docker images:
docker compose pull docker compose up -d