mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 09:54:40 +02:00
service/home-assistant: add esphome
This commit is contained in:
parent
bd039d6581
commit
92047a8207
1 changed files with 71 additions and 46 deletions
|
@ -80,7 +80,8 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
services.home-assistant = {
|
services = {
|
||||||
|
home-assistant = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
inherit (cfg) package;
|
inherit (cfg) package;
|
||||||
|
@ -112,7 +113,7 @@ in
|
||||||
] ++ cfg.extraComponents;
|
] ++ cfg.extraComponents;
|
||||||
};
|
};
|
||||||
|
|
||||||
services.prometheus.scrapeConfigs = [
|
prometheus.scrapeConfigs = [
|
||||||
{
|
{
|
||||||
job_name = "home-assistant";
|
job_name = "home-assistant";
|
||||||
metrics_path = "/api/prometheus";
|
metrics_path = "/api/prometheus";
|
||||||
|
@ -127,6 +128,9 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
esphome.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
my.services.prometheus.rules = {
|
my.services.prometheus.rules = {
|
||||||
homeassistant = {
|
homeassistant = {
|
||||||
condition = ''homeassistant_entity_available{domain="persistent_notification", entity!~"persistent_notification.http_login|persistent_notification.recorder_database_migration"} >= 0'';
|
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 = {
|
dashboard = {
|
||||||
name = "Home-Automation";
|
name = "Home-Automation";
|
||||||
category = "infra";
|
category = "infra";
|
||||||
icon = "house-signal";
|
icon = "house-signal";
|
||||||
url = "https://automation.${domain}";
|
url = "https://automation.${domain}";
|
||||||
|
method = "get";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
esphome = {
|
||||||
|
dashboard = {
|
||||||
|
name = "Home-Firmware";
|
||||||
|
category = "infra";
|
||||||
|
icon = "house-laptop";
|
||||||
|
url = "https://esphome.${domain}";
|
||||||
|
method = "get";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue