Merge remote-tracking branch 'gum/master' into master

This commit is contained in:
lassulus 2020-11-23 11:33:23 +01:00
commit 1b4d1c4aab
52 changed files with 1375 additions and 1302 deletions

View File

@ -92,7 +92,6 @@ in {
<stockholm/makefu/2configs/bluetooth-mpd.nix>
<stockholm/makefu/2configs/ham>
<stockholm/makefu/2configs/ham/zigbee2mqtt>
{
makefu.ps3netsrv = {
enable = true;

View File

@ -17,12 +17,14 @@ in {
PasswordAuthentication no
'';
};
users.users.auphonic = {
uid = genid "auphonic";
group = "nginx";
useDefaultShell = true;
openssh.authorizedKeys.keys = [ ident config.krebs.users.makefu.pubkey ];
};
services.logrotate = {
enable = true;
config = ''
@ -36,6 +38,12 @@ in {
}
'';
};
# 20.09 unharden nginx to write logs
systemd.services.nginx.serviceConfig.ReadWritePaths = [
"/var/spool/nginx/logs/"
];
services.nginx = {
appendHttpConfig = ''
types {
@ -55,15 +63,4 @@ in {
'';
};
};
environment.etc."netdata/python.d/web_log.conf".text = ''
nginx_log3:
name: 'nginx'
path: '/var/spool/nginx/logs/access.log'
nginx_log4:
name: 'bgt'
path: '${bgtaccess}'
'';
users.users.netdata.extraGroups = [ "nginx" ];
}

View File

@ -1,4 +1,6 @@
[
{
services.home-assistant.config.automation =
[
{ alias = "Turn on Fernseher on group home";
trigger = {
platform = "state";
@ -81,4 +83,5 @@
];
};
}
]
];
}

View File

@ -1,4 +1,6 @@
[
{
services.home-assistant.config.automation =
[
{ alias = "State on HA start-up";
trigger = {
platform = "homeassistant";
@ -28,4 +30,5 @@
#}
];
}
]
];
}

View File

@ -1,4 +1,6 @@
[
{
services.home-assistant.config.automation =
[
# TODO: trigger if it is before dusk and somebody arives but nachtlichter are
# off from last day
# TODO: do not have nachtlicht turned on at night
@ -32,4 +34,5 @@
entity_id = [ "group.nachtlicht" ];
};
}
]
];
}

View File

@ -1,6 +1,9 @@
let
long_threshold = 30;
in [
in
{
services.home-assistant.config.automation =
[
{
alias = "Bad Air Alarm 60 seconds";
trigger =
@ -68,4 +71,5 @@ in [
}
];
}
]
];
}

View File

@ -12,6 +12,9 @@ let
# expire_after = "5"; #expire after 5 seconds
qos = 1;
};
in [
in {
services.home-assistant.config.binary_sensor =
[
(tasmota_button "RedButton" "redbutton")
]
];
}

View File

@ -1,4 +1,6 @@
[
{
services.home-assistant.config.binary_sensor =
[
{ platform = "mqtt";
device_class = "motion";
name = "Motion";
@ -9,4 +11,5 @@
payload_available = "Online";
payload_not_available = "Offline";
}
]
];
}

View File

@ -1,4 +1,6 @@
[
{
services.home-assistant.config.camera =
[
{ name = "Poorly Drawn Lines";
platform = "generic";
still_image_url = http://127.0.0.1:8123/local/lines.png ;
@ -7,4 +9,5 @@
platform = "generic";
still_image_url = http://127.0.0.1:8123/local/xkcd.png ;
}
]
];
}

View File

@ -5,7 +5,10 @@ let
inherit name still_image_url;
platform = "generic";
};
in [
in
{
services.home-assistant.config.camera =
[
( cam "Max-Eyth-See" https://www.wav-stuttgart.de/webcam/_/webcam1.jpg )
( cam "Wilhelma" http://webcam.wilhelma.de/webcam02/webcam02.jpg )
( cam "Marktplatz" https://webcam.stuttgart.de/wcam007/current.jpg )
@ -23,4 +26,5 @@ in [
( cam "S21 3" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-01/s21-turm-01.jpg )
( cam "S21 4" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Jaegerstrasse-Nordkopf/s21-jaegerstrassse-nordkopf.jpg )
( cam "S21 5" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Bahndirektion-Nord/S21-Bundesbahndirektion-Nord.jpg )
]
];
}

View File

@ -1,4 +1,6 @@
[
{
services.home-assistant.config.camera =
[
{ name = "Baumarkt";
platform = "generic";
still_image_url = http://t4915209254324-p80-c0-h6jv2afnujcoftrcstsafb45kdrqv4buy.webdirect.mdex.de/oneshotimage ;# baumarkt
@ -11,4 +13,5 @@
platform = "generic";
still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K11 ;
}
]
];
}

View File

@ -1,20 +1,51 @@
{ config, pkgs, lib, ... }:
let
kodi-host = "192.168.8.11";
ten_hours = import ./multi/10h_timers.nix { inherit lib; }; # provides: timer automation script
mittagessen = import ./multi/mittagessen.nix { inherit lib; }; # provides: automation script
matrix = import ./multi/matrix.nix { inherit lib; }; # provides: matrix automation
frosch = import ./multi/frosch.nix { inherit lib; }; # provides: sensor binary_sensor switch light script automation
aramark = import ./multi/aramark.nix { inherit lib; }; # provides: sensor binary_sensor
standup = import ./multi/daily-standup.nix { inherit lib; }; # provides: automation script
in {
imports = [
./ota.nix
./comic-updater.nix
./puppy-proxy.nix
# hass config
## complex configs
./multi/daily-standup.nix
./multi/aramark.nix
./multi/matrix.nix
./multi/frosch.nix
./multi/mittagessen.nix
./multi/10h_timers.nix
./switch/tasmota_switch.nix
./switch/rfbridge.nix
./light/statuslight.nix
./light/buzzer.nix
./script/multi_blink.nix
./binary_sensor/buttons.nix
./binary_sensor/motion.nix
# ./sensor/pollen.nix requires dwd_pollen
./sensor/espeasy.nix
./sensor/airquality.nix
./sensor/outside.nix
./sensor/tasmota_firmware.nix
./camera/verkehrskamera.nix
./camera/comic.nix
./camera/stuttgart.nix
./automation/bureau-shutdown.nix
./automation/nachtlicht.nix
./automation/schlechteluft.nix
./automation/hass-restart.nix
./device_tracker/openwrt.nix
./person/team.nix
];
networking.firewall.allowedTCPPorts = [ 8123 ];
state = [ "/var/lib/hass/known_devices.yaml" ];
services.home-assistant = {
enable = true;
autoExtraComponents = true;
@ -51,7 +82,6 @@ in {
source = "hass";
};
};
matrix = matrix.matrix;
mqtt = {
discovery = true;
discovery_prefix = "homeassistant";
@ -73,13 +103,6 @@ in {
retain = true;
};
};
switch = (import ./switch/tasmota_switch.nix)
++ frosch.switch
++ (import ./switch/rfbridge.nix);
light = (import ./light/statuslight.nix)
++ (import ./light/buzzer.nix)
++ frosch.light;
timer = ten_hours.timer;
notify = [
{
platform = "kodi";
@ -93,7 +116,7 @@ in {
(builtins.fromJSON (builtins.readFile
<secrets/hass/telegram-bot.json>)).allowed_chat_ids 0;
}
] ++ matrix.notify;
];
media_player = [
{ platform = "kodi";
host = kodi-host;
@ -102,37 +125,10 @@ in {
host = "127.0.0.1";
}
];
script = lib.fold lib.recursiveUpdate {} [
((import ./script/multi_blink.nix) {inherit lib;})
frosch.script
ten_hours.script
mittagessen.script
# standup.script
];
binary_sensor =
(import ./binary_sensor/buttons.nix)
++ (import ./binary_sensor/motion.nix)
++ frosch.binary_sensor
++ aramark.binary_sensor;
sensor = []
++ [{ platform = "version"; }] # pyhaversion
# ++ (import ./sensor/pollen.nix)
++ (import ./sensor/espeasy.nix)
++ (import ./sensor/airquality.nix)
++ ((import ./sensor/outside.nix) {inherit lib;})
++ (import ./sensor/influxdb.nix)
++ (import ./sensor/tasmota_firmware.nix)
++ frosch.sensor
++ aramark.sensor;
sensor = [{ platform = "version"; }]; # pyhaversion
camera =
(import ./camera/verkehrskamera.nix)
++ (import ./camera/comic.nix)
++ (import ./camera/stuttgart.nix);
person =
(import ./person/team.nix );
frontend = { };
http = {
@ -263,16 +259,6 @@ in {
# feedreader.urls = [ "http://www.heise.de/security/rss/news-atom.xml" ];
# we don't use imports because the expressions do not merge in
# home-assistant
automation = (import ./automation/bureau-shutdown.nix)
++ (import ./automation/nachtlicht.nix)
++ (import ./automation/schlechteluft.nix)
++ (import ./automation/hass-restart.nix)
++ ten_hours.automation
++ matrix.automation
# ++ standup.automation
++ frosch.automation
++ mittagessen.automation;
device_tracker = (import ./device_tracker/openwrt.nix );
};
};
}

View File

@ -1,7 +1,9 @@
# requires `opkg install luci-mod-rpc` on router
# see https://www.home-assistant.io/components/luci/
[
{
services.home-assistant.config.device_tracker =
[
{ platform = "luci";
host = "192.168.8.1";
username = "root";
@ -13,4 +15,5 @@
hide_if_away = false;
};
}
]
];
}

View File

@ -21,8 +21,10 @@ let
optimistic = false;
qos = 0;
};
in
[
# (tasmota_pwm "RedButton LED" "redbutton" 1 1023) #LED PWM1
in {
services.home-assistant.config.light =
[
# (tasmota_pwm "RedButton LED" "redbutton" 1 1023) #LED PWM1
(tasmota_pwm "RedButton Buzzer" "redbutton" 2 512) #buzzer PWM2
]
];
}

View File

@ -48,9 +48,11 @@ let
12 # fire pattern
];
};
in
[
in {
services.home-assistant.config.light =
[
(tasmota_rgb "Status Felix" "status1")
(tasmota_rgb "Status Daniel" "status2")
(tasmota_rgb "Buslicht" "buslicht")
]
];
}

View File

@ -198,6 +198,7 @@ let
];
in
{
services.home-assistant.config = {
timer =lib.fold lib.recursiveUpdate {}
(map tmr_10h persons);
automation = (lib.flatten (map automation_10h persons));
@ -205,4 +206,5 @@ in
(map announce_user persons) ++
(map zu_lange_user persons)
);
};
}

View File

@ -1,3 +0,0 @@
# Combination Folder
files return a dictionary of different types used in home-assistant instead of
a single thing.

View File

@ -12,7 +12,9 @@ let
((aramark "${menue}/price" "${menue} Preis") // { unit_of_measurement = ""; })
];
in
{
{
services.home-assistant.config =
{
sensor = (aramark_menue "Menü 1")
++ (aramark_menue "Menü 2")
++ (aramark_menue "Mercato")
@ -21,4 +23,5 @@ in
[
((aramark "pommes" "Pommes" ) // { payload_on = "True"; payload_off = "False"; })
];
};
}

View File

@ -1,4 +1,4 @@
{ lib }:
{lib, ... }:
let
random_daily_text = ''{{ [
"Es ist so weit, es ist Standup Zeit!",
@ -9,6 +9,8 @@ let
"Morgens, halb elf in Deutschland - das Standupchen" ] | random }}'';
in {
services.home-assistant.config =
{
script =
{ "random_daily" = {
alias = "Random Daily Introduction";
@ -51,4 +53,5 @@ in {
}
];
};
}

View File

@ -1,4 +1,4 @@
{ lib }:
{lib, ... }:
# needs: binary_sensor.pommes
# notify.matrix_notify
let
@ -17,7 +17,10 @@ let
"Der Weltmarktpreis von Pommes ist durch verschiedene Weltkrisen leider so hoch, dass Aramark den Verkaufspreis verdoppeln musste.",
"Vorfreude, schönste Freude, Freude bei Aramark. Pommes in die Schale rein, alle Kunden werden glücklich sein.",
"In 15 Minuten ist es wieder so weit, es ist Pommes Zeit!"] | random }}'';
in {
in
{
services.home-assistant.config =
{
sensor = [
{ platform = "mqtt";
name = "frosch brightness";
@ -96,4 +99,5 @@ in {
];
};
};
};
}

View File

@ -8,7 +8,10 @@
# name: my_command
let
mom_room = "!kTQjvTQvfVsvfEtmth:thales.citadel.team";
in {
in
{
services.home-assistant.config =
{
matrix =
{
# secrets:
@ -62,4 +65,5 @@ in {
platform = "matrix";
default_room = mom_room;
}];
};
}

View File

@ -38,7 +38,9 @@ let
"Jetzt nur noch kurz die Mail fertig schreiben und schon kann es los gehen.",
"Es ist 13 Uhr und die Mittagspause ist bald vorbei .... Kleiner Scherz, es ist erst 12:30, aber Ihr hättet auch nicht wirklich etwas verpasst.",
"Hallo, es ist nun 12 Uhr 30! Dies entspricht der Essenszeit aller Büroinsassen. Bitte begebt euch zur Aramark Essensausgabe um euren menschlichen Bedürfnissen nachzukommen."] | random }}'';
in {
in
{
services.home-assistant.config = {
automation = [
{ alias = "Mittagessen";
trigger = {
@ -86,4 +88,5 @@ in {
];
};
};
};
}

View File

@ -1,4 +1,6 @@
[
{
services.home-assistant.config.person =
[
{ name = "Thorsten";
id = 1;
device_trackers = [
@ -38,12 +40,12 @@
"device_tracker.frank_phone"
];
}
{ name = "Carsten";
id = 7;
device_trackers = [
"device_tracker.carsten_phone"
];
}
#{ name = "Carsten";
# id = 7;
# device_trackers = [
# "device_tracker.carsten_phone"
# ];
#}
{ name = "Emeka";
id = 8;
device_trackers = [
@ -56,17 +58,24 @@
"device_tracker.sabine_phone"
];
}
{ name = "Tobias";
id = 10;
#{ name = "Tobias";
# id = 10;
# device_trackers = [
# "device_tracker.tobias_phone"
# ];
#}
#{ name = "Tancrede";
# id = 11;
# device_trackers = [
# "device_tracker.tancrede_phone"
# "device_tracker.tancrede_laptop"
# ];
#}
{ name = "Chris";
id = 12;
device_trackers = [
"device_tracker.tobias_phone"
"device_tracker.chris_phone"
];
}
{ name = "Tancrede";
id = 11;
device_trackers = [
"device_tracker.tancrede_phone"
"device_tracker.tancrede_laptop"
];
}
]
}

View File

@ -19,6 +19,8 @@ let
) count);
};
in {
services.home-assistant.config.script =
{
buzz_red_led = (flash_entity {
entity = "light.redbutton_buzzer";
alias = "Red Button Buzz";
@ -54,4 +56,5 @@ in {
delay = 5000;
count = 1;
});
};
}

View File

@ -1,4 +1,6 @@
[
{
services.home-assistant.config.sensor =
[
# coming from 2configs/stats/telegraf/
{ platform = "mqtt";
name = "Air Quality";
@ -6,4 +8,5 @@
value_template = "{{ value_json.fields.value }}";
unit_of_measurement = "VOC";
}
]
];
}

View File

@ -24,8 +24,10 @@ let
payload_available = "Online";
payload_not_available = "Offline";
};
in
(espeasy_dht22 "easy1") ++
(espeasy_dht22 "easy2") ++ [
in {
services.home-assistant.config.sensor =
(espeasy_dht22 "easy1") ++
(espeasy_dht22 "easy2") ++ [
(espeasy_ds18 "easy3" )
]
];
}

View File

@ -1,18 +0,0 @@
[
#{ platform = "influxdb";
# queries = [
# { name = "mean value of feinstaub P1";
# where = '' "node" = 'esp8266-1355142' '';
# measurement = "feinstaub";
# database = "telegraf";
# field = "P1";
# }
# { name = "mean value of feinstaub P2";
# where = '' "node" = 'esp8266-1355142' '';
# measurement = "feinstaub";
# database = "telegraf";
# field = "P2";
# }
# ];
#}
]

View File

@ -1,4 +1,7 @@
{lib,...}: [
{lib,...}:
{
services.home-assistant.config.sensor =
[
{ platform = "darksky";
api_key = lib.removeSuffix "\n"
(builtins.readFile <secrets/hass/darksky.apikey>);
@ -22,4 +25,5 @@
sensorid = "5341";
monitored_conditions = [ "P1" "P2" ];
}
]
];
}

View File

@ -9,8 +9,11 @@ let
payload_not_available= "Offline";
};
in
{
services.home-assistant.config.sensor =
map tasmota_firmware [
"plug" "plug2" "plug3" "plug4" "plug5"
"status1" "status2" "buslicht"
"rfbridge"
]
];
}

View File

@ -8,10 +8,12 @@ let
payload_available= "Online";
payload_not_available= "Offline";
};
in
[
in {
services.home-assistant.config.switch =
[
(bridge "Nachtlicht A" "#414551" "#414554")
(bridge "Nachtlicht B" "#415151" "#415154")
(bridge "Nachtlicht C" "#415451" "#415454")
(bridge "Nachtlicht D" "#41551F" "#415514")
]
];
}

View File

@ -13,10 +13,13 @@ let
retain = false;
qos = 1;
};
in [
in {
services.home-assistant.config.switch =
[
(tasmota_plug "Bauarbeiterlampe" "plug")
(tasmota_plug "Blitzdings" "plug2")
(tasmota_plug "Fernseher" "plug3")
(tasmota_plug "Feuer" "plug4")
(tasmota_plug "Blaulicht" "plug5")
]
];
}

View File

@ -43,9 +43,6 @@ with import <stockholm/lib>;
boot.tmpOnTmpfs = true;
systemd.tmpfiles.rules = [
"d /tmp 1777 root root - -"
];
environment.systemPackages = with pkgs; [
jq

View File

@ -3,10 +3,8 @@
{
environment.systemPackages = [
pkgs.python27Full # required for youcompleteme
(pkgs.vim_configurable.customize {
((pkgs.vim_configurable.override { python = pkgs.python3; }).customize {
name = "vim";
vimrcConfig.customRC = builtins.readFile ./vimrc;
vimrcConfig.vam.knownPlugins = pkgs.vimPlugins;
vimrcConfig.vam.pluginDictionaries = [

View File

@ -31,8 +31,10 @@ in
awesome.luaModules = [ pkgs.luaPackages.vicious ];
};
displayManager.defaultSession = lib.mkDefault "none+awesome";
displayManager.lightdm = { enable = true; autoLogin.enable = true; autoLogin.user = mainUser; };
desktopManager.xterm.enable = false;
displayManager.autoLogin = {
enable = true;
user = mainUser;
};
};
environment.systemPackages = [ pkgs.gnome3.defaultIconTheme ];
# lid switch is handled via button presses

View File

@ -7,7 +7,10 @@ let
};
};
sec = seconds: { delay.seconds = seconds; };
in [
in
{
services.home-assistant.config.automation =
[
{
alias = "Nightly reboot of firetv";
trigger = {
@ -30,4 +33,5 @@ in [
(cmd "RIGHT")
];
}
]
];
}

View File

@ -2,7 +2,12 @@ let
cred = import <secrets/ham/nextcloud-calendar>;
in
{
services.home-assistant.config.calendar =
[
{
platform = "caldav";
inherit (cred) username password;
url = "https://o.euer.krebsco.de/remote.php/dav";
}
];
}

View File

@ -4,39 +4,33 @@
## wake-on-lan server
##
let
upkgs = (import <nixpkgs-unstable> {}).pkgs;
hlib = (import ./lib);
prefix = hlib.prefix;
tasmota = hlib.tasmota;
prefix = (import ./lib).prefix;
firetv_stick = "192.168.1.24";
hassdir = "/var/lib/hass";
zigbee = import ./multi/zigbee2mqtt.nix;
#flurlicht = import ./multi/flurlicht.nix;
kurzzeitwecker = import ./multi/kurzzeitwecker.nix;
firetv_restart = import ./multi/firetv_restart.nix;
the_playlist = import ./multi/the_playlist.nix;
fliegen-counter = import ./multi/fliegen-couter.nix;
# switch
# automation
# binary_sensor
# sensor
# input_select
# timer
in {
imports = [
./mqtt.nix
./zigbee2mqtt/default.nix
# hass config
./zigbee2mqtt/hass.nix
# ./multi/flurlicht.nix
./multi/kurzzeitwecker.nix
./multi/the_playlist.nix
./multi/fliegen-couter.nix
./device_tracker/openwrt.nix
./sensor/outside.nix
./calendar/nextcloud.nix
./automation/firetv_restart.nix
./light/groups.nix
];
services.home-assistant = {
package = (upkgs.home-assistant.overrideAttrs (old: {
doCheck = false;
checkPhase = ":";
installCheckPhase = ":";
})).override {
extraPackages = ps: with ps; [
python-forecastio jsonrpc-async jsonrpc-websocket mpd2 pkgs.picotts androidtv
];
};
config = {
influxdb = {
database = "ham";
@ -48,8 +42,6 @@ in {
};
config = {};
input_select = zigbee.input_select; # dict
timer = zigbee.timer // kurzzeitwecker.timer; # dict
homeassistant = {
name = "Home"; time_zone = "Europe/Berlin";
latitude = "48.7687";
@ -60,12 +52,10 @@ in {
conversation = {};
history = {};
logbook = {};
counter = fliegen-counter.counter;
logger = {
default = "info";
};
rest_command = {}
// the_playlist.rest_command;
rest_command = {};
tts = [
{ platform = "google_translate";
language = "de";
@ -81,7 +71,7 @@ in {
# "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>))
];
@ -101,7 +91,6 @@ in {
];
sun.elevation = 247;
recorder = {};
device_tracker = (import ./device_tracker/openwrt.nix);
media_player = [
{ platform = "FireTV Stick kodi";
host = firetv_stick;
@ -149,25 +138,12 @@ in {
monitored_conditions = [ "ping" "download" "upload" ];
}
# https://www.home-assistant.io/cookbook/automation_for_rainy_days/
]
++ ((import ./sensor/outside.nix) {inherit lib;})
++ the_playlist.sensor
++ zigbee.sensor ;
];
frontend = { };
calendar = [ (import ./calendar/nextcloud.nix) ];
# light = flurlicht.light;
http = { };
switch = [];
automation = []
++ (import ./automation/firetv_restart.nix)
++ kurzzeitwecker.automation
#++ flurlicht.automation
++ the_playlist.automation
++ fliegen-counter.automation
++ zigbee.automation;
script =
{ }
// kurzzeitwecker.script; # dict
automation = [];
script = { };
};
enable = true;
configDir = hassdir;

View File

@ -1,4 +1,6 @@
[
{
services.home-assistant.config.device_tracker =
[
{ platform = "luci";
host = "192.168.1.5";
username = "root";
@ -7,4 +9,5 @@
consider_home = 300; # 5 minutes timeout
new_device_defaults.track_new_devices = true;
}
]
];
}

View File

@ -0,0 +1,41 @@
let
arbeitszimmer_licht = [
"light.led_wand"
"light.arbeitszimmer_led1_led_strip" # LED-Kreis in cube
"light.arbeitszimmer_flur_osram_light"
"light.arbeitszimmer_schrank_dimmer_light"
"light.arbeitszimmer_schrank_osram_light"
];
wohnzimmer_licht = [
"light.wohnzimmer_fernseher_led_strip" # led um fernseher
"light.wohnzimmer_komode_osram_light"
"light.wohnzimmer_schrank_osram_light"
"light.wohnzimmer_stehlampe_osram_light"
];
schlafzimmer_licht = [
"schlafzimmer_komode_osram_light"
];
in {
services.home-assistant.config.light = [
{
platform = "group";
name = "Arbeitszimmer Lichter";
entities = arbeitszimmer_licht;
}
{
platform = "group";
name = "Wohnzimmer Lichter";
entities = wohnzimmer_licht;
}
{
platform = "group";
name = "Schlafzimmer Lichter";
entities = schlafzimmer_licht;
}
{
platform = "group";
name = "Alle Lichter";
entities = arbeitszimmer_licht ++ wohnzimmer_licht ++ schlafzimmer_licht;
}
];
}

View File

@ -15,7 +15,10 @@ let
data.entity_id = "counter.${for}_fliegen";
}) incr;
};
in {
in
{
services.home-assistant.config =
{
counter = {
felix_fliegen = {};
misa_fliegen = {};
@ -64,4 +67,5 @@ in {
];
}
];
};
}

View File

@ -8,7 +8,9 @@
# notify.telegrambot
let
button = "sensor.zigbee_btn2_click";
in {
in
{
services.home-assistant.config = {
timer.kurzzeitwecker =
{
name = "Zigbee Kurzzeitwecker";
@ -129,4 +131,5 @@ in {
];
}
];
};
}

View File

@ -7,6 +7,8 @@
# automation
# sensor
{
services.home-assistant.config =
{
rest_command = {
good_song = {
url = "http://prism.r:8001/good";
@ -80,4 +82,5 @@
};
}
];
};
}

View File

@ -1,127 +0,0 @@
# provides:
# switch
# automation
# binary_sensor
# sensor
# input_select
# timer
let
inherit (import ../lib) zigbee;
prefix = zigbee.prefix;
in {
sensor =
[
# Sensor for monitoring the bridge state
{
platform = "mqtt";
name = "Zigbee2mqtt Bridge state";
state_topic = "${prefix}/bridge/state";
icon = "mdi:router-wireless";
}
# Sensor for Showing the Zigbee2mqtt Version
{
platform = "mqtt";
name = "Zigbee2mqtt Version";
state_topic = "${prefix}/bridge/config";
value_template = "{{ value_json.version }}";
icon = "mdi:zigbee";
}
# Sensor for Showing the Coordinator Version
{
platform = "mqtt";
name = "Coordinator Version";
state_topic = "${prefix}/bridge/config";
value_template = "{{ value_json.coordinator }}";
icon = "mdi:chip";
}
];
switch = [
{
platform = "mqtt";
name = "Zigbee2mqtt Main join";
state_topic = "${prefix}/bridge/config/permit_join";
command_topic = "${prefix}/bridge/config/permit_join";
payload_on = "true";
payload_off = "false";
}
];
automation = [
{
alias = "Zigbee2mqtt Log Level";
initial_state = "on";
trigger = {
platform = "state";
entity_id = "input_select.zigbee2mqtt_log_level";
};
action = [
{
service = "mqtt.publish";
data = {
payload_template = "{{ states('input_select.zigbee2mqtt_log_level') }}";
topic = "${prefix}/bridge/config/log_level";
};
}
];
}
# Automation to start timer when enable join is turned on
{
id = "zigbee_join_enabled";
alias = "Zigbee Join Enabled";
trigger =
{
platform = "state";
entity_id = "switch.zigbee2mqtt_main_join";
to = "on";
};
action =
{
service = "timer.start";
entity_id = "timer.zigbee_permit_join";
};
}
# # Automation to stop timer when switch turned off and turn off switch when timer finished
{
id = "zigbee_join_disabled";
alias = "Zigbee Join Disabled";
trigger = [
{
platform = "event";
event_type = "timer.finished";
event_data.entity_id = "timer.zigbee_permit_join";
}
{
platform = "state";
entity_id = "switch.zigbee2mqtt_main_join";
to = "off";
}
];
action = [
{ service = "timer.cancel";
data.entity_id = "timer.zigbee_permit_join";
}
{ service = "switch.turn_off";
entity_id = "switch.zigbee2mqtt_main_join";
}
];
}
];
input_select.zigbee2mqtt_log_level =
{
name = "Zigbee2mqtt Log Level";
options = [
"debug"
"info"
"warn"
"error"
];
initial = "info";
icon = "mdi:format-list-bulleted";
};
timer.zigbee_permit_join =
{
name = "Zigbee Time remaining";
duration = 120;
};
}

View File

@ -1,4 +1,8 @@
{lib,...}: [
{lib,...}:
{
services.home-assistant.config.sensor =
[
{ platform = "darksky";
api_key = lib.removeSuffix "\n"
(builtins.readFile <secrets/hass/darksky.apikey>);
@ -17,4 +21,5 @@
units = "si" ;
scan_interval = "00:30:00";
}
]
];
}

View File

@ -1,21 +1,28 @@
{config, pkgs, lib, ...}:
{
let
dataDir = "/var/lib/zigbee2mqtt";
in
{
# symlink the zigbee controller
services.udev.extraRules = ''
SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dailout"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dialout"
'';
system.activationScripts.installZigbee = ''
install -d /var/lib/zigbee2mqtt
'';
docker-containers.zigbee2mqtt = {
image = "koenkk/zigbee2mqtt";
extraDockerOptions = [ "--device=/dev/cc2531:/dev/cc2531" ];
volumes = ["/var/lib/zigbee2mqtt:/app/data"];
services.zigbee2mqtt = {
enable = true;
inherit dataDir;
};
state = [ "${dataDir}/configuration.yaml" "${dataDir}/state.json" ];
systemd.services.zigbee2mqtt = {
# override automatic configuration.yaml deployment
serviceConfig.ExecStartPre = lib.mkForce "${pkgs.coreutils}/bin/true";
after = [
"home-assistant.service"
"mosquitto.service"
"network-online.target"
];
};
state = [ "/var/lib/zigbee2mqtt/configuration.yaml" "/var/lib/zigbee2mqtt/state.json" ];
systemd.services.docker-zigbee2mqtt.after = [ "home-assistant.service" "docker.service" "network-online.target" ];
}

View File

@ -0,0 +1,130 @@
# provides:
# switch
# automation
# binary_sensor
# sensor
# input_select
# timer
let
inherit (import ../lib) zigbee;
prefix = zigbee.prefix;
in
{
services.home-assistant.config = {
sensor =
[
# Sensor for monitoring the bridge state
{
platform = "mqtt";
name = "Zigbee2mqtt Bridge state";
state_topic = "${prefix}/bridge/state";
icon = "mdi:router-wireless";
}
# Sensor for Showing the Zigbee2mqtt Version
{
platform = "mqtt";
name = "Zigbee2mqtt Version";
state_topic = "${prefix}/bridge/config";
value_template = "{{ value_json.version }}";
icon = "mdi:zigbee";
}
# Sensor for Showing the Coordinator Version
{
platform = "mqtt";
name = "Coordinator Version";
state_topic = "${prefix}/bridge/config";
value_template = "{{ value_json.coordinator }}";
icon = "mdi:chip";
}
];
switch = [
{
platform = "mqtt";
name = "Zigbee2mqtt Main join";
state_topic = "${prefix}/bridge/config/permit_join";
command_topic = "${prefix}/bridge/config/permit_join";
payload_on = "true";
payload_off = "false";
}
];
automation = [
{
alias = "Zigbee2mqtt Log Level";
initial_state = "on";
trigger = {
platform = "state";
entity_id = "input_select.zigbee2mqtt_log_level";
};
action = [
{
service = "mqtt.publish";
data = {
payload_template = "{{ states('input_select.zigbee2mqtt_log_level') }}";
topic = "${prefix}/bridge/config/log_level";
};
}
];
}
# Automation to start timer when enable join is turned on
{
id = "zigbee_join_enabled";
alias = "Zigbee Join Enabled";
trigger =
{
platform = "state";
entity_id = "switch.zigbee2mqtt_main_join";
to = "on";
};
action =
{
service = "timer.start";
entity_id = "timer.zigbee_permit_join";
};
}
# # Automation to stop timer when switch turned off and turn off switch when timer finished
{
id = "zigbee_join_disabled";
alias = "Zigbee Join Disabled";
trigger = [
{
platform = "event";
event_type = "timer.finished";
event_data.entity_id = "timer.zigbee_permit_join";
}
{
platform = "state";
entity_id = "switch.zigbee2mqtt_main_join";
to = "off";
}
];
action = [
{ service = "timer.cancel";
data.entity_id = "timer.zigbee_permit_join";
}
{ service = "switch.turn_off";
entity_id = "switch.zigbee2mqtt_main_join";
}
];
}
];
input_select.zigbee2mqtt_log_level =
{
name = "Zigbee2mqtt Log Level";
options = [
"debug"
"info"
"warn"
"error"
];
initial = "info";
icon = "mdi:format-list-bulleted";
};
timer.zigbee_permit_join =
{
name = "Zigbee Time remaining";
duration = 120;
};
};
}

View File

@ -0,0 +1,14 @@
{
availability_topic: /ham/zigbee/bridge/state
command_topic: /ham/zigbee/flur_arbeitszimmer_osram2/set
- platform: "mqtt"
state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
availability_topic: "zigbee2mqtt/bridge/state"
payload_on: true
payload_off: false
value_template: "{{ value_json.battery_low}}"
device_class: "battery"
}

View File

@ -38,20 +38,17 @@
};
services.tlp.enable = true;
services.tlp.extraConfig = ''
services.tlp.settings = {
# BUG: http://linrunner.de/en/tlp/docs/tlp-faq.html#erratic-battery
START_CHARGE_THRESH_BAT0=95
STOP_CHARGE_THRESH_BAT0=100
CPU_SCALING_GOVERNOR_ON_AC=performance
CPU_SCALING_GOVERNOR_ON_BAT=ondemand
CPU_MIN_PERF_ON_AC=0
CPU_MAX_PERF_ON_AC=100
CPU_MIN_PERF_ON_BAT=0
CPU_MAX_PERF_ON_BAT=30
'';
START_CHARGE_THRESH_BAT0 = 95;
STOP_CHARGE_THRESH_BAT0 = 100;
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "ondemand";
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 30;
};
powerManagement.resumeCommands = ''
${pkgs.utillinux}/bin/rfkill unblock all

View File

@ -1,8 +1,8 @@
{ stdenv, fetchFromGitHub, python3, makeWrapper }:
{ stdenv, fetchFromGitHub, python37, makeWrapper }:
let
pythonEnv = python3.withPackages(ps: with ps; [
(python3.pkgs.callPackage ./cheetah3.nix {})
pythonEnv = python37.withPackages(ps: with ps; [
(ps.callPackage ./cheetah3.nix {})
]);
in stdenv.mkDerivation rec {
pname = "sickgear";

View File

@ -56,8 +56,4 @@ in { # wireguard server
};
# TODO: this issue is related to the router which connects to the host but is
# unable to re-connect once restarted
systemd.services.wireguard-wg0.serviceConfig = {
Restart = "always";
RuntimeMaxSec = "12h";
};
}

View File

@ -86,7 +86,7 @@ let
'';
};
extraConfig = mkOption {
type = types.string;
type = types.lines;
default = "";
description = ''
Extra configuration to be appended to the snapraid conf file.

View File

@ -1,30 +0,0 @@
{ lib, stdenv, fetchFromGitHub
}:
stdenv.mkDerivation rec {
pname = "hactool";
name = "${pname}-${version}";
version = "1.4.0";
src = fetchFromGitHub {
owner = "SciresM";
repo = "hactool";
rev = version;
sha256 = "0305ngsnwm8npzgyhyifasi4l802xnfz19r0kbzzniirmcn4082d";
};
preBuild = ''
cp config.mk.template config.mk
'';
installPhase = ''
install -D hactool $out/bin/hactool
'';
buildInputs = [ ];
nativeBuildInputs = [ ];
meta = {
description = "tool to view information about, decrypt, and extract common file formats for the Nintendo Switch, especially Nintendo Content Archives";
homepage = https://github.com/SciresM/hactool;
license = stdenv.lib.licenses.isc;
platforms = stdenv.lib.platforms.linux;
maintainers = with stdenv.lib.maintainers; [ makefu ];
};
}