2019-09-02 11:57:06 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
2019-09-05 23:07:20 +00:00
|
|
|
shackopen = import ./multi/shackopen.nix;
|
|
|
|
wasser = import ./multi/wasser.nix;
|
2020-01-07 15:52:31 +00:00
|
|
|
badair = import ./multi/schlechte_luft.nix;
|
2020-09-16 20:21:53 +00:00
|
|
|
rollos = import ./multi/rollos.nix;
|
2019-09-02 11:57:06 +00:00
|
|
|
in {
|
2019-09-19 19:31:21 +00:00
|
|
|
services.nginx.virtualHosts."hass.shack" = {
|
|
|
|
serverAliases = [ "glados.shack" ];
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://localhost:8123";
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2019-09-02 11:57:06 +00:00
|
|
|
|
2019-09-19 19:31:21 +00:00
|
|
|
proxy_buffering off;
|
|
|
|
'';
|
|
|
|
};
|
2019-09-02 11:57:06 +00:00
|
|
|
};
|
2020-11-17 20:32:24 +00:00
|
|
|
services.home-assistant =
|
|
|
|
{
|
2019-09-02 11:57:06 +00:00
|
|
|
enable = true;
|
2020-11-17 20:32:24 +00:00
|
|
|
package = pkgs.home-assistant.override {
|
2019-09-02 11:57:06 +00:00
|
|
|
extraPackages = ps: with ps; [
|
2020-02-20 13:00:17 +00:00
|
|
|
python-forecastio jsonrpc-async jsonrpc-websocket mpd2 pkgs.picotts
|
2019-09-02 11:57:06 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
autoExtraComponents = true;
|
|
|
|
config = {
|
|
|
|
homeassistant = {
|
2020-01-08 17:42:09 +00:00
|
|
|
name = "Glados";
|
2019-09-02 11:57:06 +00:00
|
|
|
time_zone = "Europe/Berlin";
|
|
|
|
latitude = "48.8265";
|
|
|
|
longitude = "9.0676";
|
|
|
|
elevation = 303;
|
|
|
|
auth_providers = [
|
|
|
|
{ type = "homeassistant";}
|
|
|
|
{ type = "trusted_networks";
|
2019-11-06 23:25:42 +00:00
|
|
|
trusted_networks = [
|
|
|
|
"127.0.0.1/32"
|
|
|
|
"10.42.0.0/16"
|
|
|
|
"::1/128"
|
|
|
|
"fd00::/8"
|
|
|
|
];
|
2019-09-02 11:57:06 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
# https://www.home-assistant.io/components/influxdb/
|
2020-09-08 22:32:10 +00:00
|
|
|
influxdb = {
|
|
|
|
database = "glados";
|
|
|
|
host = "influx.shack";
|
2020-09-16 20:21:53 +00:00
|
|
|
component_config_glob = {
|
|
|
|
"sensor.*particulate_matter_2_5um_concentration".override_measurement = "2_5um particles";
|
|
|
|
"sensor.*particulate_matter_10_0um_concentration".override_measurement ="10um particles";
|
|
|
|
};
|
2020-09-08 22:32:10 +00:00
|
|
|
tags = {
|
|
|
|
instance = "wolf";
|
|
|
|
source = "glados";
|
|
|
|
};
|
|
|
|
};
|
2020-07-22 14:25:00 +00:00
|
|
|
esphome = {};
|
|
|
|
api = {};
|
2019-09-02 11:57:06 +00:00
|
|
|
mqtt = {
|
|
|
|
broker = "localhost";
|
|
|
|
port = 1883;
|
|
|
|
client_id = "home-assistant";
|
|
|
|
keepalive = 60;
|
|
|
|
protocol = 3.1;
|
2020-02-20 13:00:17 +00:00
|
|
|
discovery = true; #enable esphome discovery
|
|
|
|
discovery_prefix = "homeassistant";
|
2019-09-02 11:57:06 +00:00
|
|
|
birth_message = {
|
|
|
|
topic = "glados/hass/status/LWT";
|
|
|
|
payload = "Online";
|
|
|
|
qos = 1;
|
|
|
|
retain = true;
|
|
|
|
};
|
|
|
|
will_message = {
|
|
|
|
topic = "glados/hass/status/LWT";
|
|
|
|
payload = "Offline";
|
|
|
|
qos = 1;
|
|
|
|
retain = true;
|
|
|
|
};
|
|
|
|
};
|
2020-03-13 09:50:18 +00:00
|
|
|
switch =
|
2020-09-16 20:21:53 +00:00
|
|
|
(import ./switch/power.nix)
|
2020-03-13 09:50:18 +00:00
|
|
|
;
|
2020-02-20 13:00:17 +00:00
|
|
|
light = [];
|
2019-09-02 11:57:06 +00:00
|
|
|
media_player = [
|
|
|
|
{ platform = "mpd";
|
2020-01-23 22:52:39 +00:00
|
|
|
name = "lounge";
|
2019-09-02 11:57:06 +00:00
|
|
|
host = "lounge.mpd.shack";
|
|
|
|
}
|
2020-02-19 13:35:53 +00:00
|
|
|
{ platform = "mpd";
|
|
|
|
name = "kiosk";
|
|
|
|
host = "lounge.kiosk.shack";
|
|
|
|
}
|
2019-09-02 11:57:06 +00:00
|
|
|
];
|
2019-09-05 23:07:20 +00:00
|
|
|
|
2019-09-02 11:57:06 +00:00
|
|
|
sensor =
|
2020-02-20 13:00:17 +00:00
|
|
|
(import ./sensors/power.nix)
|
|
|
|
++ (import ./sensors/mate.nix)
|
|
|
|
++ (import ./sensors/darksky.nix { inherit lib;})
|
2020-01-08 09:16:21 +00:00
|
|
|
++ shackopen.sensor
|
2020-09-16 20:21:53 +00:00
|
|
|
++ wasser.sensor
|
2020-02-20 13:00:17 +00:00
|
|
|
;
|
|
|
|
air_quality = (import ./sensors/sensemap.nix );
|
2019-09-05 23:07:20 +00:00
|
|
|
|
2020-02-20 13:00:17 +00:00
|
|
|
binary_sensor =
|
|
|
|
shackopen.binary_sensor
|
|
|
|
++ (import ./sensors/spaceapi.nix)
|
|
|
|
;
|
2019-09-02 11:57:06 +00:00
|
|
|
|
|
|
|
camera = [];
|
|
|
|
|
|
|
|
frontend = { };
|
2019-11-07 08:47:29 +00:00
|
|
|
config = { };
|
2019-09-02 11:57:06 +00:00
|
|
|
http = {
|
|
|
|
base_url = "http://hass.shack";
|
|
|
|
use_x_forwarded_for = true;
|
|
|
|
trusted_proxies = "127.0.0.1";
|
|
|
|
};
|
2019-11-06 23:25:42 +00:00
|
|
|
#conversation = {};
|
2020-07-22 14:25:00 +00:00
|
|
|
# history = {};
|
2020-06-17 07:09:53 +00:00
|
|
|
#logbook = {};
|
2020-07-22 14:25:00 +00:00
|
|
|
logger.default = "info";
|
2020-06-17 07:09:53 +00:00
|
|
|
#recorder = {};
|
2019-09-02 11:57:06 +00:00
|
|
|
tts = [
|
2019-11-07 08:47:29 +00:00
|
|
|
{ platform = "google_translate";
|
2020-01-23 22:52:39 +00:00
|
|
|
service_name = "say";
|
2019-09-02 11:57:06 +00:00
|
|
|
language = "de";
|
2020-01-23 22:52:39 +00:00
|
|
|
cache = true;
|
|
|
|
time_memory = 57600;
|
2019-09-02 11:57:06 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
sun = {};
|
|
|
|
|
2020-01-23 22:52:39 +00:00
|
|
|
automation = wasser.automation
|
|
|
|
++ badair.automation
|
2020-09-16 20:21:53 +00:00
|
|
|
++ rollos.automation
|
2020-01-23 22:52:39 +00:00
|
|
|
++ (import ./automation/shack-startup.nix)
|
2020-07-28 21:59:13 +00:00
|
|
|
++ (import ./automation/party-time.nix)
|
2020-01-08 17:42:09 +00:00
|
|
|
++ (import ./automation/hass-restart.nix);
|
|
|
|
|
2019-09-02 11:57:06 +00:00
|
|
|
device_tracker = [];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|