stockholm/makefu/2configs/home/ham/automation/light_buttons.nix
2021-08-27 22:45:16 +02:00

26 lines
688 B
Nix

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" )
];
}