summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home/ham/automation/light_buttons.nix
blob: b3c9ecdb64dfcd9e3978507278bb97a69ac2ec92 (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

let
  inherit (../lib) btn_cycle_light;
  turn_off_all = btn: #lights:
  {
    alias = "Turn of all lights via ${btn} double click";
    trigger = {
      platform = "state";
      entity_id = "sensor.${btn}_click";
      to = "double";
    };
    action = {
      service = "light.turn_off";
      #entity_id = lights;
      entity_id = "all";
    };
  };
in {
  services.home-assistant.config.automation = [
    # (btn_cycle_light "light.arbeitszimmerbeleuchtung" "arbeitszimmer_btn1")
    (btn_cycle_light "light.schlafzimmer_komode_osram" "schlafzimmer_btn2" 128)
    # (btn_cycle_light "light.wohnzimmerbeleuchtung" "wohnzimmer_btn3")
    (turn_off_all "schlafzimmer_btn2" )
  ];
}