summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2020-11-23 11:33:23 +0100
committerlassulus <lassulus@lassul.us>2020-11-23 11:33:23 +0100
commit1b4d1c4aaba003f42a542ce1cf442a4983f50194 (patch)
treeef6e88ffcd5f036fa31086e119fa25b7a4c98874
parent801ea60c3a31db7600d004697d4520b636f3c0df (diff)
parentb26b6c4ccedfc6f92193dd7386e382d0bf88a293 (diff)
Merge remote-tracking branch 'gum/master' into master
-rw-r--r--makefu/1systems/omo/config.nix1
-rw-r--r--makefu/2configs/bgt/download.binaergewitter.de.nix19
-rw-r--r--makefu/2configs/bureautomation/automation/bureau-shutdown.nix157
-rw-r--r--makefu/2configs/bureautomation/automation/hass-restart.nix65
-rw-r--r--makefu/2configs/bureautomation/automation/nachtlicht.nix71
-rw-r--r--makefu/2configs/bureautomation/automation/schlechteluft.nix130
-rw-r--r--makefu/2configs/bureautomation/binary_sensor/buttons.nix9
-rw-r--r--makefu/2configs/bureautomation/binary_sensor/motion.nix27
-rw-r--r--makefu/2configs/bureautomation/camera/comic.nix23
-rw-r--r--makefu/2configs/bureautomation/camera/stuttgart.nix42
-rw-r--r--makefu/2configs/bureautomation/camera/verkehrskamera.nix31
-rw-r--r--makefu/2configs/bureautomation/default.nix92
-rw-r--r--makefu/2configs/bureautomation/device_tracker/openwrt.nix29
-rw-r--r--makefu/2configs/bureautomation/light/buzzer.nix12
-rw-r--r--makefu/2configs/bureautomation/light/statuslight.nix14
-rw-r--r--makefu/2configs/bureautomation/multi/10h_timers.nix16
-rw-r--r--makefu/2configs/bureautomation/multi/README.md3
-rw-r--r--makefu/2configs/bureautomation/multi/aramark.nix21
-rw-r--r--makefu/2configs/bureautomation/multi/daily-standup.nix83
-rw-r--r--makefu/2configs/bureautomation/multi/frosch.nix158
-rw-r--r--makefu/2configs/bureautomation/multi/matrix.nix106
-rw-r--r--makefu/2configs/bureautomation/multi/mittagessen.nix93
-rw-r--r--makefu/2configs/bureautomation/person/team.nix153
-rw-r--r--makefu/2configs/bureautomation/script/multi_blink.nix73
-rw-r--r--makefu/2configs/bureautomation/sensor/airquality.nix21
-rw-r--r--makefu/2configs/bureautomation/sensor/espeasy.nix12
-rw-r--r--makefu/2configs/bureautomation/sensor/influxdb.nix18
-rw-r--r--makefu/2configs/bureautomation/sensor/outside.nix54
-rw-r--r--makefu/2configs/bureautomation/sensor/tasmota_firmware.nix5
-rw-r--r--makefu/2configs/bureautomation/switch/rfbridge.nix16
-rw-r--r--makefu/2configs/bureautomation/switch/tasmota_switch.nix17
-rw-r--r--makefu/2configs/default.nix3
-rw-r--r--makefu/2configs/editor/vim.nix4
-rw-r--r--makefu/2configs/gui/base.nix6
-rw-r--r--makefu/2configs/ham/automation/firetv_restart.nix52
-rw-r--r--makefu/2configs/ham/calendar/nextcloud.nix11
-rw-r--r--makefu/2configs/ham/default.nix72
-rw-r--r--makefu/2configs/ham/device_tracker/openwrt.nix23
-rw-r--r--makefu/2configs/ham/light/groups.nix41
-rw-r--r--makefu/2configs/ham/multi/fliegen-couter.nix100
-rw-r--r--makefu/2configs/ham/multi/kurzzeitwecker.nix223
-rw-r--r--makefu/2configs/ham/multi/the_playlist.nix139
-rw-r--r--makefu/2configs/ham/multi/zigbee2mqtt.nix127
-rw-r--r--makefu/2configs/ham/sensor/outside.nix45
-rw-r--r--makefu/2configs/ham/zigbee2mqtt/default.nix31
-rw-r--r--makefu/2configs/ham/zigbee2mqtt/hass.nix130
-rw-r--r--makefu/2configs/ham/zigbee2mqtt/osram.nix14
-rw-r--r--makefu/2configs/hw/tp-x2x0.nix23
-rw-r--r--makefu/2configs/sickbeard/sickgear.nix6
-rw-r--r--makefu/2configs/wireguard/server.nix4
-rw-r--r--makefu/3modules/snapraid.nix2
-rw-r--r--makefu/5pkgs/hactool/default.nix30
52 files changed, 1365 insertions, 1292 deletions
diff --git a/makefu/1systems/omo/config.nix b/makefu/1systems/omo/config.nix
index cbe97e28a..a9e307ddf 100644
--- a/makefu/1systems/omo/config.nix
+++ b/makefu/1systems/omo/config.nix
@@ -92,7 +92,6 @@ in {
<stockholm/makefu/2configs/bluetooth-mpd.nix>
<stockholm/makefu/2configs/ham>
- <stockholm/makefu/2configs/ham/zigbee2mqtt>
{
makefu.ps3netsrv = {
enable = true;
diff --git a/makefu/2configs/bgt/download.binaergewitter.de.nix b/makefu/2configs/bgt/download.binaergewitter.de.nix
index 77c9ddc81..4abc7d345 100644
--- a/makefu/2configs/bgt/download.binaergewitter.de.nix
+++ b/makefu/2configs/bgt/download.binaergewitter.de.nix
@@ -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" ];
-
}
diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
index b9aa710c3..f4c10adc8 100644
--- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
+++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
@@ -1,84 +1,87 @@
-[
- { alias = "Turn on Fernseher on group home";
- trigger = {
- platform = "state";
- entity_id = "group.team";
- from = "not_home";
- to = "home";
- for.seconds = 30;
- };
- action = [
- {
- service = "homeassistant.turn_on";
- entity_id = [
- "switch.fernseher"
- "switch.feuer"
- ];
- }
- {
- service = "media_player.kodi_call_method";
- data = {
- entity_id = "media_player.kodi";
- method = "Player.Open";
- item.partymode = "music";
- };
- }
- {
- service = "notify.telegrambot";
- data = {
- title = "Bureau Startup";
- message = "Das Büro wurde eröffnet";
- };
- }
- ];
- }
- { alias = "Turn off Fernseher after last in group left";
- trigger = [
- { # trigger when movement was detected at the time
+{
+ services.home-assistant.config.automation =
+ [
+ { alias = "Turn on Fernseher on group home";
+ trigger = {
platform = "state";
entity_id = "group.team";
- from = "home";
- to = "not_home";
- }
- { # trigger at 18:00 no matter what
- # to avoid 'everybody left before 18:00:00'
- platform = "time";
- at = "18:00:00";
- }
- ];
- action = [
- {
- service = "homeassistant.turn_off";
- entity_id = [
- "switch.fernseher"
- "switch.feuer"
- "light.status_felix"
- "light.status_daniel"
- ];
- }
- {
- service = "notify.telegrambot";
- data_template = {
- title = "Bureau Shutdown";
- message = "All devices are turned off due to {{ trigger.platform }}";
- };
- }
- ];
- condition =
- { condition = "and";
- conditions = [
+ from = "not_home";
+ to = "home";
+ for.seconds = 30;
+ };
+ action = [
+ {
+ service = "homeassistant.turn_on";
+ entity_id = [
+ "switch.fernseher"
+ "switch.feuer"
+ ];
+ }
{
- condition = "time";
- before = "06:30:00"; #only turn off between 6:30 and 18:00
- after = "18:00:00";
- # weekday = [ "mon" "tue" "wed" "thu" "fri" ];
+ service = "media_player.kodi_call_method";
+ data = {
+ entity_id = "media_player.kodi";
+ method = "Player.Open";
+ item.partymode = "music";
+ };
}
- { # if anybody is still there
- condition = "state";
+ {
+ service = "notify.telegrambot";
+ data = {
+ title = "Bureau Startup";
+ message = "Das Büro wurde eröffnet";
+ };
+ }
+ ];
+ }
+ { alias = "Turn off Fernseher after last in group left";
+ trigger = [
+ { # trigger when movement was detected at the time
+ platform = "state";
entity_id = "group.team";
- state = "not_home";
+ from = "home";
+ to = "not_home";
+ }
+ { # trigger at 18:00 no matter what
+ # to avoid 'everybody left before 18:00:00'
+ platform = "time";
+ at = "18:00:00";
}
];
- };
- }
-]
+ action = [
+ {
+ service = "homeassistant.turn_off";
+ entity_id = [
+ "switch.fernseher"
+ "switch.feuer"
+ "light.status_felix"
+ "light.status_daniel"
+ ];
+ }
+ {
+ service = "notify.telegrambot";
+ data_template = {
+ title = "Bureau Shutdown";
+ message = "All devices are turned off due to {{ trigger.platform }}";
+ };
+ }
+ ];
+ condition =
+ { condition = "and";
+ conditions = [
+ {
+ condition = "time";
+ before = "06:30:00"; #only turn off between 6:30 and 18:00
+ after = "18:00:00";
+ # weekday = [ "mon" "tue" "wed" "thu" "fri" ];
+ }
+ { # if anybody is still there
+ condition = "state";
+ entity_id = "group.team";
+ state = "not_home";
+ }
+ ];
+ };
+ }
+ ];
+}
diff --git a/makefu/2configs/bureautomation/automation/hass-restart.nix b/makefu/2configs/bureautomation/automation/hass-restart.nix
index be16f6966..3b3ce0599 100644
--- a/makefu/2configs/bureautomation/automation/hass-restart.nix
+++ b/makefu/2configs/bureautomation/automation/hass-restart.nix
@@ -1,31 +1,34 @@
-[
- { alias = "State on HA start-up";
- trigger = {
- platform = "homeassistant";
- event = "start";
- };
- action = [
- # Startup State
- { service = "mqtt.publish";
- data = {
- topic = "/bam/sonoffs/cmnd/state";
- payload = "";
- };
- }
- # Firmware Version
- { service = "mqtt.publish";
- data = {
- topic = "/bam/sonoffs/cmnd/status";
- payload = "2";
- };
- }
- # Will trigger restart of all devices!
- #{ service = "mqtt.publish";
- # data = {
- # topic = "sonoffs/cmnd/SetOption59"; # configure sending state on power change
- # payload = "1";
- # };
- #}
- ];
- }
-]
+{
+ services.home-assistant.config.automation =
+ [
+ { alias = "State on HA start-up";
+ trigger = {
+ platform = "homeassistant";
+ event = "start";
+ };
+ action = [
+ # Startup State
+ { service = "mqtt.publish";
+ data = {
+ topic = "/bam/sonoffs/cmnd/state";
+ payload = "";
+ };
+ }
+ # Firmware Version
+ { service = "mqtt.publish";
+ data = {
+ topic = "/bam/sonoffs/cmnd/status";
+ payload = "2";
+ };
+ }
+ # Will trigger restart of all devices!
+ #{ service = "mqtt.publish";
+ # data = {
+ # topic = "sonoffs/cmnd/SetOption59"; # configure sending state on power change
+ # payload = "1";
+ # };
+ #}
+ ];
+ }
+ ];
+}
diff --git a/makefu/2configs/bureautomation/automation/nachtlicht.nix b/makefu/2configs/bureautomation/automation/nachtlicht.nix
index ec6fa20c7..ade89418d 100644
--- a/makefu/2configs/bureautomation/automation/nachtlicht.nix
+++ b/makefu/2configs/bureautomation/automation/nachtlicht.nix
@@ -1,35 +1,38 @@
-[
- # 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
- {
- alias = "Turn on Nachtlicht at dusk"; # when it gets dim
- trigger =
- { platform = "numeric_state";
- entity_id = "sun.sun";
- value_template = "{{ state.attributes.elevation }}";
- below = 10;
+{
+ 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
+ {
+ alias = "Turn on Nachtlicht at dusk"; # when it gets dim
+ trigger =
+ { platform = "numeric_state";
+ entity_id = "sun.sun";
+ value_template = "{{ state.attributes.elevation }}";
+ below = 10;
- };
- action =
- { service = "homeassistant.turn_on";
- entity_id = [ "group.nachtlicht" ];
- };
- }
- {
- alias = "Turn off Nachtlicht at dawn";
- trigger =
- { platform = "sun";
- event = "sunrise";
- offset = "01:30:00"; # on dawn
- };
- # TODO: when somebody is still in the buero
- # condition =
- #{
- #};
- action =
- { service = "homeassistant.turn_off";
- entity_id = [ "group.nachtlicht" ];
- };
- }
-]
+ };
+ action =
+ { service = "homeassistant.turn_on";
+ entity_id = [ "group.nachtlicht" ];
+ };
+ }
+ {
+ alias = "Turn off Nachtlicht at dawn";
+ trigger =
+ { platform = "sun";
+ event = "sunrise";
+ offset = "01:30:00"; # on dawn
+ };
+ # TODO: when somebody is still in the buero
+ # condition =
+ #{
+ #};
+ action =
+ { service = "homeassistant.turn_off";
+ entity_id = [ "group.nachtlicht" ];
+ };
+ }
+ ];
+}
diff --git a/makefu/2configs/bureautomation/automation/schlechteluft.nix b/makefu/2configs/bureautomation/automation/schlechteluft.nix
index 370334743..ea1d44515 100644
--- a/makefu/2configs/bureautomation/automation/schlechteluft.nix
+++ b/makefu/2configs/bureautomation/automation/schlechteluft.nix
@@ -1,71 +1,75 @@
let
long_threshold = 30;
-in [
- {
- alias = "Bad Air Alarm 60 seconds";
- trigger =
- { platform = "numeric_state";
- entity_id = "sensor.air_quality";
- above = 1523;
- for.seconds = 60;
- };
- condition = {
- condition = "and";
- conditions = [
- { condition = "state";
- entity_id = "group.team";
- state = "home";
- }
- { condition = "time";
- after = "06:00:00";
- before = "20:00:00";
+in
+{
+ services.home-assistant.config.automation =
+ [
+ {
+ alias = "Bad Air Alarm 60 seconds";
+ trigger =
+ { platform = "numeric_state";
+ entity_id = "sensor.air_quality";
+ above = 1523;
+ for.seconds = 60;
+ };
+ condition = {
+ condition = "and";
+ conditions = [
+ { condition = "state";
+ entity_id = "group.team";
+ state = "home";
+ }
+ { condition = "time";
+ after = "06:00:00";
+ before = "20:00:00";
+ }
+ ];
+ };
+
+ action = [
+ { service = "homeassistant.turn_on";
+ entity_id = [
+ "script.schlechteluft"
+ ];
}
];
- };
-
- action = [
- { service = "homeassistant.turn_on";
- entity_id = [
- "script.schlechteluft"
+ }
+ {
+ alias = "Bad Air Alarm ${toString long_threshold} Minutes";
+ trigger =
+ { platform = "numeric_state";
+ entity_id = "sensor.air_quality";
+ above = 1523;
+ for.minutes = long_threshold;
+ };
+ condition = {
+ condition = "and";
+ conditions = [
+ { condition = "state";
+ entity_id = "group.team";
+ state = "home";
+ }
+ { condition = "time";
+ after = "06:00:00";
+ before = "20:00:00";
+ }
];
- }
- ];
- }
- {
- alias = "Bad Air Alarm ${toString long_threshold} Minutes";
- trigger =
- { platform = "numeric_state";
- entity_id = "sensor.air_quality";
- above = 1523;
- for.minutes = long_threshold;
- };
- condition = {
- condition = "and";
- conditions = [
- { condition = "state";
- entity_id = "group.team";
- state = "home";
+ };
+
+ action = [
+ { service = "homeassistant.turn_on";
+ entity_id = [
+ "script.schlechteluft"
+ ];
}
- { condition = "time";
- after = "06:00:00";
- before = "20:00:00";
+ { service = "tts.google_say";
+ entity_id = "media_player.mpd";
+ data_template = {
+ message = "BEEP BEEP - Die luft ist schon ${toString long_threshold} Minuten schlecht! Student Nummer {{ range(1,500) | random }}, öffne ein Fenster.";
+ language = "de";
+ };
}
];
- };
-
- action = [
- { service = "homeassistant.turn_on";
- entity_id = [
- "script.schlechteluft"
- ];
- }
- { service = "tts.google_say";
- entity_id = "media_player.mpd";
- data_template = {
- message = "BEEP BEEP - Die luft ist schon ${toString long_threshold} Minuten schlecht! Student Nummer {{ range(1,500) | random }}, öffne ein Fenster.";
- language = "de";
- };
- }
- ];
- }
-]
+ }
+ ];
+}
diff --git a/makefu/2configs/bureautomation/binary_sensor/buttons.nix b/makefu/2configs/bureautomation/binary_sensor/buttons.nix
index e23c4a362..20590a6b3 100644
--- a/makefu/2configs/bureautomation/binary_sensor/buttons.nix
+++ b/makefu/2configs/bureautomation/binary_sensor/buttons.nix
@@ -12,6 +12,9 @@ let
# expire_after = "5"; #expire after 5 seconds
qos = 1;
};
-in [
- (tasmota_button "RedButton" "redbutton")
-]
+in {
+ services.home-assistant.config.binary_sensor =
+ [
+ (tasmota_button "RedButton" "redbutton")
+ ];
+}
diff --git a/makefu/2configs/bureautomation/binary_sensor/motion.nix b/makefu/2configs/bureautomation/binary_sensor/motion.nix
index ad8fab038..0c5a808e0 100644
--- a/makefu/2configs/bureautomation/binary_sensor/motion.nix
+++ b/makefu/2configs/bureautomation/binary_sensor/motion.nix
@@ -1,12 +1,15 @@
-[
- { platform = "mqtt";
- device_class = "motion";
- name = "Motion";
- state_topic = "/bam/easy2/movement/Switch";
- payload_on = "1";
- payload_off = "0";
- availability_topic = "/bam/easy2/tele/LWT";
- payload_available = "Online";
- payload_not_available = "Offline";
- }
-]
+{
+ services.home-assistant.config.binary_sensor =
+ [
+ { platform = "mqtt";
+ device_class = "motion";
+ name = "Motion";
+ state_topic = "/bam/easy2/movement/Switch";
+ payload_on = "1";
+ payload_off = "0";
+ availability_topic = "/bam/easy2/tele/LWT";
+ payload_available = "Online";
+ payload_not_available = "Offline";
+ }
+ ];
+}
diff --git a/makefu/2configs/bureautomation/camera/comic.nix b/makefu/2configs/bureautomation/camera/comic.nix
index a523d032e..ae24760e3 100644
--- a/makefu/2configs/bureautomation/camera/comic.nix
+++ b/makefu/2configs/bureautomation/camera/comic.nix
@@ -1,10 +1,13 @@
-[
- { name = "Poorly Drawn Lines";
- platform = "generic";
- still_image_url = http://127.0.0.1:8123/local/lines.png ;
- }
- { name = "XKCD";
- platform = "generic";
- still_image_url = http://127.0.0.1:8123/local/xkcd.png ;
- }
-]
+{
+ services.home-assistant.config.camera =
+ [
+ { name = "Poorly Drawn Lines";
+ platform = "generic";
+ still_image_url = http://127.0.0.1:8123/local/lines.png ;
+ }
+ { name = "XKCD";
+ platform = "generic";
+ still_image_url = http://127.0.0.1:8123/local/xkcd.png ;
+ }
+ ];
+}
diff --git a/makefu/2configs/bureautomation/camera/stuttgart.nix b/makefu/2configs/bureautomation/camera/stuttgart.nix
index 78cbeb3e2..0badcb285 100644
--- a/makefu/2configs/bureautomation/camera/stuttgart.nix
+++ b/makefu/2configs/bureautomation/camera/stuttgart.nix
@@ -5,22 +5,26 @@ let
inherit name still_image_url;
platform = "generic";
};
-in [
- ( 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 )
- ( cam "Schoch Areal" https://webcam.stuttgart.de/wcam004/current.jpg )
- ( cam "Leuze" https://webcam.stuttgart.de/wcam005/current.jpg )
- ( cam "Straße Wilhelma" https://webcam.stuttgart.de/wcam006/current.jpg )
- ( cam "Fernsehturm 1" http://webcam.fernsehturmstuttgart.com/current.jpg )
- ( cam "Fernsehturm 2" http://webcam.fernsehturmstuttgart.com/current2.jpg )
- ( cam "Feuerbach Lemberg" http://www.regio7.de/handy/current.jpg )
- ( cam "Flughafen Stuttgart 1" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam2.jpg )
- ( cam "Flughafen Stuttgart 2" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam5.jpg )
- ( cam "Flughafen Stuttgart 3" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam7.jpg )
- ( cam "S21 1" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-03/s21-turm03.jpg )
- ( cam "S21 2" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-02/s21-turm-02.jpg )
- ( 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 )
-]
+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 )
+ ( cam "Schoch Areal" https://webcam.stuttgart.de/wcam004/current.jpg )
+ ( cam "Leuze" https://webcam.stuttgart.de/wcam005/current.jpg )
+ ( cam "Straße Wilhelma" https://webcam.stuttgart.de/wcam006/current.jpg )
+ ( cam "Fernsehturm 1" http://webcam.fernsehturmstuttgart.com/current.jpg )
+ ( cam "Fernsehturm 2" http://webcam.fernsehturmstuttgart.com/current2.jpg )
+ ( cam "Feuerbach Lemberg" http://www.regio7.de/handy/current.jpg )
+ ( cam "Flughafen Stuttgart 1" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam2.jpg )
+ ( cam "Flughafen Stuttgart 2" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam5.jpg )
+ ( cam "Flughafen Stuttgart 3" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam7.jpg )
+ ( cam "S21 1" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-03/s21-turm03.jpg )
+ ( cam "S21 2" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-02/s21-turm-02.jpg )
+ ( 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 )
+ ];
+}
diff --git a/makefu/2configs/bureautomation/camera/verkehrskamera.nix b/makefu/2configs/bureautomation/camera/verkehrskamera.nix
index f2dfdcd91..f09dc9423 100644
--- a/makefu/2configs/bureautomation/camera/verkehrskamera.nix
+++ b/makefu/2configs/bureautomation/camera/verkehrskamera.nix
@@ -1,14 +1,17 @@
-[
- { name = "Baumarkt";
- platform = "generic";
- still_image_url = http://t4915209254324-p80-c0-h6jv2afnujcoftrcstsafb45kdrqv4buy.webdirect.mdex.de/oneshotimage ;# baumarkt
- }
- { name = "Autobahn Heilbronn";
- platform = "generic";
- still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K10 ;
- }
- { name = "Autobahn Singen";
- platform = "generic";
- still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K11 ;
- }
-]
+{
+ services.home-assistant.config.camera =
+ [
+ { name = "Baumarkt";
+ platform = "generic";
+ still_image_url = http://t4915209254324-p80-c0-h6jv2afnujcoftrcstsafb45kdrqv4buy.webdirect.mdex.de/oneshotimage ;# baumarkt
+ }
+ { name = "Autobahn Heilbronn";
+ platform = "generic";
+ still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K10 ;
+ }
+ { name = "Autobahn Singen";
+ platform = "generic";
+ still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K11 ;
+ }
+ ];
+}
diff --git a/makefu/2configs/bureautomation/default.nix b/makefu/2configs/bureautomation/default.nix
index cd598f0aa..7e8b6a4d3 100644
--- a/makefu/2configs/bureautomation/default.nix
+++ b/makefu/2configs/bureautomation/default.nix
@@ -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 );
};
};
}
diff --git a/makefu/2configs/bureautomation/device_tracker/openwrt.nix b/makefu/2configs/bureautomation/device_tracker/openwrt.nix
index 5de216474..6b0144129 100644
--- a/makefu/2configs/bureautomation/device_tracker/openwrt.nix
+++ b/makefu/2configs/bureautomation/device_tracker/openwrt.nix
@@ -1,16 +1,19 @@
# requires `opkg install luci-mod-rpc` on router
# see https://www.home-assistant.io/components/luci/
-[
- { platform = "luci";
- host = "192.168.8.1";
- username = "root";
- password = import <secrets/hass/router.nix>;
- interval_seconds = 30; # instead of 12seconds
- consider_home = 300; # 5 minutes timeout
- new_device_defaults = {
- track_new_devices = true;
- hide_if_away = false;
- };
- }
-]
+{
+ services.home-assistant.config.device_tracker =
+ [
+ { platform = "luci";
+ host = "192.168.8.1";
+ username = "root";
+ password = import <secrets/hass/router.nix>;
+ interval_seconds = 30; # instead of 12seconds
+ consider_home = 300; # 5 minutes timeout
+ new_device_defaults = {
+ track_new_devices = true;
+ hide_if_away = false;
+ };
+ }
+ ];
+}
diff --git a/makefu/2configs/bureautomation/light/buzzer.nix b/makefu/2configs/bureautomation/light/buzzer.nix
index 2067e47bf..bc2ba4e57 100644
--- a/makefu/2configs/bureautomation/light/buzzer.nix
+++ b/makefu/2configs/bureautomation/light/buzzer.nix
@@ -21,8 +21,10 @@ let
optimistic = false;
qos = 0;
};
-in
-[
-# (tasmota_pwm "RedButton LED" "redbutton" 1 1023) #LED PWM1
- (tasmota_pwm "RedButton Buzzer" "redbutton" 2 512) #buzzer PWM2
-]
+in {
+ services.home-assistant.config.light =
+ [
+ # (tasmota_pwm "RedButton LED" "redbutton" 1 1023) #LED PWM1
+ (tasmota_pwm "RedButton Buzzer" "redbutton" 2 512) #buzzer PWM2
+ ];
+}
diff --git a/makefu/2configs/bureautomation/light/statuslight.nix b/makefu/2configs/bureautomation/light/statuslight.nix
index c9d301758..de65a2379 100644
--- a/makefu/2configs/bureautomation/light/statuslight.nix
+++ b/makefu/2configs/bureautomation/light/statuslight.nix
@@ -48,9 +48,11 @@ let
12 # fire pattern
];
};
-in
-[
- (tasmota_rgb "Status Felix" "status1")
- (tasmota_rgb "Status Daniel" "status2")
- (tasmota_rgb "Buslicht" "buslicht")
-]
+in {
+ services.home-assistant.config.light =
+ [
+ (tasmota_rgb "Status Felix" "status1")
+ (tasmota_rgb "Status Daniel" "status2")
+ (tasmota_rgb "Buslicht" "buslicht")
+ ];
+}
diff --git a/makefu/2configs/bureautomation/multi/10h_timers.nix b/makefu/2configs/bureautomation/multi/10h_timers.nix
index a30fb28b0..6edcde4b0 100644
--- a/makefu/2configs/bureautomation/multi/10h_timers.nix
+++ b/makefu/2configs/bureautomation/multi/10h_timers.nix
@@ -198,11 +198,13 @@ let
];
in
{
- timer =lib.fold lib.recursiveUpdate {}
- (map tmr_10h persons);
- automation = (lib.flatten (map automation_10h persons));
- script = lib.fold lib.recursiveUpdate {} (
- (map announce_user persons) ++
- (map zu_lange_user persons)
- );
+ services.home-assistant.config = {
+ timer =lib.fold lib.recursiveUpdate {}
+ (map tmr_10h persons);
+ automation = (lib.flatten (map automation_10h persons));
+ script = lib.fold lib.recursiveUpdate {} (
+ (map announce_user persons) ++
+ (map zu_lange_user persons)
+ );
+ };
}
diff --git a/makefu/2configs/bureautomation/multi/README.md b/makefu/2configs/bureautomation/multi/README.md
deleted file mode 100644
index baad87fda..000000000
--- a/makefu/2configs/bureautomation/multi/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Combination Folder
-files return a dictionary of different types used in home-assistant instead of
-a single thing.
diff --git a/makefu/2configs/bureautomation/multi/aramark.nix b/makefu/2configs/bureautomation/multi/aramark.nix
index ebe2cde81..45fadb082 100644
--- a/makefu/2configs/bureautomation/multi/aramark.nix
+++ b/makefu/2configs/bureautomation/multi/aramark.nix
@@ -12,13 +12,16 @@ let
((aramark "${menue}/price" "${menue} Preis") // { unit_of_measurement = "€"; })
];
in
-{
- sensor = (aramark_menue "Menü 1")
- ++ (aramark_menue "Menü 2")
- ++ (aramark_menue "Mercato")
- ++ (aramark_menue "Aktion");
- binary_sensor =
- [
- ((aramark "pommes" "Pommes" ) // { payload_on = "True"; payload_off = "False"; })
- ];
+ {
+ services.home-assistant.config =
+ {
+ sensor = (aramark_menue "Menü 1")
+ ++ (aramark_menue "Menü 2")
+ ++ (aramark_menue "Mercato")
+ ++ (aramark_menue "Aktion");
+ binary_sensor =
+ [
+ ((aramark "pommes" "Pommes" ) // { payload_on = "True"; payload_off = "False"; })
+ ];
+ };
}
diff --git a/makefu/2configs/bureautomation/multi/daily-standup.nix b/makefu/2configs/bureautomation/multi/daily-standup.nix
index 38fb22c1a..063def1ef 100644
--- a/makefu/2configs/bureautomation/multi/daily-standup.nix
+++ b/makefu/2configs/bureautomation/multi/daily-standup.nix
@@ -1,4 +1,4 @@
-{ lib }:
+{lib, ... }:
let
random_daily_text = ''{{ [
"Es ist so weit, es ist Standup Zeit!",
@@ -9,46 +9,49 @@ let
"Morgens, halb elf in Deutschland - das Standupchen" ] | random }}'';
in {
- script =
- { "random_daily" = {
- alias = "Random Daily Introduction";
+ services.home-assistant.config =
+ {
+ script =
+ { "random_daily" = {
+ alias = "Random Daily Introduction";
- sequence = [
- { service = "media_player.play_media";
- data = {
- entity_id = "media_player.mpd";
- media_content_type = "playlist";
- media_content_id = "ansage";
- };
- }
- { delay.seconds = 5; }
- { service = "tts.google_say";
- entity_id = "media_player.mpd";
- data_template = {
- message = random_daily_text;
- language = "de";
- };
- }
- ];
- };
- };
- automation = [
- {
- alias = "Daily Standup";
- trigger = {
- platform = "time";
- at = "10:35:00";
+ sequence = [
+ { service = "media_player.play_media";
+ data = {
+ entity_id = "media_player.mpd";
+ media_content_type = "playlist";
+ media_content_id = "ansage";
+ };
+ }
+ { delay.seconds = 5; }
+ { service = "tts.google_say";
+ entity_id = "media_player.mpd";
+ data_template = {
+ message = random_daily_text;
+ language = "de";
+ };
+ }
+ ];
};
- action =
- [
- { service = "homeassistant.turn_on";
- entity_id = [
- "script.blitz_10s"
- "script.random_daily"
- ];
- }
- ];
+ };
+ automation = [
+ {
+ alias = "Daily Standup";
+ trigger = {
+ platform = "time";
+ at = "10:35:00";
+ };
+ action =
+ [
+ { service = "homeassistant.turn_on";
+ entity_id = [
+ "script.blitz_10s"
+ "script.random_daily"
+ ];
+ }
+ ];
- }
- ];
+ }
+ ];
+ };
}
diff --git a/makefu/2configs/bureautomation/multi/frosch.nix b/makefu/2configs/bureautomation/multi/frosch.nix
index 816539d46..61606d4eb 100644
--- a/makefu/2configs/bureautomation/multi/frosch.nix
+++ b/makefu/2configs/bureautomation/multi/frosch.nix
@@ -1,4 +1,4 @@
-{ lib }:
+{lib, ... }:
# needs: binary_sensor.pommes
# notify.matrix_notify
let
@@ -17,83 +17,87 @@ 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 {
- sensor = [
- { platform = "mqtt";
- name = "frosch brightness";
- device_class = "illuminance";
- state_topic = "/bam/frosch/sensor/brightness/state";
- availability_topic = "/bam/frosch/status";
- payload_available = "online";
- payload_not_available = "offline";
- }
- ];
- binary_sensor = [
- { platform = "mqtt";
- name = "frosch auge";
- state_topic = "/bam/frosch/binary_sensor/froschauge/state";
- availability_topic = "/bam/frosch/status";
- payload_available = "online";
- payload_not_available = "offline";
- }
- ];
- switch = [
- { platform = "mqtt";
- name = "frosch blasen";
- state_topic = "/bam/frosch/switch/blasen/state";
- command_topic = "/bam/frosch/switch/blasen/command";
- availability_topic = "/bam/frosch/status";
- payload_available = "online";
- payload_not_available = "offline";
- }
- ];
- light = [];
- automation = [
- { alias = "Pommeszeit";
- trigger = {
- platform = "time";
- at = "11:00:00";
+in
+{
+ services.home-assistant.config =
+ {
+ sensor = [
+ { platform = "mqtt";
+ name = "frosch brightness";
+ device_class = "illuminance";
+ state_topic = "/bam/frosch/sensor/brightness/state";
+ availability_topic = "/bam/frosch/status";
+ payload_available = "online";
+ payload_not_available = "offline";
+ }
+ ];
+ binary_sensor = [
+ { platform = "mqtt";
+ name = "frosch auge";
+ state_topic = "/bam/frosch/binary_sensor/froschauge/state";
+ availability_topic = "/bam/frosch/status";
+ payload_available = "online";
+ payload_not_available = "offline";
+ }
+ ];
+ switch = [
+ { platform = "mqtt";
+ name = "frosch blasen";
+ state_topic = "/bam/frosch/switch/blasen/state";
+ command_topic = "/bam/frosch/switch/blasen/command";
+ availability_topic = "/bam/frosch/status";
+ payload_available = "online";
+ payload_not_available = "offline";
+ }
+ ];
+ light = [];
+ automation = [
+ { alias = "Pommeszeit";
+ trigger = {
+ platform = "time";
+ at = "11:00:00";
+ };
+ condition = {
+ condition = "state";
+ entity_id = "binary_sensor.pommes"; # from multi/aramark.nix
+ state = "on";
+ };
+ action = [
+ { service = "homeassistant.turn_on";
+ entity_id = [
+ "script.pommes_announce"
+ "script.seifenblasen_30s" # from script/multi_blink.nix
+ ];
+ }
+ ];
+ }
+ ];
+ script = {
+ pommes_announce = {
+ alias = "Random Pommes announce";
+ sequence = [
+ {
+ service = "media_player.play_media";
+ data = {
+ entity_id = "media_player.mpd";
+ media_content_type = "playlist";
+ media_content_id = "ansage";
+ };
+ }
+ { delay.seconds = 5; }
+ {
+ service = "tts.google_say";
+ entity_id = "media_player.mpd";
+ data_template = {
+ message = random_pommes;
+ language = "de";
+ };
+ }
+ { service = "notify.matrix_notify";
+ data_template.message = random_pommes;
+ }
+ ];
};
- condition = {
- condition = "state";
- entity_id = "binary_sensor.pommes"; # from multi/aramark.nix
- state = "on";
- };
- action = [
- { service = "homeassistant.turn_on";
- entity_id = [
- "script.pommes_announce"
- "script.seifenblasen_30s" # from script/multi_blink.nix
- ];
- }
- ];
- }
- ];
- script = {
- pommes_announce = {
- alias = "Random Pommes announce";
- sequence = [
- {
- service = "media_player.play_media";
- data = {
- entity_id = "media_player.mpd";
- media_content_type = "playlist";
- media_content_id = "ansage";
- };
- }
- { delay.seconds = 5; }
- {
- service = "tts.google_say";
- entity_id = "media_player.mpd";
- data_template = {
- message = random_pommes;
- language = "de";
- };
- }
- { service = "notify.matrix_notify";
- data_template.message = random_pommes;
- }
- ];
};
};
}
diff --git a/makefu/2configs/bureautomation/multi/matrix.nix b/makefu/2configs/bureautomation/multi/matrix.nix
index 4fcfe8da4..b9b8fc4e8 100644
--- a/makefu/2configs/bureautomation/multi/matrix.nix
+++ b/makefu/2configs/bureautomation/multi/matrix.nix
@@ -8,58 +8,62 @@
# name: my_command
let
mom_room = "!kTQjvTQvfVsvfEtmth:thales.citadel.team";
-in {
- matrix =
+in
+{
+ services.home-assistant.config =
{
- # secrets:
- # homeserver, username, password
- homeserver = "https://ext01.citadel.team";
- rooms = [
- mom_room
- ];
- commands = [
- {
- # alternative: expression for regexp
- word = "version";
- name = "version";
- }
- {
- word = "luftqualität";
- name = "luftqualitaet";
- }
- ];
- } // (builtins.fromJSON (builtins.readFile
- <secrets/hass/citadel-bot.json>));
- automation = [
+ matrix =
{
- alias = "React to !version";
- trigger = {
- platform = "event";
- event_type = "matrix_command";
- event_data.command = "version";
- };
- action = {
- service = "notify.matrix_notify";
- data_template.message = "Running home-assistant {{states.sensor.current_version.state}}";
- };
- }
- {
- alias = "React to !luftqualität";
- trigger = {
- platform = "event";
- event_type = "matrix_command";
- event_data.command = "luftqualitaet";
- };
- action = {
- service = "notify.matrix_notify";
- data_template.message = ''Temp: {{states.sensor.notizen_temperature.state_with_unit | replace (" ","")}}, Hum:{{states.sensor.notizen_humidity.state_with_unit | replace (" ","")}}, airquality:{{states.sensor.air_quality.state_with_unit}}'';
- };
- }
+ # secrets:
+ # homeserver, username, password
+ homeserver = "https://ext01.citadel.team";
+ rooms = [
+ mom_room
+ ];
+ commands = [
+ {
+ # alternative: expression for regexp
+ word = "version";
+ name = "version";
+ }
+ {
+ word = "luftqualität";
+ name = "luftqualitaet";
+ }
+ ];
+ } // (builtins.fromJSON (builtins.readFile
+ <secrets/hass/citadel-bot.json>));
+ automation = [
+ {
+ alias = "React to !version";
+ trigger = {
+ platform = "event";
+ event_type = "matrix_command";
+ event_data.command = "version";
+ };
+ action = {
+ service = "notify.matrix_notify";
+ data_template.message = "Running home-assistant {{states.sensor.current_version.state}}";
+ };
+ }
+ {
+ alias = "React to !luftqualität";
+ trigger = {
+ platform = "event";
+ event_type = "matrix_command";
+ event_data.command = "luftqualitaet";
+ };
+ action = {
+ service = "notify.matrix_notify";
+ data_template.message = ''Temp: {{states.sensor.notizen_temperature.state_with_unit | replace (" ","")}}, Hum:{{states.sensor.notizen_humidity.state_with_unit | replace (" ","")}}, airquality:{{states.sensor.air_quality.state_with_unit}}'';
+ };
+ }
- ];
- notify = [{
- name = "matrix_notify";
- platform = "matrix";
- default_room = mom_room;
- }];
+ ];
+ notify = [{
+ name = "matrix_notify";
+ platform = "matrix";
+ default_room = mom_room;
+ }];
+ };
}
diff --git a/makefu/2configs/bureautomation/multi/mittagessen.nix b/makefu/2configs/bureautomation/multi/mittagessen.nix
index 2a9993e92..52ec99a92 100644
--- a/makefu/2configs/bureautomation/multi/mittagessen.nix
+++ b/makefu/2configs/bureautomation/multi/mittagessen.nix
@@ -38,52 +38,55 @@ 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 {
- automation = [
- { alias = "Mittagessen";
- trigger = {
- platform = "time";
- at = "12:30:00";
+in
+{
+ services.home-assistant.config = {
+ automation = [
+ { alias = "Mittagessen";
+ trigger = {
+ platform = "time";
+ at = "12:30:00";
+ };
+ action = [
+ { service = "homeassistant.turn_on";
+ entity_id = [
+ "script.mittagessen_announce"
+ "script.blitz_10s"
+ "script.mittagessenlicht"
+ ];
+ }
+ ];
+ }
+ ];
+ script = {
+ mittagessenlicht = (flash_entity {
+ entity = "switch.bauarbeiterlampe";
+ alias = "Bauarbeiterlampe Mittagessenlicht";
+ delay = 1000;
+ count = 5;
+ });
+ mittagessen_announce = {
+ alias = "Random Mittagessen announce";
+ sequence = [
+ {
+ service = "media_player.play_media";
+ data = {
+ entity_id = "media_player.mpd";
+ media_content_type = "playlist";
+ media_content_id = "ansage";
+ };
+ }
+ { delay.seconds = 5; }
+ {
+ service = "tts.google_say";
+ entity_id = "media_player.mpd";
+ data_template = {
+ message = random_mittagessen;
+ language = "de";
+ };
+ }
+ ];
};
- action = [
- { service = "homeassistant.turn_on";
- entity_id = [
- "script.mittagessen_announce"
- "script.blitz_10s"
- "script.mittagessenlicht"
- ];
- }
- ];
- }
- ];
- script = {
- mittagessenlicht = (flash_entity {
- entity = "switch.bauarbeiterlampe";
- alias = "Bauarbeiterlampe Mittagessenlicht";
- delay = 1000;
- count = 5;
- });
- mittagessen_announce = {
- alias = "Random Mittagessen announce";
- sequence = [
- {
- service = "media_player.play_media";
- data = {
- entity_id = "media_player.mpd";
- media_content_type = "playlist";
- media_content_id = "ansage";
- };
- }
- { delay.seconds = 5; }
- {
- service = "tts.google_say";
- entity_id = "media_player.mpd";
- data_template = {
- message = random_mittagessen;
- language = "de";
- };
- }
- ];
};
};
}
diff --git a/makefu/2configs/bureautomation/person/team.nix b/makefu/2configs/bureautomation/person/team.nix
index 2a15abaf5..bf3d09c57 100644
--- a/makefu/2configs/bureautomation/person/team.nix
+++ b/makefu/2configs/bureautomation/person/team.nix
@@ -1,72 +1,81 @@
-[
- { name = "Thorsten";
- id = 1;
- device_trackers = [
- "device_tracker.thorsten_phone"
- #"device_tracker.thorsten_arbeitphone"
- ];
- }
- { name = "Felix";
- id = 2;
- device_trackers = [
- "device_tracker.felix_phone"
- "device_tracker.felix_laptop"
- ];
- }
- { name = "Ecki";
- id = 3;
- device_trackers = [
- "device_tracker.ecki_phone"
- "device_tracker.ecki_tablet"
- ];
- }
- { name = "Daniel";
- id = 4;
- device_trackers = [
- "device_tracker.daniel_phone"
- ];
- }
- { name = "Thierry";
- id = 5;
- device_trackers = [
- "device_tracker.thierry_phone"
- ];
- }
- { name = "Frank";
- id = 6;
- device_trackers = [
- "device_tracker.frank_phone"
- ];
- }
- { name = "Carsten";
- id = 7;
- device_trackers = [
- "device_tracker.carsten_phone"
- ];
- }
- { name = "Emeka";
- id = 8;
- device_trackers = [
- "device_tracker.emeka_phone"
- ];
- }
- { name = "Sabine";
- id = 9;
- device_trackers = [
- "device_tracker.sabine_phone"
- ];
- }
- { name = "Tobias";
- id = 10;
- device_trackers = [
- "device_tracker.tobias_phone"
- ];
- }
- { name = "Tancrede";
- id = 11;
- device_trackers = [
- "device_tracker.tancrede_phone"
- "device_tracker.tancrede_laptop"
- ];
- }
-]
+{
+ services.home-assistant.config.person =
+ [
+ { name = "Thorsten";
+ id = 1;
+ device_trackers = [
+ "device_tracker.thorsten_phone"
+ #"device_tracker.thorsten_arbeitphone"
+ ];
+ }
+ { name = "Felix";
+ id = 2;
+ device_trackers = [
+ "device_tracker.felix_phone"
+ "device_tracker.felix_laptop"
+ ];
+ }
+ { name = "Ecki";
+ id = 3;
+ device_trackers = [
+ "device_tracker.ecki_phone"
+ "device_tracker.ecki_tablet"
+ ];
+ }
+ { name = "Daniel";
+ id = 4;
+ device_trackers = [
+ "device_tracker.daniel_phone"
+ ];
+ }
+ { name = "Thierry";
+ id = 5;
+ device_trackers = [
+ "device_tracker.thierry_phone"
+ ];
+ }
+ { name = "Frank";
+ id = 6;
+ device_trackers = [
+ "device_tracker.frank_phone"
+ ];
+ }
+ #{ name = "Carsten";
+ # id = 7;
+ # device_trackers = [
+ # "device_tracker.carsten_phone"
+ # ];
+ #}
+ { name = "Emeka";
+ id = 8;
+ device_trackers = [
+ "device_tracker.emeka_phone"
+ ];
+ }
+ { name = "Sabine";
+ id = 9;
+ device_trackers = [
+ "device_tracker.sabine_phone"
+ ];
+ }
+ #{ 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.chris_phone"
+ ];
+ }
+ ];
+}
diff --git a/makefu/2configs/bureautomation/script/multi_blink.nix b/makefu/2configs/bureautomation/script/multi_blink.nix
index e6acdc303..753918f31 100644
--- a/makefu/2configs/bureautomation/script/multi_blink.nix
+++ b/makefu/2configs/bureautomation/script/multi_blink.nix
@@ -19,39 +19,42 @@ let
) count);
};
in {
- buzz_red_led = (flash_entity {
- entity = "light.redbutton_buzzer";
- alias = "Red Button Buzz";
- count = 4;
- });
- buzz_red_led_fast = (flash_entity {
- entity = "light.redbutton_buzzer";
- delay = 250;
- count = 2;
- alias = "Red Button Buzz fast";
- });
- blitz_10s = (flash_entity {
- entity = "switch.blitzdings";
- delay = 10000;
- count = 1;
- alias = "blitz for 10 seconds";
- });
- blasen_10s = (flash_entity {
- entity = "switch.frosch_blasen";
- delay = 10000;
- count = 1;
- alias = "blasen for 10 seconds";
- });
- blasen_30s = (flash_entity {
- entity = "switch.frosch_blasen";
- delay = 30000;
- count = 1;
- alias = "blasen for 30 seconds";
- });
- schlechteluft = (flash_entity {
- entity = "switch.bauarbeiterlampe";
- alias = "Schlechte Luft Lampe 5 secs";
- delay = 5000;
- count = 1;
- });
+ services.home-assistant.config.script =
+ {
+ buzz_red_led = (flash_entity {
+ entity = "light.redbutton_buzzer";
+ alias = "Red Button Buzz";
+ count = 4;
+ });
+ buzz_red_led_fast = (flash_entity {
+ entity = "light.redbutton_buzzer";
+ delay = 250;
+ count = 2;
+ alias = "Red Button Buzz fast";
+ });
+ blitz_10s = (flash_entity {
+ entity = "switch.blitzdings";
+ delay = 10000;
+ count = 1;
+ alias = "blitz for 10 seconds";
+ });
+ blasen_10s = (flash_entity {
+ entity = "switch.frosch_blasen";
+ delay = 10000;
+ count = 1;
+ alias = "blasen for 10 seconds";
+ });
+ blasen_30s = (flash_entity {
+ entity = "switch.frosch_blasen";
+ delay = 30000;
+ count = 1;
+ alias = "blasen for 30 seconds";
+ });
+ schlechteluft = (flash_entity {
+ entity = "switch.bauarbeiterlampe";
+ alias = "Schlechte Luft Lampe 5 secs";
+ delay = 5000;
+ count = 1;
+ });
+ };
}
diff --git a/makefu/2configs/bureautomation/sensor/airquality.nix b/makefu/2configs/bureautomation/sensor/airquality.nix
index 217fa9595..7d95c3c15 100644
--- a/makefu/2configs/bureautomation/sensor/airquality.nix
+++ b/makefu/2configs/bureautomation/sensor/airquality.nix
@@ -1,9 +1,12 @@
-[
- # coming from 2configs/stats/telegraf/
- { platform = "mqtt";
- name = "Air Quality";
- state_topic = "/telegraf/wbob/airquality";
- value_template = "{{ value_json.fields.value }}";
- unit_of_measurement = "VOC";
- }
-]
+{
+ services.home-assistant.config.sensor =
+ [
+ # coming from 2configs/stats/telegraf/
+ { platform = "mqtt";
+ name = "Air Quality";
+ state_topic = "/telegraf/wbob/airquality";
+ value_template = "{{ value_json.fields.value }}";
+ unit_of_measurement = "VOC";
+ }
+ ];
+}
diff --git a/makefu/2configs/bureautomation/sensor/espeasy.nix b/makefu/2configs/bureautomation/sensor/espeasy.nix
index 4b78ee84e..c68f39f1a 100644
--- a/makefu/2configs/bureautomation/sensor/espeasy.nix
+++ b/makefu/2configs/bureautomation/sensor/espeasy.nix
@@ -24,8 +24,10 @@ let
payload_available = "Online";
payload_not_available = "Offline";
};
-in
-(espeasy_dht22 "easy1") ++
-(espeasy_dht22 "easy2") ++ [
- (espeasy_ds18 "easy3" )
-]
+in {
+ services.home-assistant.config.sensor =
+ (espeasy_dht22 "easy1") ++
+ (espeasy_dht22 "easy2") ++ [
+ (espeasy_ds18 "easy3" )
+ ];
+}
diff --git a/makefu/2configs/bureautomation/sensor/influxdb.nix b/makefu/2configs/bureautomation/sensor/influxdb.nix
deleted file mode 100644
index 820a56c4d..000000000
--- a/makefu/2configs/bureautomation/sensor/influxdb.nix
+++ /dev/null
@@ -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";
- # }
- # ];
- #}
-]
diff --git a/makefu/2configs/bureautomation/sensor/outside.nix b/makefu/2configs/bureautomation/sensor/outside.nix
index 596473f17..b5d25ecd3 100644
--- a/makefu/2configs/bureautomation/sensor/outside.nix
+++ b/makefu/2configs/bureautomation/sensor/outside.nix
@@ -1,25 +1,29 @@
-{lib,...}: [
- { platform = "darksky";
- api_key = lib.removeSuffix "\n"
- (builtins.readFile <secrets/hass/darksky.apikey>);
- language = "de";
- monitored_conditions = [
- "summary" "icon"
- "nearest_storm_distance" "precip_probability"
- "precip_intensity"
- "temperature" # "temperature_high" "temperature_low"
- "apparent_temperature"
- "hourly_summary" # next 24 hours text
- "humidity"
- "pressure"
- "uv_index"
- ];
- units = "si" ;
- scan_interval = "00:30:00";
- }
- { platform = "luftdaten";
- name = "Ditzingen";
- sensorid = "5341";
- monitored_conditions = [ "P1" "P2" ];
- }
- ]
+{lib,...}:
+{
+ services.home-assistant.config.sensor =
+ [
+ { platform = "darksky";
+ api_key = lib.removeSuffix "\n"
+ (builtins.readFile <secrets/hass/darksky.apikey>);
+ language = "de";
+ monitored_conditions = [
+ "summary" "icon"
+ "nearest_storm_distance" "precip_probability"
+ "precip_intensity"
+ "temperature" # "temperature_high" "temperature_low"
+ "apparent_temperature"
+ "hourly_summary" # next 24 hours text
+ "humidity"
+ "pressure"
+ "uv_index"
+ ];
+ units = "si" ;
+ scan_interval = "00:30:00";
+ }
+ { platform = "luftdaten";
+ name = "Ditzingen";
+ sensorid = "5341";
+ monitored_conditions = [ "P1" "P2" ];
+ }
+ ];
+}
diff --git a/makefu/2configs/bureautomation/sensor/tasmota_firmware.nix b/makefu/2configs/bureautomation/sensor/tasmota_firmware.nix
index 1a4738e12..f5f063dbf 100644
--- a/makefu/2configs/bureautomation/sensor/tasmota_firmware.nix
+++ b/makefu/2configs/bureautomation/sensor/tasmota_firmware.nix
@@ -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"
- ]
+ ];
+}
diff --git a/makefu/2configs/bureautomation/switch/rfbridge.nix b/makefu/2configs/bureautomation/switch/rfbridge.nix
index 1336549a3..9b9de7793 100644
--- a/makefu/2configs/bureautomation/switch/rfbridge.nix
+++ b/makefu/2configs/bureautomation/switch/rfbridge.nix
@@ -8,10 +8,12 @@ let
payload_available= "Online";
payload_not_available= "Offline";
};
-in
-[
- (bridge "Nachtlicht A" "#414551" "#414554")
- (bridge "Nachtlicht B" "#415151" "#415154")
- (bridge "Nachtlicht C" "#415451" "#415454")
- (bridge "Nachtlicht D" "#41551F" "#415514")
-]
+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")
+ ];
+}
diff --git a/makefu/2configs/bureautomation/switch/tasmota_switch.nix b/makefu/2configs/bureautomation/switch/tasmota_switch.nix
index 115bae0cc..6c5f6b8a6 100644
--- a/makefu/2configs/bureautomation/switch/tasmota_switch.nix
+++ b/makefu/2configs/bureautomation/switch/tasmota_switch.nix
@@ -13,10 +13,13 @@ let
retain = false;
qos = 1;
};
-in [
- (tasmota_plug "Bauarbeiterlampe" "plug")
- (tasmota_plug "Blitzdings" "plug2")
- (tasmota_plug "Fernseher" "plug3")
- (tasmota_plug "Feuer" "plug4")
- (tasmota_plug "Blaulicht" "plug5")
-]
+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")
+ ];
+}
diff --git a/makefu/2configs/default.nix b/makefu/2configs/default.nix
index beba0ac8c..695e8fee6 100644
--- a/makefu/2configs/default.nix
+++ b/makefu/2configs/default.nix
@@ -43,9 +43,6 @@ with import <stockholm/lib>;
boot.tmpOnTmpfs = true;
- systemd.tmpfiles.rules = [
- "d /tmp 1777 root root - -"
- ];
environment.systemPackages = with pkgs; [
jq
diff --git a/makefu/2configs/editor/vim.nix b/makefu/2configs/editor/vim.nix
index 2277ed3a3..5751bf489 100644
--- a/makefu/2configs/editor/vim.nix
+++ b/makefu/2configs/editor/vim.nix
@@ -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 = [
diff --git a/makefu/2configs/gui/base.nix b/makefu/2configs/gui/base.nix
index 9c1d560a0..f991f7649 100644
--- a/makefu/2configs/gui/base.nix
+++ b/makefu/2configs/gui/base.nix
@@ -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
diff --git a/makefu/2configs/ham/automation/firetv_restart.nix b/makefu/2configs/ham/automation/firetv_restart.nix
index 1094d177f..12e0e845a 100644
--- a/makefu/2configs/ham/automation/firetv_restart.nix
+++ b/makefu/2configs/ham/automation/firetv_restart.nix
@@ -7,27 +7,31 @@ let
};
};
sec = seconds: { delay.seconds = seconds; };
-in [
- {
- alias = "Nightly reboot of firetv";
- trigger = {
- platform = "time";
- at = "03:00:00";
- };
- action = [
- (cmd "reboot")
- (sec 90) # go to my music because apparently select_source does not seem to always work
- (cmd "HOME")
- (sec 2)
- (cmd "DOWN")
- (sec 2)
- (cmd "DOWN")
- (sec 2)
- (cmd "ENTER")
- (sec 4)
- (cmd "RIGHT")
- (sec 2)
- (cmd "RIGHT")
- ];
- }
-]
+in
+{
+ services.home-assistant.config.automation =
+ [
+ {
+ alias = "Nightly reboot of firetv";
+ trigger = {
+ platform = "time";
+ at = "03:00:00";
+ };
+ action = [
+ (cmd "reboot")
+ (sec 90) # go to my music because apparently select_source does not seem to always work
+ (cmd "HOME")
+ (sec 2)
+ (cmd "DOWN")
+ (sec 2)
+ (cmd "DOWN")
+ (sec 2)
+ (cmd "ENTER")
+ (sec 4)
+ (cmd "RIGHT")
+ (sec 2)
+ (cmd "RIGHT")
+ ];
+ }
+ ];
+}
diff --git a/makefu/2configs/ham/calendar/nextcloud.nix b/makefu/2configs/ham/calendar/nextcloud.nix
index 0be23ad7b..80e51b348 100644
--- a/makefu/2configs/ham/calendar/nextcloud.nix
+++ b/makefu/2configs/ham/calendar/nextcloud.nix
@@ -2,7 +2,12 @@ let
cred = import <secrets/ham/nextcloud-calendar>;
in
{
- platform = "caldav";
- inherit (cred) username password;
- url = "https://o.euer.krebsco.de/remote.php/dav";
+ services.home-assistant.config.calendar =
+ [
+ {
+ platform = "caldav";
+ inherit (cred) username password;
+ url = "https://o.euer.krebsco.de/remote.php/dav";
+ }
+ ];
}
diff --git a/makefu/2configs/ham/default.nix b/makefu/2configs/ham/default.nix
index 3a6d1952f..9e3f7f669 100644
--- a/makefu/2configs/ham/default.nix
+++ b/makefu/2configs/ham/default.nix
@@ -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;
diff --git a/makefu/2configs/ham/device_tracker/openwrt.nix b/makefu/2configs/ham/device_tracker/openwrt.nix
index 8173fcfcb..0a34f702a 100644
--- a/makefu/2configs/ham/device_tracker/openwrt.nix
+++ b/makefu/2configs/ham/device_tracker/openwrt.nix
@@ -1,10 +1,13 @@
-[
- { platform = "luci";
- host = "192.168.1.5";
- username = "root";
- password = import <secrets/hass/router.nix>;
- interval_seconds = 30; # instead of 12seconds
- consider_home = 300; # 5 minutes timeout
- new_device_defaults.track_new_devices = true;
- }
-]
+{
+ services.home-assistant.config.device_tracker =
+ [
+ { platform = "luci";
+ host = "192.168.1.5";
+ username = "root";
+ password = import <secrets/hass/router.nix>;
+ interval_seconds = 30; # instead of 12seconds
+ consider_home = 300; # 5 minutes timeout
+ new_device_defaults.track_new_devices = true;
+ }
+ ];
+}
diff --git a/makefu/2configs/ham/light/groups.nix b/makefu/2configs/ham/light/groups.nix
new file mode 100644
index 000000000..e1812b68a
--- /dev/null
+++ b/makefu/2configs/ham/light/groups.nix
@@ -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;
+ }
+ ];
+}
diff --git a/makefu/2configs/ham/multi/fliegen-couter.nix b/makefu/2configs/ham/multi/fliegen-couter.nix
index d5c180e03..5b8abb2ff 100644
--- a/makefu/2configs/ham/multi/fliegen-couter.nix
+++ b/makefu/2configs/ham/multi/fliegen-couter.nix
@@ -15,53 +15,57 @@ let
data.entity_id = "counter.${for}_fliegen";
}) incr;
};
-in {
- counter = {
- felix_fliegen = {};
- misa_fliegen = {};
+in
+{
+ services.home-assistant.config =
+ {
+ counter = {
+ felix_fliegen = {};
+ misa_fliegen = {};
+ };
+ automation = [
+ (fly_swat "misa" "btn1" "single" 1)
+ (fly_swat "misa" "btn1" "double" 2)
+ (fly_swat "misa" "btn1" "triple" 3)
+ (fly_swat "felix" "btn2" "single" 1)
+ (fly_swat "felix" "btn2" "double" 2)
+ (fly_swat "felix" "btn2" "triple" 3)
+ {
+ alias = "Send Fly Counter Update";
+ trigger = [
+ {
+ platform = "state";
+ entity_id = "counter.felix_fliegen";
+ }
+ {
+ platform = "state";
+ entity_id = "counter.misa_fliegen";
+ #above = -1;
+ }
+ ];
+ action = {
+ service = "mqtt.publish";
+ data_template = { # gauge-style
+ payload = "{{ trigger.to_state.state }}";
+ topic = "${hlib.prefix}/flycounter/{{ trigger.to_state.object_id }}";
+ };
+ };
+ }
+ {
+ alias = "Reset Fly counters on midnight";
+ trigger = {
+ platform = "time";
+ at = "01:00:00";
+ };
+ action = [
+ { service = "counter.reset";
+ data.entity_id = "counter.misa_fliegen";
+ }
+ { service = "counter.reset";
+ data.entity_id = "counter.felix_fliegen";
+ }
+ ];
+ }
+ ];
};
- automation = [
- (fly_swat "misa" "btn1" "single" 1)
- (fly_swat "misa" "btn1" "double" 2)
- (fly_swat "misa" "btn1" "triple" 3)
- (fly_swat "felix" "btn2" "single" 1)
- (fly_swat "felix" "btn2" "double" 2)
- (fly_swat "felix" "btn2" "triple" 3)
- {
- alias = "Send Fly Counter Update";
- trigger = [
- {
- platform = "state";
- entity_id = "counter.felix_fliegen";
- }
- {
- platform = "state";
- entity_id = "counter.misa_fliegen";
- #above = -1;
- }
- ];
- action = {
- service = "mqtt.publish";
- data_template = { # gauge-style
- payload = "{{ trigger.to_state.state }}";
- topic = "${hlib.prefix}/flycounter/{{ trigger.to_state.object_id }}";
- };
- };
- }
- {
- alias = "Reset Fly counters on midnight";
- trigger = {
- platform = "time";
- at = "01:00:00";
- };
- action = [
- { service = "counter.reset";
- data.entity_id = "counter.misa_fliegen";
- }
- { service = "counter.reset";
- data.entity_id = "counter.felix_fliegen";
- }
- ];
- }
- ];
}
diff --git a/makefu/2configs/ham/multi/kurzzeitwecker.nix b/makefu/2configs/ham/multi/kurzzeitwecker.nix
index 03d0d5aac..bd81465cb 100644
--- a/makefu/2configs/ham/multi/kurzzeitwecker.nix
+++ b/makefu/2configs/ham/multi/kurzzeitwecker.nix
@@ -8,125 +8,128 @@
# notify.telegrambot
let
button = "sensor.zigbee_btn2_click";
-in {
- timer.kurzzeitwecker =
- {
- name = "Zigbee Kurzzeitwecker";
- duration = 300;
- };
- script.add_5_minutes_to_kurzzeitwecker =
- {
- alias = "Add 5 minutes to kurzzeitwecker";
- sequence = [
- { service = "timer.pause";
- entity_id = "timer.kurzzeitwecker";
- }
- { service = "timer.start";
- data_template = {
- entity_id = "timer.kurzzeitwecker";
- duration = ''
- {% set r = state_attr('timer.kurzzeitwecker', 'remaining') ~ '-0000' %}
- {% set t = strptime(r, '%H:%M:%S.%f%z') %}
- {{ (as_timestamp(t) + 300) | timestamp_custom('%H:%M:%S', false) }}
- '';
- };
- }
- ];
- };
- automation =
- [
+in
+{
+ services.home-assistant.config = {
+ timer.kurzzeitwecker =
{
- alias = "Start Timer 5min";
- trigger = {
- platform = "state";
- entity_id = button;
- to = "single";
- };
- condition =
- { condition = "state";
- entity_id = "timer.kurzzeitwecker";
- state = "idle";
- };
-
- action = [
- { service = "timer.start";
- entity_id = "timer.kurzzeitwecker";
- data.duration = "00:05:00";
- }
- {
- service = "notify.telegrambot";
- data.message = "Timer gestartet {{state_attr('timer.kurzzeitwecker', 'remaining') }}, verbleibend ";
- }
- ];
- }
- {
- alias = "Add Timer 5min";
- trigger = {
- platform = "state";
- entity_id = button;
- to = "single";
- };
- condition =
- { condition = "state";
+ name = "Zigbee Kurzzeitwecker";
+ duration = 300;
+ };
+ script.add_5_minutes_to_kurzzeitwecker =
+ {
+ alias = "Add 5 minutes to kurzzeitwecker";
+ sequence = [
+ { service = "timer.pause";
entity_id = "timer.kurzzeitwecker";
- state = "active";
+ }
+ { service = "timer.start";
+ data_template = {
+ entity_id = "timer.kurzzeitwecker";
+ duration = ''
+ {% set r = state_attr('timer.kurzzeitwecker', 'remaining') ~ '-0000' %}
+ {% set t = strptime(r, '%H:%M:%S.%f%z') %}
+ {{ (as_timestamp(t) + 300) | timestamp_custom('%H:%M:%S', false) }}
+ '';
};
-
- action = [
- { service = "homeassistant.turn_on";
- entity_id = "script.add_5_minutes_to_kurzzeitwecker";
- }
- {
- service = "notify.telegrambot";
- data.message = ''Timer um 5 minuten verlängert, {{ state_attr('timer.kurzzeitwecker', 'remaining') | truncate(9,True," ") }} verbleibend '';
}
];
- }
- {
- alias = "Stop timer on double click";
- trigger = [
- {
+ };
+ automation =
+ [
+ {
+ alias = "Start Timer 5min";
+ trigger = {
platform = "state";
entity_id = button;
- to = "double";
- }
- {
+ to = "single";
+ };
+ condition =
+ { condition = "state";
+ entity_id = "timer.kurzzeitwecker";
+ state = "idle";
+ };
+
+ action = [
+ { service = "timer.start";
+ entity_id = "timer.kurzzeitwecker";
+ data.duration = "00:05:00";
+ }
+ {
+ service = "notify.telegrambot";
+ data.message = "Timer gestartet {{state_attr('timer.kurzzeitwecker', 'remaining') }}, verbleibend ";
+ }
+ ];
+ }
+ {
+ alias = "Add Timer 5min";
+ trigger = {
platform = "state";
entity_id = button;
- to = "triple";
- }
- ];
- condition =
- {
- condition = "state";
- entity_id = "timer.kurzzeitwecker";
- state = "active";
- };
+ to = "single";
+ };
+ condition =
+ { condition = "state";
+ entity_id = "timer.kurzzeitwecker";
+ state = "active";
+ };
- action = [
- {
- service = "timer.cancel";
- entity_id = "timer.kurzzeitwecker";
- }
- {
- service = "notify.telegrambot";
- data.message = "Timer gestoppt, abgebrochen";
- }
- ];
- }
- {
- alias = "Timer Finished";
- trigger = {
- platform = "event";
- event_type = "timer.finished";
- event_data.entity_id = "timer.kurzzeitwecker";
- };
- action = [
+ action = [
+ { service = "homeassistant.turn_on";
+ entity_id = "script.add_5_minutes_to_kurzzeitwecker";
+ }
+ {
+ service = "notify.telegrambot";
+ data.message = ''Timer um 5 minuten verlängert, {{ state_attr('timer.kurzzeitwecker', 'remaining') | truncate(9,True," ") }} verbleibend '';
+ }
+ ];
+ }
+ {
+ alias = "Stop timer on double click";
+ trigger = [
+ {
+ platform = "state";
+ entity_id = button;
+ to = "double";
+ }
+ {
+ platform = "state";
+ entity_id = button;
+ to = "triple";
+ }
+ ];
+ condition =
{
- service = "notify.telegrambot";
- data.message = "Timer beendet";
- }
- ];
- }
- ];
+ condition = "state";
+ entity_id = "timer.kurzzeitwecker";
+ state = "active";
+ };
+
+ action = [
+ {
+ service = "timer.cancel";
+ entity_id = "timer.kurzzeitwecker";
+ }
+ {
+ service = "notify.telegrambot";
+ data.message = "Timer gestoppt, abgebrochen";
+ }
+ ];
+ }
+ {
+ alias = "Timer Finished";
+ trigger = {
+ platform = "event";
+ event_type = "timer.finished";
+ event_data.entity_id = "timer.kurzzeitwecker";
+ };
+ action = [
+ {
+ service = "notify.telegrambot";
+ data.message = "Timer beendet";
+ }
+ ];
+ }
+ ];
+ };
}
diff --git a/makefu/2configs/ham/multi/the_playlist.nix b/makefu/2configs/ham/multi/the_playlist.nix
index ad090938c..0d714ea44 100644
--- a/makefu/2configs/ham/multi/the_playlist.nix
+++ b/makefu/2configs/ham/multi/the_playlist.nix
@@ -7,77 +7,80 @@
# automation
# sensor
{
- rest_command = {
- good_song = {
- url = "http://prism.r:8001/good";
- method = "POST";
- };
- bad_song = {
- url = "http://prism.r:8001/skip";
- method = "POST";
- };
- };
- automation = [
- {
- alias = "playlist song publish";
- trigger = {
- #platform = "event";
- #event_data.entity_id = "sensor.the_playlist_song";
- platform = "state";
- entity_id = "sensor.the_playlist_song";
- };
- action = {
- service = "mqtt.publish";
- data = {
- topic = "/ham/the_playlist/song";
- payload_template = "{{ states.sensor.the_playlist_song.state }}";
- };
- };
- }
- {
- alias = "playlist upvote on button";
- trigger = {
- platform = "state";
- entity_id = "binary_sensor.playlist_button_good";
- from = "off";
- to = "on";
+ services.home-assistant.config =
+ {
+ rest_command = {
+ good_song = {
+ url = "http://prism.r:8001/good";
+ method = "POST";
};
- action.service = "rest_command.good_song";
- }
- {
- alias = "playlist downvote on button";
- trigger = {
- platform = "state";
- entity_id = "binary_sensor.playlist_button_bad";
- from = "off";
- to = "on";
+ bad_song = {
+ url = "http://prism.r:8001/skip";
+ method = "POST";
};
- action.service = "rest_command.bad_song";
- }
- ];
- sensor = [
- { platform = "rest";
- name = "pl";
- resource = "http://prism.r:8001/current";
- scan_interval = 30;
- value_template = "1";
- json_attributes = [ "name" "filename" "youtube" ];
- }
- { platform = "template";
- sensors = {
- the_playlist_song = {
- friendly_name = "Current Song";
- value_template = ''{{ states.sensor.pl.attributes['name'] }}'';
+ };
+ automation = [
+ {
+ alias = "playlist song publish";
+ trigger = {
+ #platform = "event";
+ #event_data.entity_id = "sensor.the_playlist_song";
+ platform = "state";
+ entity_id = "sensor.the_playlist_song";
};
- the_playlist_url = {
- friendly_name = "Song Youtube URL";
- value_template = ''{{ states.sensor.pl.attributes['youtube'] }}'';
+ action = {
+ service = "mqtt.publish";
+ data = {
+ topic = "/ham/the_playlist/song";
+ payload_template = "{{ states.sensor.the_playlist_song.state }}";
+ };
};
- the_playlist_filename = {
- friendly_name = "Song Filename";
- value_template = ''{{ states.sensor.pl.attributes['filename'] }}'';
+ }
+ {
+ alias = "playlist upvote on button";
+ trigger = {
+ platform = "state";
+ entity_id = "binary_sensor.playlist_button_good";
+ from = "off";
+ to = "on";
};
- };
- }
- ];
+ action.service = "rest_command.good_song";
+ }
+ {
+ alias = "playlist downvote on button";
+ trigger = {
+ platform = "state";
+ entity_id = "binary_sensor.playlist_button_bad";
+ from = "off";
+ to = "on";
+ };
+ action.service = "rest_command.bad_song";
+ }
+ ];
+ sensor = [
+ { platform = "rest";
+ name = "pl";
+ resource = "http://prism.r:8001/current";
+ scan_interval = 30;
+ value_template = "1";
+ json_attributes = [ "name" "filename" "youtube" ];
+ }
+ { platform = "template";
+ sensors = {
+ the_playlist_song = {
+ friendly_name = "Current Song";
+ value_template = ''{{ states.sensor.pl.attributes['name'] }}'';
+ };
+ the_playlist_url = {
+ friendly_name = "Song Youtube URL";
+ value_template = ''{{ states.sensor.pl.attributes['youtube'] }}'';
+ };
+ the_playlist_filename = {
+ friendly_name = "Song Filename";
+ value_template = ''{{ states.sensor.pl.attributes['filename'] }}'';
+ };
+ };
+ }
+ ];
+ };
}
diff --git a/makefu/2configs/ham/multi/zigbee2mqtt.nix b/makefu/2configs/ham/multi/zigbee2mqtt.nix
deleted file mode 100644
index 84f2cc9d3..000000000
--- a/makefu/2configs/ham/multi/zigbee2mqtt.nix
+++ /dev/null
@@ -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;
- };
-}
diff --git a/makefu/2configs/ham/sensor/outside.nix b/makefu/2configs/ham/sensor/outside.nix
index c46b35ba3..332746be8 100644
--- a/makefu/2configs/ham/sensor/outside.nix
+++ b/makefu/2configs/ham/sensor/outside.nix
@@ -1,20 +1,25 @@
-{lib,...}: [
- { platform = "darksky";
- api_key = lib.removeSuffix "\n"
- (builtins.readFile <secrets/hass/darksky.apikey>);
- language = "de";
- monitored_conditions = [
- "summary" "icon"
- "nearest_storm_distance" "precip_probability"
- "precip_intensity"
- "temperature" # "temperature_high" "temperature_low"
- "apparent_temperature"
- "hourly_summary" # next 24 hours text
- "humidity"
- "pressure"
- "uv_index"
- ];
- units = "si" ;
- scan_interval = "00:30:00";
- }
- ]
+{lib,...}:
+
+{
+ services.home-assistant.config.sensor =
+ [
+ { platform = "darksky";
+ api_key = lib.removeSuffix "\n"
+ (builtins.readFile <secrets/hass/darksky.apikey>);
+ language = "de";
+ monitored_conditions = [
+ "summary" "icon"
+ "nearest_storm_distance" "precip_probability"
+ "precip_intensity"
+ "temperature" # "temperature_high" "temperature_low"
+ "apparent_temperature"
+ "hourly_summary" # next 24 hours text
+ "humidity"
+ "pressure"
+ "uv_index"
+ ];
+ units = "si" ;
+ scan_interval = "00:30:00";
+ }
+ ];
+}
diff --git a/makefu/2configs/ham/zigbee2mqtt/default.nix b/makefu/2configs/ham/zigbee2mqtt/default.nix
index 84d32c872..a75075273 100644
--- a/makefu/2configs/ham/zigbee2mqtt/default.nix
+++ b/makefu/2configs/ham/zigbee2mqtt/default.nix
@@ -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
- '';
+ services.zigbee2mqtt = {
+ enable = true;
+ inherit dataDir;
+ };
+
+ state = [ "${dataDir}/configuration.yaml" "${dataDir}/state.json" ];
- docker-containers.zigbee2mqtt = {
- image = "koenkk/zigbee2mqtt";
- extraDockerOptions = [ "--device=/dev/cc2531:/dev/cc2531" ];
- volumes = ["/var/lib/zigbee2mqtt:/app/data"];
+ 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" ];
}
diff --git a/makefu/2configs/ham/zigbee2mqtt/hass.nix b/makefu/2configs/ham/zigbee2mqtt/hass.nix
new file mode 100644
index 000000000..faf864ba6
--- /dev/null
+++ b/makefu/2configs/ham/zigbee2mqtt/hass.nix
@@ -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;
+ };
+ };
+}
diff --git a/makefu/2configs/ham/zigbee2mqtt/osram.nix b/makefu/2configs/ham/zigbee2mqtt/osram.nix
new file mode 100644
index 000000000..d1bf2b296
--- /dev/null
+++ b/makefu/2configs/ham/zigbee2mqtt/osram.nix
@@ -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"
+}
diff --git a/makefu/2configs/hw/tp-x2x0.nix b/makefu/2configs/hw/tp-x2x0.nix
index b997a9eec..8d3e17c7f 100644
--- a/makefu/2configs/hw/tp-x2x0.nix
+++ b/makefu/2configs/hw/tp-x2x0.nix
@@ -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
diff --git a/makefu/2configs/sickbeard/sickgear.nix b/makefu/2configs/sickbeard/sickgear.nix
index 9746ee073..da984358c 100644
--- a/makefu/2configs/sickbeard/sickgear.nix
+++ b/makefu/2configs/sickbeard/sickgear.nix
@@ -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";
diff --git a/makefu/2configs/wireguard/server.nix b/makefu/2configs/wireguard/server.nix
index 1b81cf57f..76fea1d6d 100644
--- a/makefu/2configs/wireguard/server.nix
+++ b/makefu/2configs/wireguard/server.nix
@@ -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";
- };
}
diff --git a/makefu/3modules/snapraid.nix b/makefu/3modules/snapraid.nix
index 9c7854787..1a2c08475 100644
--- a/makefu/3modules/snapraid.nix
+++ b/makefu/3modules/snapraid.nix
@@ -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.
diff --git a/makefu/5pkgs/hactool/default.nix b/makefu/5pkgs/hactool/default.nix
deleted file mode 100644
index 0bdaeb4be..000000000
--- a/makefu/5pkgs/hactool/default.nix
+++ /dev/null
@@ -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 ];
- };
-}
[cgit] Unable to lock slot /tmp/cgit/6a300000.lock: No such file or directory (2)