summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/automation/nachtlicht.nix
blob: ade89418d023e1cd3e460779b3b1f31138529951 (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
{
  services.home-assistant.config.automation =
  [
    # TODO: trigger if it is before dusk and somebody arives but nachtlichter are
    # off from last day
    # TODO: do not have nachtlicht turned on at night
    {
      alias = "Turn on Nachtlicht at dusk"; # when it gets dim
      trigger =
      { platform = "numeric_state";
        entity_id = "sun.sun";
        value_template = "{{ state.attributes.elevation }}";
        below = 10;

      };
      action =
      { service = "homeassistant.turn_on";
        entity_id =  [ "group.nachtlicht" ];
      };
    }
    {
      alias = "Turn off Nachtlicht at dawn";
      trigger =
      { platform = "sun";
        event = "sunrise";
        offset = "01:30:00"; # on dawn
      };
      # TODO: when somebody is still in the buero
      # condition = 
      #{
      #};
      action =
      { service = "homeassistant.turn_off";
        entity_id =  [ "group.nachtlicht" ];
      };
    }
  ];
}