summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/automation
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2019-07-03 23:03:33 +0200
committermakefu <github@syntax-fehler.de>2019-07-03 23:03:33 +0200
commit72d614cf2a266478be71eca34d75a5ab387b8b89 (patch)
tree7c75301369b7a88d7f99d009203fdf528fb3507e /makefu/2configs/bureautomation/automation
parent1ba49c0ffe299bc1f6ba56e1449e0c8e65cd8923 (diff)
ma bureautomation: refactor air quality alarm
Diffstat (limited to 'makefu/2configs/bureautomation/automation')
-rw-r--r--makefu/2configs/bureautomation/automation/schlechteluft.nix40
1 files changed, 40 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..9a5c4c5c8
--- /dev/null
+++ b/makefu/2configs/bureautomation/automation/schlechteluft.nix
@@ -0,0 +1,40 @@
+let
+secs = 60;
+in [
+ # 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 = "sensor.air_quality";
+ above = 1523;
+ for.seconds = secs;
+ };
+ 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 = "notify.matrix_notify";
+ data_template.message = "Bad Air Alarm! VOC above threshold for ${toString secs} seconds ({{state.sensor.air_quality.state_with_unit}})";
+ }
+ ];
+ }
+]