summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home/ham/automation/flurlicht.nix
blob: c26f7e3e0e7f7933155293314779a1292f77540b (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
let
  licht = [ "light.flur_statuslight" "light.wohnzimmer_status_led" ];
  kehrwoche_color = [ 204 0 255 ]; # pink
  nachtlicht_color = [ 255 190 0 ]; # ein dunkles rot
in
{
  services.home-assistant.config.automation =
  [
    { alias = "Nachtlicht im Flur an";
      trigger = {
        platform = "sun";
        event = "sunset";
      };
      action =
      [
        {
          service = "light.turn_on";
          target.entity_id = licht;
          data = {
            brightness = 87;
            rgb_color = nachtlicht_color;
            #effect = "None";
          };
        }
      ];
    }
    { alias = "Nachtlicht in Flur aus, Kehrwoche an";
      trigger = {
        platform = "sun";
        event = "sunrise";
      };
      action =
      [
        { choose = [
          {
            conditions = {
              condition = "state";
              entity_id = "calendar.kehrwoche_kehrwoche";
              state =  "on";
            };
            sequence = {
              service = "light.turn_on";
              target.entity_id = licht;
              data = {
                brightness = 190;
                rgb_color = kehrwoche_color; # pink
              };
            };
          }];
          default = {
              service = "light.turn_off";
              entity_id = licht;
            };
        }
      ];
    }
  ];
}