stockholm/makefu/2configs/home/ham/automation/shutdown_button.nix

54 lines
1.1 KiB
Nix
Raw Normal View History

2022-01-30 22:51:32 +00:00
let
btn = "sensor.arbeitszimmer_btn1_action";
2022-09-23 21:41:30 +00:00
lib = import ../lib;
say = lib.say.living_room;
2022-01-30 22:51:32 +00:00
all_lights = [
# Wohnzimmer
"light.wled"
"light.wled_2"
"light.wohnzimmer_komode_osram"
"light.wohnzimmer_schrank_osram"
"light.wohnzimmer_fenster_lichterkette_licht"
# Arbeitszimmer
"light.wled_3"
"light.wled_4"
"light.arbeitszimmer_schrank_dimmer"
"light.arbeitszimmer_pflanzenlicht"
"light.wohnzimmer_stehlampe_osram"
# Keller
"light.keller_osram"
];
all_media_player = [
"media_player.living_room"
"media_player.office"
2022-09-23 21:41:30 +00:00
"media_player.bedroom"
2022-01-30 22:51:32 +00:00
];
in {
services.home-assistant.config.automation =
[
{ alias = "Wohnung shutdown single click";
trigger = [
{
platform = "state";
entity_id = btn;
2022-09-23 21:41:30 +00:00
to = "single";
2022-01-30 22:51:32 +00:00
}
];
condition = [ ];
2022-09-23 21:41:30 +00:00
action = (say "Alles Aus" )++ [
2022-01-30 22:51:32 +00:00
{
2022-09-23 21:41:30 +00:00
service = "light.turn_off";
2022-01-30 22:51:32 +00:00
target.entity_id = all_lights;
}
{ service = "media_player.media_stop";
target.entity_id = all_media_player;
}
];
}
];
}