summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/automation/nachtlicht.nix
blob: 2becd4a39e9d73cafc506342e821d3c980f01c31 (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
38
39
40
41
42
43
[
        {
          alias = "Turn off Nachtlicht on sunrise";
          trigger =
          {
            platform = "sun";
            event = "sunrise";
          };
          action =
          {
            service = "homeassistant.turn_off";
            entity_id =  [ "group.nachtlicht" ];
          };
        }

        {
          alias = "Turn on Nachtlicht on motion and dusk";
          trigger =
          {
            platform = "state";
            entity_id = "binary_sensor.motion";
            to = "on";
          };
          condition = # 'when dark'
          {
            condition = "or";
            conditions = [
              { condition = "sun";
                after = "sunset";
                after_offset = "-00:45:00"; # on dusk
              }
              { condition = "sun";
                before = "sunrise";
              }
            ];
          };
          action =
          {
            service = "homeassistant.turn_on";
            entity_id =  [ "group.nachtlicht" ];
          };
        }
]