summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/automation/schlechteluft.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-09-11 10:34:02 +0200
committertv <tv@krebsco.de>2019-09-11 10:34:02 +0200
commit0182f1bd64973e93d4cf4c30b6005708b7e09240 (patch)
treef5a318fee1572b9b35f9f321d4ac707bc7935792 /makefu/2configs/bureautomation/automation/schlechteluft.nix
parente388d02623b98bad5db52b29ea1ef1f494fddae8 (diff)
parent5d24345ff430df38263c113041070a900c23131e (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'makefu/2configs/bureautomation/automation/schlechteluft.nix')
-rw-r--r--makefu/2configs/bureautomation/automation/schlechteluft.nix74
1 files changed, 74 insertions, 0 deletions
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}})!";
+ }
+ ];
+ }
+]
[cgit] Unable to lock slot /tmp/cgit/61200000.lock: No such file or directory (2)