summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/automation
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2019-08-13 18:55:08 +0200
committerlassulus <lassulus@lassul.us>2019-08-13 18:55:08 +0200
commit3047fea88d2379011685be4e57a5b379778423c7 (patch)
tree23ad61badb3794cabf4a9cc9de89c3465cfec737 /makefu/2configs/bureautomation/automation
parent0699b41b05a1f9cd133c15c3aadf70c3a45170f6 (diff)
parent124b1d7639c404e5a58a9aef0f0bee1424f54a45 (diff)
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'makefu/2configs/bureautomation/automation')
-rw-r--r--makefu/2configs/bureautomation/automation/10h_timer.nix154
-rw-r--r--makefu/2configs/bureautomation/automation/bureau-shutdown.nix10
-rw-r--r--makefu/2configs/bureautomation/automation/schlechteluft.nix74
3 files changed, 75 insertions, 163 deletions
diff --git a/makefu/2configs/bureautomation/automation/10h_timer.nix b/makefu/2configs/bureautomation/automation/10h_timer.nix
deleted file mode 100644
index dd747114e..000000000
--- a/makefu/2configs/bureautomation/automation/10h_timer.nix
+++ /dev/null
@@ -1,154 +0,0 @@
-[
- { alias = "start Felix 10h";
- trigger = {
- platform = "state";
- entity_id = [ "device_tracker.felix_phone" "device_tracker.felix_laptop" ];
- from = "not_home";
- to = "home";
- };
- condition = {
- condition = "and";
- conditions = [
- {
- condition = "state";
- entity_id = "timer.felix_10h";
- state = "idle";
- }
- {
- condition = "time";
- after = "06:00:00";
- before = "12:00:00";
- }
- ];
- };
- action = [
- { service = "timer.start";
- entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ] ;
- }
- { service = "homeassistant.turn_on";
- entity_id = [
- "script.buzz_red_led_fast"
- "script.blitz_10s"
- ];
- }
- { service = "light.turn_on";
- data = {
- effect = "2";
- entity_id = [ "light.status_felix" ];
- };
- }
- ];
- }
-
- { alias = "Disable Felix timer at button press";
- trigger = {
- platform = "state";
- entity_id = "binary_sensor.redbutton";
- to = "on";
- };
- condition = {
- condition = "and";
- conditions = [
- {
- condition = "state";
- entity_id = "timer.felix_10h";
- state = "active";
- }
- {
- condition = "time";
- after = "12:00:00";
- before = "22:00:00";
- }
- ];
- };
- action =
- [
- {
- service = "timer.cancel";
- entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ];
- }
- {
- service = "homeassistant.turn_on";
- entity_id = [ "script.buzz_red_led_fast" ];
- }
- {
- service = "homeassistant.turn_off";
- entity_id = [ "light.status_felix" ];
- }
- ];
- }
-
- {
- alias = "Genug gearbeitet Felix";
- trigger =
- {
- platform = "event";
- event_type = "timer.finished";
- event_data.entity_id = "timer.felix_7h";
- };
- action =
- [
- { service = "light.turn_on";
- data = {
- rgb_color= [0 255 0];
- # effect = "0";
- entity_id = [ "light.status_felix" ];
- };
- }
- ];
- }
-
- {
- alias = "nun aber nach hause";
- trigger =
- {
- platform = "event";
- event_type = "timer.finished";
- event_data.entity_id = "timer.felix_8_30h";
- };
- action =
- [
- { service = "light.turn_on";
- data = {
- rgb_color= [255 255 0];
- # effect = "0";
- entity_id = [ "light.status_felix" ];
- };
- }
- ];
- }
-
- {
- alias = "Zu lange Felix!";
- trigger =
- {
- platform = "event";
- event_type = "timer.finished";
- event_data.entity_id = "timer.felix_10h";
- };
- action =
- [
- {
- service = "notify.telegrambot";
- data = {
- title = "Zu lange Felix!";
- message = "Du bist schon 10 Stunden auf Arbeit, geh jetzt gefälligst nach Hause!";
- };
- }
- {
- service = "homeassistant.turn_on";
- entity_id = [
- "script.buzz_red_led"
- "script.blitz_10s"
- ];
- }
- { service = "light.turn_on";
- data = {
- rgb_color= [255 0 0];
- effect = "0";
- entity_id = [ "light.status_felix" ];
- };
- }
- ];
- }
-]
diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
index d54d9762a..007f6064a 100644
--- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
+++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
@@ -24,18 +24,10 @@
};
}
{
- service = "tts.google_say";
- entity_id = "media_player.kodi";
- data = {
- message = "Willkommen in deinem Lieblingsbüro";
- language = "de";
- };
- }
- {
service = "notify.telegrambot";
data = {
title = "Bureau Startup";
- message = "Willkommen {{ trigger.platform }}";
+ message = "Das Büro wurde eröffnet";
};
}
];
diff --git a/makefu/2configs/bureautomation/automation/schlechteluft.nix b/makefu/2configs/bureautomation/automation/schlechteluft.nix
new file mode 100644
index 000000000..8787ee280
--- /dev/null
+++ b/makefu/2configs/bureautomation/automation/schlechteluft.nix
@@ -0,0 +1,74 @@
+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";
+ }
+ ];
+ };
+
+ 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";
+ };
+ }
+ { service = "notify.matrix_notify";
+ data_template.message = "Schlechte Luft Alarm seit ${toString long_threshold} Minuten ({{states.sensor.air_quality.state_with_unit}})!";
+ }
+ ];
+ }
+]