nixos-configuration/hosts/iron/services/home-assistant.nix
2024-01-13 17:40:56 +00:00

122 lines
3.3 KiB
Nix

args@{ lib, pkgs, config, custom-utils, ... }:
let
ports = import ../ports.nix args;
in
{
services.home-assistant = {
enable = true;
lovelaceConfig = {
title = "Home";
views = [
{
path = "default_view";
title = "Home";
cards = [
{
type = "entities";
entities = [
"switch.circadian_lighting_circadian_lighting"
];
}
{
title = "Eingang";
type = "entities";
entities = [
{
entity = "light.eingang_deckenleuchte_deckenleuchte";
name = "Deckenleuchte";
}
];
}
{
name = "Esstisch";
type = "entities";
entities = [
{
entity = "light.yeelight_meteorite_ambient_light";
name = "Ambient light";
}
{
entity = "light.yeelight_meteorite_ceiling_light";
name = "Ceiling light";
}
{
entity = "light.yeelight_meteorite_night_light";
name = "Night light";
}
];
}
];
}
];
};
extraComponents = [
# See https://www.home-assistant.io/integrations
"esphome"
];
customComponents = [
pkgs.home-assistant-custom-components.circadian_lighting
];
lovelaceConfigWritable = false;
configWritable = false;
config = {
http = {
server_host = [ "127.0.0.1" ];
server_port = ports.home-assistant.tcp;
use_x_forwarded_for = true;
trusted_proxies = [ "127.0.0.1" ];
};
homeassistant = {
unit_system = "metric";
time_zone = "Europe/Berlin";
temperature_unit = "C";
longitude = config.location.longitude;
latitude = config.location.latitude;
};
default_config = { };
circadian_lighting = { };
switch = [
{
platform = "circadian_lighting";
lights_ct = [
"light.yeelight_meteorite_ceiling_light"
"light.eingang_deckenleuchte_deckenleuchte"
"light.led_panel_schreibtisch_panel"
"light.kueche_leiste_led_light"
];
min_brightness = 20;
}
];
automation = [
{
alias = "Waschmaschine fertig Benachrichtigung";
trigger = {
platform = "state";
entity_id = "sensor.waschmaschine_aktueller_vorgang";
to = "Knitterschutz/Ende";
};
action = [
{
service = "notify.mobile_app_shift6mq";
data = {
message = "Die Waschmaschine hat das Programm beendet.";
title = "Wäsche fertig";
};
}
];
}
];
};
};
services.nginx.virtualHosts."hass.jalr.de" = {
enableACME = true;
forceSSL = true;
kTLS = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString ports.home-assistant.tcp}/";
recommendedProxySettings = true;
proxyWebsockets = true;
};
};
}