service/home-assistant: add esphome

This commit is contained in:
Felix Buehler 2023-11-26 16:27:53 +01:00
parent bd039d6581
commit 92047a8207

View file

@ -80,7 +80,8 @@ in
};
config = lib.mkIf cfg.enable {
services.home-assistant = {
services = {
home-assistant = {
enable = true;
inherit (cfg) package;
@ -112,7 +113,7 @@ in
] ++ cfg.extraComponents;
};
services.prometheus.scrapeConfigs = [
prometheus.scrapeConfigs = [
{
job_name = "home-assistant";
metrics_path = "/api/prometheus";
@ -127,6 +128,9 @@ in
}
];
esphome.enable = true;
};
my.services.prometheus.rules = {
homeassistant = {
condition = ''homeassistant_entity_available{domain="persistent_notification", entity!~"persistent_notification.http_login|persistent_notification.recorder_database_migration"} >= 0'';
@ -147,14 +151,35 @@ in
};
};
}
{
subdomain = "esphome";
inherit (config.services.esphome) port;
extraConfig = {
locations."/" = {
proxyWebsockets = true;
};
};
}
];
webapps.apps.home-assistant = {
webapps.apps = {
home-assistant = {
dashboard = {
name = "Home-Automation";
category = "infra";
icon = "house-signal";
url = "https://automation.${domain}";
method = "get";
};
};
esphome = {
dashboard = {
name = "Home-Firmware";
category = "infra";
icon = "house-laptop";
url = "https://esphome.${domain}";
method = "get";
};
};
};
};