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-02-04 17:26:59 +00:00
|
|
|
hlib = (import ./lib);
|
|
|
|
prefix = hlib.prefix;
|
|
|
|
tasmota = hlib.tasmota;
|
2020-02-24 15:55:34 +00:00
|
|
|
firetv_stick = "192.168.1.24";
|
2019-03-06 15:42:52 +00:00
|
|
|
hassdir = "/var/lib/hass";
|
2020-02-04 17:26:59 +00:00
|
|
|
zigbee = import ./multi/zigbee2mqtt.nix;
|
2020-02-24 15:55:34 +00:00
|
|
|
flurlicht = import ./multi/flurlicht.nix;
|
|
|
|
kurzzeitwecker = import ./multi/kurzzeitwecker.nix;
|
2020-02-04 17:26:59 +00:00
|
|
|
# switch
|
|
|
|
# automation
|
|
|
|
# binary_sensor
|
|
|
|
# sensor
|
|
|
|
# input_select
|
|
|
|
# timer
|
2018-09-13 20:29:29 +00:00
|
|
|
in {
|
2018-09-17 19:52:41 +00:00
|
|
|
imports = [
|
|
|
|
./mqtt.nix
|
|
|
|
];
|
2019-03-06 15:42:52 +00:00
|
|
|
|
2018-09-13 20:29:29 +00:00
|
|
|
services.home-assistant = {
|
|
|
|
config = {
|
2020-02-04 17:26:59 +00:00
|
|
|
input_select = zigbee.input_select; # dict
|
2020-02-24 15:55:34 +00:00
|
|
|
timer = zigbee.timer // kurzzeitwecker.timer; # dict
|
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;
|
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 = {};
|
|
|
|
tts = [
|
2020-02-04 17:26:59 +00:00
|
|
|
{ platform = "google_translate";
|
|
|
|
language = "de";
|
|
|
|
time_memory = 57600;
|
|
|
|
service_name = "google_say";
|
|
|
|
}
|
2018-09-18 00:16:12 +00:00
|
|
|
];
|
2020-02-04 17:26:59 +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>))
|
|
|
|
];
|
|
|
|
notify = [
|
|
|
|
{
|
|
|
|
platform = "kodi";
|
|
|
|
name = "wohnzimmer";
|
2020-02-24 15:55:34 +00:00
|
|
|
host = firetv_stick;
|
2020-02-04 17:26:59 +00:00
|
|
|
}
|
|
|
|
{
|
|
|
|
platform = "telegram";
|
|
|
|
name = "telegrambot";
|
|
|
|
chat_id = builtins.elemAt
|
|
|
|
(builtins.fromJSON (builtins.readFile
|
|
|
|
<secrets/hass/telegram-bot.json>)).allowed_chat_ids 0;
|
|
|
|
}
|
|
|
|
];
|
2018-09-18 00:16:12 +00:00
|
|
|
sun.elevation = 247;
|
|
|
|
recorder = {};
|
2018-09-13 20:29:29 +00:00
|
|
|
media_player = [
|
|
|
|
{ platform = "kodi";
|
2020-02-24 15:55:34 +00:00
|
|
|
host = firetv_stick;
|
2018-09-13 20:29:29 +00:00
|
|
|
}
|
2020-02-24 15:55:34 +00:00
|
|
|
{ platform = "androidtv";
|
2019-03-06 15:42:52 +00:00
|
|
|
name = "FireTV Stick";
|
2020-02-24 15:55:34 +00:00
|
|
|
device_class = "firetv";
|
|
|
|
# adb_server_ip = firetv_stick;
|
|
|
|
host = firetv_stick;
|
2019-03-06 15:42:52 +00:00
|
|
|
}
|
2018-09-13 20:29:29 +00:00
|
|
|
];
|
2018-09-18 00:16:12 +00:00
|
|
|
mqtt = {
|
|
|
|
broker = "localhost";
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
2020-02-24 15:55:34 +00:00
|
|
|
luftdaten = {
|
|
|
|
show_on_map = true;
|
|
|
|
sensor_id = 679;
|
|
|
|
sensors.monitored_conditions = [ "P1" "P2" ];
|
|
|
|
};
|
|
|
|
binary_sensor =
|
|
|
|
zigbee.binary_sensor
|
|
|
|
++ flurlicht.binary_sensor;
|
2018-09-13 20:29:29 +00:00
|
|
|
sensor = [
|
2020-02-24 15:55:34 +00:00
|
|
|
{ platform = "speedtest";
|
|
|
|
monitored_conditions = [ "ping" "download" "upload" ];
|
|
|
|
}
|
2018-09-13 20:29:29 +00:00
|
|
|
# https://www.home-assistant.io/cookbook/automation_for_rainy_days/
|
2018-11-05 12:52:11 +00:00
|
|
|
]
|
2020-02-04 17:26:59 +00:00
|
|
|
++ ((import ./sensor/outside.nix) {inherit lib;})
|
2020-02-24 15:55:34 +00:00
|
|
|
++ zigbee.sensor ;
|
2018-09-13 20:29:29 +00:00
|
|
|
frontend = { };
|
2020-02-24 15:56:42 +00:00
|
|
|
light = flurlicht.light;
|
2018-10-16 22:34:46 +00:00
|
|
|
group =
|
|
|
|
{ default_view =
|
|
|
|
{ view = "yes";
|
|
|
|
entities = [
|
|
|
|
"group.flur"
|
|
|
|
"group.schlafzimmer"
|
|
|
|
"group.draussen"
|
|
|
|
"group.wohnzimmer"
|
2018-11-05 12:52:11 +00:00
|
|
|
"group.arbeitszimmer"
|
2018-10-16 22:34:46 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
flur = [
|
|
|
|
"light.flurlicht"
|
|
|
|
"binary_sensor.flur_bewegung"
|
2019-03-06 15:42:52 +00:00
|
|
|
"automation.dunkel_bei_sonnenuntergang"
|
|
|
|
"automation.hell_bei_sonnenaufgang"
|
2018-10-16 22:34:46 +00:00
|
|
|
];
|
|
|
|
wohnzimmer = [
|
|
|
|
"media_player.kodi"
|
2019-03-06 15:42:52 +00:00
|
|
|
"media_player.firetv_stick"
|
2018-10-16 22:34:46 +00:00
|
|
|
];
|
|
|
|
draussen = [
|
|
|
|
"sensor.dark_sky_temperature"
|
|
|
|
"sensor.dark_sky_hourly_summary"
|
2020-02-04 17:26:59 +00:00
|
|
|
"sensor.dark_sky_humidity"
|
|
|
|
"sensor.dark_sky_pressure"
|
|
|
|
"sensor.muehlhausen_pm10"
|
|
|
|
"sensor.muehlhausen_pm25"
|
2018-10-16 22:34:46 +00:00
|
|
|
];
|
|
|
|
schlafzimmer = [
|
|
|
|
"sensor.schlafzimmer_temperatur"
|
|
|
|
"sensor.schlafzimmer_luftdruck"
|
|
|
|
"sensor.schlafzimmer_luftfeuchtigkeit"
|
|
|
|
"switch.lichterkette_schlafzimmer"
|
|
|
|
];
|
2018-11-05 12:52:11 +00:00
|
|
|
arbeitszimmer = [
|
|
|
|
"switch.strom_staubsauger"
|
|
|
|
"sensor.arbeitszimmer_temperatur"
|
|
|
|
"sensor.arbeitszimmer_luftfeuchtigkeit"
|
|
|
|
];
|
2018-10-16 22:34:46 +00:00
|
|
|
};
|
2018-09-13 20:29:29 +00:00
|
|
|
http = { };
|
2020-02-24 15:55:34 +00:00
|
|
|
switch =
|
2020-02-24 15:56:42 +00:00
|
|
|
zigbee.switch;
|
2020-02-24 15:55:34 +00:00
|
|
|
automation =
|
|
|
|
flurlicht.automation
|
|
|
|
++ kurzzeitwecker.automation
|
|
|
|
++ zigbee.automation;
|
|
|
|
script = kurzzeitwecker.script; # dict
|
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
|
|
|
|
2018-09-13 20:29:29 +00:00
|
|
|
}
|