Proxy ESPHome trough Home Assistant

This commit is contained in:
Pedro Rey Anca 2025-08-21 17:20:17 +02:00
parent df874049af
commit aeb4c4c4da
Signed by: peprolinbot
GPG key ID: 053EA6E00116533A
3 changed files with 34 additions and 2 deletions

View file

@ -1,7 +1,7 @@
{...}: { {...}: {
imports = [ imports = [
./modules/reverse-proxy.nix ./modules/reverse-proxy.nix
./modules/home-assistant.nix ./modules/home-assistant
./modules/dyndns.nix ./modules/dyndns.nix
./modules/network.nix ./modules/network.nix
]; ];

View file

@ -0,0 +1,18 @@
{
stdenv,
pkgs,
fetchFromGitHub,
buildHomeAssistantComponent,
}:
buildHomeAssistantComponent rec {
owner = "jimparis";
domain = "panel_proxy";
version = "1.0.0";
src = fetchFromGitHub {
owner = "jimparis";
repo = "hass-panel-proxy";
rev = "e5421e013b7aa011609f7e7be9f0c2c017f029df";
sha256 = "sha256-eq1sZmZBpRGOyhDduT40z+xhbq5DD1hgz9jSyKhX8QI=";
};
}

View file

@ -1,6 +1,7 @@
{ {
inputs, inputs,
config, config,
pkgs,
... ...
}: { }: {
imports = [inputs.tg-ha-door.nixosModules.tg-ha-door]; imports = [inputs.tg-ha-door.nixosModules.tg-ha-door];
@ -37,7 +38,10 @@
}; };
}; };
services.esphome.enable = true; services.esphome = {
enable = true;
address = "::1"; # Proxied trough home assistant
};
services.home-assistant = { services.home-assistant = {
enable = true; enable = true;
@ -57,7 +61,17 @@
"esphome" "esphome"
"mobile_app" "mobile_app"
]; ];
customComponents = [(pkgs.callPackage ./custom_components/panel_proxy.nix {})];
config = { config = {
panel_proxy = {
esphome = {
title = "ESPHome Dashboard";
icon = "mdi:chip";
url = "http://[::1]:6052/";
require_admin = true;
};
};
http = { http = {
trusted_proxies = ["::1"]; trusted_proxies = ["::1"];
use_x_forwarded_for = true; use_x_forwarded_for = true;