summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home/ham/automation/fenster_auf.nix
blob: ccebd5b000ece08abbd84910e2bff332893ba219 (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
let
  min = 20;
  fenster_offen = name: entity:
    { alias = "${name} seit ${toString min} Minuten offen";
      trigger = [
          {
            platform = "state";
            entity_id = entity;
            to = "on";
            for.minutes = min;
          }
      ];
      action =
      [
        {
          service = "notify.firetv_wohnzimmer";
          data = {
            title = "${name} seit ${toString min} Minuten offen";
            message = "Bitte einmal checken ob das ok ist :)";
            data = {
              interrupt = 1;
              duration = 300;
            };
          };
        }
      ];
    };
in {
  services.home-assistant.config.automation = [
    (fenster_offen "Badezimmerfenster" "binary_sensor.badezimmer_fenster_contact")
    (fenster_offen "Duschfenster" "binary_sensor.dusche_fenster_contact")
  ];
}