summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/glados/multi/schlechte_luft.nix
blob: c1890361b82fecbcfd024250564704a103cbb3df (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
let
  glados = import ../lib;
  feinstaub_sensor = "sensor.fablab_particulate_matter_2_5um_concentration";
  ledring = "light.fablab_led_ring";
in
{
  services.home-assistant.config =
  {
    automation =
      [
      { alias = "Gute Luft Fablab";
        trigger = [
          {
            platform = "numeric_state";
            entity_id = feinstaub_sensor;
            below = 3;
          }
        ];
        action =
          [
            { service = "light.turn_on";
              data = {
                entity_id = ledring;
                effect = "Twinkle";
                color_name = "green";
              };
            }
          ];
      }
      { alias = "mäßige Luft Fablab";
        trigger = [
          {
            platform = "numeric_state";
            above = 3;
            below = 10;
            entity_id = feinstaub_sensor;
          }
        ];
        action =
          [
            { service = "light.turn_on";
              data = {
                entity_id = ledring;
                effect = "Twinkle";
                color_name = "yellow";
              };
            }
          ];
      }
      { alias = "schlechte Luft Fablab";
        trigger = [
          {
            platform = "numeric_state";
            above = 10;
            entity_id = feinstaub_sensor;
          }
        ];
        action =
          [
            { service = "light.turn_on";
              data = {
                entity_id = ledring;
                effect = "Fireworks";
                color_name = "red";
              };
            }
          ];
      }
      { alias = "Luft Sensor nicht verfügbar";
        trigger = [
          {
            platform = "state";
            to = "unavailable";
            entity_id = feinstaub_sensor;
          }
        ];
        action =
          [
            { service = "light.turn_on";
              data = {
                entity_id = ledring;
                effect = "Rainbow";
                color_name = "blue";
              };
            }
          ];
      }
      { alias = "Fablab Licht Reboot";
        trigger = [
          {
            platform = "state";
            from = "unavailable";
            entity_id = ledring;
          }
        ];
        action =
          [
            { service = "light.turn_on";
              data = {
                entity_id = ledring;
                effect = "Rainbow";
                color_name = "orange";
              };
            }
          ];
      }
    ];
  };
}