2018-10-16 22:34:46 +00:00
|
|
|
{ pkgs, lib, config, ... }:
|
2018-09-18 00:16:12 +00:00
|
|
|
# Ideas:
|
|
|
|
## wake-on-lan server
|
2020-02-04 17:26:59 +00:00
|
|
|
##
|
2018-09-13 20:29:29 +00:00
|
|
|
let
|
2020-11-18 21:23:33 +00:00
|
|
|
prefix = (import ./lib).prefix;
|
2019-03-06 15:42:52 +00:00
|
|
|
hassdir = "/var/lib/hass";
|
2021-03-09 21:16:33 +00:00
|
|
|
unstable = import <nixpkgs-unstable> {};
|
2021-03-08 22:41:47 +00:00
|
|
|
|
|
|
|
|
2018-09-13 20:29:29 +00:00
|
|
|
in {
|
2018-09-17 19:52:41 +00:00
|
|
|
imports = [
|
2021-03-08 22:41:47 +00:00
|
|
|
./nginx.nix
|
2018-09-17 19:52:41 +00:00
|
|
|
./mqtt.nix
|
2021-03-08 22:41:47 +00:00
|
|
|
./signal-rest
|
2020-11-18 21:23:33 +00:00
|
|
|
|
|
|
|
# hass config
|
2021-04-04 08:24:35 +00:00
|
|
|
./zigbee2mqtt.nix
|
2020-11-18 21:23:33 +00:00
|
|
|
# ./multi/flurlicht.nix
|
|
|
|
./multi/kurzzeitwecker.nix
|
|
|
|
./multi/the_playlist.nix
|
2020-12-30 10:02:21 +00:00
|
|
|
# ./multi/fliegen-couter.nix
|
2020-11-18 22:57:59 +00:00
|
|
|
|
2020-11-18 21:23:33 +00:00
|
|
|
./device_tracker/openwrt.nix
|
2021-12-04 16:34:25 +00:00
|
|
|
./device_tracker/tile.nix
|
2020-11-18 22:57:59 +00:00
|
|
|
|
2020-11-18 21:23:33 +00:00
|
|
|
./sensor/outside.nix
|
2020-11-18 22:57:59 +00:00
|
|
|
|
2020-11-18 21:23:33 +00:00
|
|
|
./calendar/nextcloud.nix
|
2020-11-18 22:57:59 +00:00
|
|
|
|
2022-01-30 22:51:32 +00:00
|
|
|
./media/firetv.nix
|
|
|
|
./media/sonos.nix
|
|
|
|
./media/remote_sound_wohnzimmer.nix
|
2022-06-06 19:07:52 +00:00
|
|
|
./media/remote_sound_arbeitszimmer.nix
|
2022-01-30 22:51:32 +00:00
|
|
|
|
|
|
|
./automation/check-in.nix
|
2021-03-08 22:41:47 +00:00
|
|
|
./automation/fenster_auf.nix
|
2020-11-18 21:23:33 +00:00
|
|
|
./automation/firetv_restart.nix
|
2020-11-19 00:39:10 +00:00
|
|
|
./automation/light_buttons.nix
|
2020-12-30 10:02:21 +00:00
|
|
|
./automation/wohnzimmer_rf_fernbedienung.nix
|
2022-06-06 19:07:52 +00:00
|
|
|
# ./automation/ladestecker_timer.nix
|
2021-10-01 16:50:13 +00:00
|
|
|
./automation/flurlicht.nix
|
2022-06-06 19:07:52 +00:00
|
|
|
./automation/giesskanne.nix
|
2021-05-15 11:13:13 +00:00
|
|
|
./automation/pflanzen_giessen_erinnerung.nix
|
2022-01-30 22:51:32 +00:00
|
|
|
./automation/urlaub.nix
|
2021-03-08 22:41:47 +00:00
|
|
|
./automation/moodlight.nix
|
2022-01-30 22:51:32 +00:00
|
|
|
./automation/shutdown_button.nix
|
2020-11-18 22:57:59 +00:00
|
|
|
|
2020-12-30 10:02:21 +00:00
|
|
|
./light/arbeitszimmer.nix
|
|
|
|
./light/schlafzimmer.nix
|
|
|
|
./light/wohnzimmer.nix
|
2022-01-30 22:51:32 +00:00
|
|
|
|
|
|
|
./tts/google.nix
|
2018-09-17 19:52:41 +00:00
|
|
|
];
|
2019-03-06 15:42:52 +00:00
|
|
|
|
2018-09-13 20:29:29 +00:00
|
|
|
services.home-assistant = {
|
2022-01-30 22:51:32 +00:00
|
|
|
package = (pkgs.home-assistant.overrideAttrs (old: {
|
2021-03-08 22:41:47 +00:00
|
|
|
doInstallCheck = false;
|
|
|
|
})).override {
|
2022-01-30 22:51:32 +00:00
|
|
|
extraPackages = p: [
|
|
|
|
(p.callPackage ./deps/dwdwfsapi.nix {})
|
2022-06-10 19:37:49 +00:00
|
|
|
# (p.callPackage ./signal-rest/pkg.nix {})
|
2022-06-06 19:07:52 +00:00
|
|
|
(p.callPackage ./deps/pykodi.nix {})
|
2021-05-15 11:13:13 +00:00
|
|
|
];
|
2021-03-08 22:41:47 +00:00
|
|
|
};
|
|
|
|
|
2018-09-13 20:29:29 +00:00
|
|
|
config = {
|
2020-09-16 20:24:12 +00:00
|
|
|
influxdb = {
|
|
|
|
database = "ham";
|
2020-10-23 19:22:32 +00:00
|
|
|
host = "localhost";
|
2020-09-16 20:24:12 +00:00
|
|
|
tags = {
|
|
|
|
instance = "omo";
|
|
|
|
source = "hass";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-05-21 08:58:00 +00:00
|
|
|
config = {};
|
2018-09-13 20:29:29 +00:00
|
|
|
homeassistant = {
|
|
|
|
name = "Home"; time_zone = "Europe/Berlin";
|
|
|
|
latitude = "48.7687";
|
|
|
|
longitude = "9.2478";
|
2018-09-18 00:16:12 +00:00
|
|
|
elevation = 247;
|
2021-03-08 22:41:47 +00:00
|
|
|
auth_providers = [
|
|
|
|
{ type = "trusted_networks";
|
|
|
|
trusted_networks = [ "192.168.1.0/24" ];
|
|
|
|
allow_bypass_login = true;
|
|
|
|
}
|
|
|
|
{ type = "homeassistant"; }
|
|
|
|
];
|
2018-09-13 20:29:29 +00:00
|
|
|
};
|
2020-02-24 15:56:42 +00:00
|
|
|
discovery = {};
|
2018-09-18 00:16:12 +00:00
|
|
|
conversation = {};
|
|
|
|
history = {};
|
|
|
|
logbook = {};
|
2020-03-13 09:41:23 +00:00
|
|
|
logger = {
|
|
|
|
default = "info";
|
|
|
|
};
|
2020-11-18 21:23:33 +00:00
|
|
|
rest_command = {};
|
2020-10-23 19:22:32 +00:00
|
|
|
api = {};
|
2021-04-04 08:24:35 +00:00
|
|
|
esphome = {}; # fails
|
2020-10-23 19:22:32 +00:00
|
|
|
camera = [];
|
2021-03-08 22:41:47 +00:00
|
|
|
#telegram_bot = [
|
|
|
|
# # secrets file: {
|
|
|
|
# # "platform": "broadcast",
|
|
|
|
# # "api_key": "", # talk to Botfather /newbot
|
|
|
|
# # "allowed_chat_ids": [ ID ] # curl -X GET # https://api.telegram.org/bot<YOUR_API_TOKEN>/getUpdates
|
|
|
|
# # }
|
|
|
|
# (builtins.fromJSON
|
|
|
|
# (builtins.readFile <secrets/hass/telegram-bot.json>))
|
|
|
|
#];
|
2020-02-04 17:26:59 +00:00
|
|
|
notify = [
|
2021-03-08 22:41:47 +00:00
|
|
|
#{
|
|
|
|
# platform = "telegram";
|
|
|
|
# name = "telegrambot";
|
|
|
|
# chat_id = builtins.elemAt
|
|
|
|
# (builtins.fromJSON (builtins.readFile
|
|
|
|
# <secrets/hass/telegram-bot.json>)).allowed_chat_ids 0;
|
|
|
|
#}
|
2020-02-04 17:26:59 +00:00
|
|
|
];
|
2018-09-18 00:16:12 +00:00
|
|
|
sun.elevation = 247;
|
|
|
|
recorder = {};
|
|
|
|
mqtt = {
|
|
|
|
broker = "localhost";
|
2020-03-03 20:12:51 +00:00
|
|
|
discovery = true; #enable esphome discovery
|
|
|
|
discovery_prefix = "homeassistant";
|
2018-09-18 00:16:12 +00:00
|
|
|
port = 1883;
|
|
|
|
client_id = "home-assistant";
|
|
|
|
username = "hass";
|
2018-10-16 22:34:46 +00:00
|
|
|
password = lib.removeSuffix "\n" (builtins.readFile <secrets/mqtt/hass>);
|
2018-09-18 00:16:12 +00:00
|
|
|
keepalive = 60;
|
|
|
|
protocol = 3.1;
|
|
|
|
birth_message = {
|
2020-02-04 17:26:59 +00:00
|
|
|
topic = "${prefix}/hass/tele/LWT";
|
2018-09-18 00:16:12 +00:00
|
|
|
payload = "Online";
|
|
|
|
qos = 1;
|
|
|
|
retain = true;
|
|
|
|
};
|
|
|
|
will_message = {
|
2020-02-04 17:26:59 +00:00
|
|
|
topic = "${prefix}/hass/tele/LWT";
|
2018-09-18 00:16:12 +00:00
|
|
|
payload = "Offline";
|
|
|
|
qos = 1;
|
|
|
|
retain = true;
|
|
|
|
};
|
|
|
|
};
|
2022-06-06 19:07:52 +00:00
|
|
|
#luftdaten = {
|
|
|
|
# show_on_map = true;
|
|
|
|
# sensor_id = 10529;
|
|
|
|
# sensors.monitored_conditions = [ "P1" "P2" ];
|
|
|
|
#};
|
2020-03-03 20:12:51 +00:00
|
|
|
#binary_sensor =
|
|
|
|
# flurlicht.binary_sensor;
|
2021-05-15 11:13:13 +00:00
|
|
|
|
2018-09-13 20:29:29 +00:00
|
|
|
sensor = [
|
2021-05-15 11:13:13 +00:00
|
|
|
{ platform = "speedtestdotnet";
|
|
|
|
scan_interval.hours = 6;
|
2020-02-24 15:55:34 +00:00
|
|
|
monitored_conditions = [ "ping" "download" "upload" ];
|
|
|
|
}
|
2018-09-13 20:29:29 +00:00
|
|
|
# https://www.home-assistant.io/cookbook/automation_for_rainy_days/
|
2020-11-18 21:23:33 +00:00
|
|
|
];
|
2018-09-13 20:29:29 +00:00
|
|
|
frontend = { };
|
2021-03-08 22:41:47 +00:00
|
|
|
http = {
|
|
|
|
use_x_forwarded_for = true;
|
2021-06-06 11:18:37 +00:00
|
|
|
#server_host = "127.0.0.1";
|
|
|
|
server_host = "0.0.0.0";
|
2021-03-08 22:41:47 +00:00
|
|
|
trusted_proxies = [ "127.0.0.1" ];
|
|
|
|
#trusted_proxies = [ "192.168.1.0/24" ];
|
|
|
|
};
|
2020-02-24 15:59:11 +00:00
|
|
|
switch = [];
|
2020-11-18 21:23:33 +00:00
|
|
|
automation = [];
|
|
|
|
script = { };
|
2018-09-13 20:29:29 +00:00
|
|
|
};
|
|
|
|
enable = true;
|
2019-03-06 15:42:52 +00:00
|
|
|
configDir = hassdir;
|
2018-09-13 20:29:29 +00:00
|
|
|
};
|
2019-02-05 21:33:26 +00:00
|
|
|
|
2020-09-16 20:24:12 +00:00
|
|
|
state = [ "/var/lib/hass/known_devices.yaml" ];
|
2018-09-13 20:29:29 +00:00
|
|
|
}
|