summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/automation
diff options
context:
space:
mode:
Diffstat (limited to 'makefu/2configs/bureautomation/automation')
-rw-r--r--makefu/2configs/bureautomation/automation/bureau-shutdown.nix87
-rw-r--r--makefu/2configs/bureautomation/automation/daily-news.nix20
-rw-r--r--makefu/2configs/bureautomation/automation/hass-restart.nix34
-rw-r--r--makefu/2configs/bureautomation/automation/nachtlicht.nix38
-rw-r--r--makefu/2configs/bureautomation/automation/philosophische-tuer.nix100
-rw-r--r--makefu/2configs/bureautomation/automation/quotes.nix4
-rw-r--r--makefu/2configs/bureautomation/automation/schlechteluft.nix75
7 files changed, 0 insertions, 358 deletions
diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
deleted file mode 100644
index f4c10adc8..000000000
--- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
+++ /dev/null
@@ -1,87 +0,0 @@
-{
- services.home-assistant.config.automation =
- [
- { 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
- 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 = [
- {
- 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/daily-news.nix b/makefu/2configs/bureautomation/automation/daily-news.nix
deleted file mode 100644
index 2bafe4795..000000000
--- a/makefu/2configs/bureautomation/automation/daily-news.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-[
- {
- alias = "Daily news for Felix";
- trigger = {
- platform = "time";
- at = "07:35:00";
- };
- action =
- [
- {
- service = "notify.telegrambot";
- data_template = {
- title = "Daily News";
- # TODO
- message = "";
- };
- }
- ];
- }
-]
diff --git a/makefu/2configs/bureautomation/automation/hass-restart.nix b/makefu/2configs/bureautomation/automation/hass-restart.nix
deleted file mode 100644
index 3b3ce0599..000000000
--- a/makefu/2configs/bureautomation/automation/hass-restart.nix
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- 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
deleted file mode 100644
index ade89418d..000000000
--- a/makefu/2configs/bureautomation/automation/nachtlicht.nix
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- 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" ];
- };
- }
- ];
-}
diff --git a/makefu/2configs/bureautomation/automation/philosophische-tuer.nix b/makefu/2configs/bureautomation/automation/philosophische-tuer.nix
deleted file mode 100644
index 9586d9a46..000000000
--- a/makefu/2configs/bureautomation/automation/philosophische-tuer.nix
+++ /dev/null
@@ -1,100 +0,0 @@
-{ config, pkgs, lib, ... }:
-
-let
- short_threshold = 30; #seconds
- long_threshold = 30; #minutes
- sensor = "binary_sensor.buerotuer_contact";
-
- # get the list of all
- name = "tueraudio";
- prefix = "http://localhost:8123/local/${name}";
- audiodir = "${config.services.home-assistant.configDir}/www/${name}";
- recordrepo = pkgs.fetchFromGitHub {
- owner = "makefu";
- repo = "philosophische_tuer";
- rev = "607eff7";
- sha256 = "1qlyqmc65yfb42q4fzd92vinx4i191w431skmcp7xjncb45lfp8j";
- };
- samples = user: lib.mapAttrsToList
- (file: _: ''"${prefix}/${user}/${file}"'')
- (builtins.readDir (toString ( recordrepo+ "/recordings/${user}")));
- random_tuerspruch = ''{{['' + (lib.concatStringsSep "," (
- (samples "Felix") ++ (samples "Sofia") ++ (samples "Markus")
- )) + ''] | random}}''; # TODO read from derivation
-in
-{
- systemd.services.copy-philosophische-tuersounds = {
- description = "copy philosophische tuer";
- wantedBy = [ "multi-user.target" ];
- serviceConfig = {
- Type = "oneshot";
- ExecStart = pkgs.writeDash "update-samples" ''
- rm -rf "${audiodir}"
- cp -vr "${recordrepo}/recordings" "${audiodir}"
- '';
- };
- };
- services.home-assistant.config = {
- media_extractor = { };
- script."philosophische_tuer" = {
- alias = "Durchsage der philosophischen Tür";
- sequence = [
- { service = "media_player.play_media";
- data = {
- entity_id = "media_player.mpd";
- media_content_type = "playlist";
- media_content_id = "ansage";
- };
- }
- { delay.seconds = 5; }
- { service = "media_extractor.play_media";
- entity_id = "media_player.mpd";
- data_template = {
- media_content_id = random_tuerspruch;
- media_content_type = "MUSIC";
- };
- }
- ];
- };
- automation =
- [
- {
- alias = "Tür offen seit ${toString short_threshold} sekunden";
- trigger =
- { platform = "state";
- entity_id = sensor;
- to = "on";
- for.seconds = 60;
- };
- action = [
- { service = "homeassistant.turn_on";
- entity_id = "script.philosophische_tuer";
- }
- ];
- }
- {
- alias = "Tür offen seit ${toString long_threshold} minuten";
- trigger =
- { platform = "state";
- entity_id = sensor;
- to = "on";
- for.minutes = long_threshold;
- };
-
- action = [
- { service = "homeassistant.turn_on";
- entity_id = "script.philosophische_tuer" ;
- }
- { service = "tts.google_say";
- entity_id = "media_player.mpd";
- data_template = {
- message = "BEEP BOOP - Die Tür ist schon seit ${toString long_threshold} Minuten offen! Student Nummer {{ range(1,500) | random }}, bitte schliesse die Tür";
- language = "de";
- };
- }
- ];
- }
- ];
- };
-
-}
diff --git a/makefu/2configs/bureautomation/automation/quotes.nix b/makefu/2configs/bureautomation/automation/quotes.nix
deleted file mode 100644
index c4625ae30..000000000
--- a/makefu/2configs/bureautomation/automation/quotes.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-# heiss
-Lieber Freund, was für ein Sommer! Ich denke Sie mir im Zimmer sitzend, mehr Omelette als Mensch.
-Sommer ist die Zeit, in der es zu heiß ist, um das zu tun, wozu es im Winter zu kalt war.
-
diff --git a/makefu/2configs/bureautomation/automation/schlechteluft.nix b/makefu/2configs/bureautomation/automation/schlechteluft.nix
deleted file mode 100644
index ea1d44515..000000000
--- a/makefu/2configs/bureautomation/automation/schlechteluft.nix
+++ /dev/null
@@ -1,75 +0,0 @@
-let
- long_threshold = 30;
-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"
- ];
- }
- ];
- }
- {
- 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";
- }
- ];
- };
-
- 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";
- };
- }
- ];
- }
- ];
-}