Proxy ESPHome trough Home Assistant
This commit is contained in:
parent
df874049af
commit
aeb4c4c4da
3 changed files with 34 additions and 2 deletions
|
@ -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=";
|
||||
};
|
||||
}
|
87
machines/aresix/modules/home-assistant/default.nix
Normal file
87
machines/aresix/modules/home-assistant/default.nix
Normal file
|
@ -0,0 +1,87 @@
|
|||
{
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [inputs.tg-ha-door.nixosModules.tg-ha-door];
|
||||
|
||||
clan.core.vars.generators.tg-ha-door = {
|
||||
prompts.telegram-bot-token = {
|
||||
description = "Telegram token for the tg-ha-door bot";
|
||||
type = "hidden";
|
||||
};
|
||||
|
||||
prompts.home-assistant-auth-token = {
|
||||
description = "Home Assistant token tg-ha-door will use to connect to the instance";
|
||||
type = "hidden";
|
||||
};
|
||||
|
||||
files.credentials-file.secret = true;
|
||||
script = ''
|
||||
{
|
||||
echo "TG_BOT_TOKEN=$(<$prompts/telegram-bot-token)"
|
||||
echo "HA_AUTH_TOKEN=$(<$prompts/home-assistant-auth-token)"
|
||||
} > $out/credentials-file
|
||||
'';
|
||||
};
|
||||
|
||||
services.tg-ha-door = {
|
||||
enable = true;
|
||||
credentialsFile = config.clan.core.vars.generators.tg-ha-door.files.credentials-file.path;
|
||||
settings = {
|
||||
TG_KEY_CHAT_ID = "-1001455284010";
|
||||
TG_LOG_CHAT_ID = "-1001359679497";
|
||||
HA_URL = "http://[::1]:8123";
|
||||
HA_DOOR_ENTITY_ID = "cover.puerta_verde";
|
||||
DOOR_OPEN_CLOSE_TIME = 60;
|
||||
};
|
||||
};
|
||||
|
||||
services.esphome = {
|
||||
enable = true;
|
||||
address = "::1"; # Proxied trough home assistant
|
||||
};
|
||||
|
||||
services.home-assistant = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
extraComponents = [
|
||||
# Components required to complete the onboarding
|
||||
"analytics"
|
||||
"google_translate"
|
||||
"met"
|
||||
"radio_browser"
|
||||
"shopping_list"
|
||||
# Recommended for fast zlib compression
|
||||
# https://www.home-assistant.io/integrations/isal
|
||||
"isal"
|
||||
|
||||
# Additional components
|
||||
"esphome"
|
||||
"mobile_app"
|
||||
];
|
||||
customComponents = [(pkgs.callPackage ./custom_components/panel_proxy.nix {})];
|
||||
config = {
|
||||
panel_proxy = {
|
||||
esphome = {
|
||||
title = "ESPHome Dashboard";
|
||||
icon = "mdi:chip";
|
||||
url = "http://[::1]:6052/";
|
||||
require_admin = true;
|
||||
};
|
||||
};
|
||||
|
||||
http = {
|
||||
trusted_proxies = ["::1"];
|
||||
use_x_forwarded_for = true;
|
||||
};
|
||||
|
||||
default_config = {};
|
||||
|
||||
"automation ui" = "!include automations.yaml";
|
||||
"scene ui" = "!include scenes.yaml";
|
||||
"script ui" = "!include scripts.yaml";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue