summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/automation/schlechteluft.nix
blob: 4a5fb17c2437df6b9231b9e7ce454933c6304f16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
let
secs = 60;
in [
  {
    alias = "Bad Air Alarm";
    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 ({{states.sensor.air_quality.state_with_unit}})";
      }
    ];
  }
]