summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home/ham/automation/shutdown_button.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2022-01-30 23:51:32 +0100
committermakefu <github@syntax-fehler.de>2022-01-30 23:51:32 +0100
commit965a6c96c3b7216bf8ca1b985f8bece6c73213c4 (patch)
tree546b554bb339859a2fb182d4b9df8c21db5fc085 /makefu/2configs/home/ham/automation/shutdown_button.nix
parenta721b7ad9b605dc90fa731b2f9a176f2238dc82f (diff)
ma ham: commit open changes
Diffstat (limited to 'makefu/2configs/home/ham/automation/shutdown_button.nix')
-rw-r--r--makefu/2configs/home/ham/automation/shutdown_button.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/makefu/2configs/home/ham/automation/shutdown_button.nix b/makefu/2configs/home/ham/automation/shutdown_button.nix
new file mode 100644
index 00000000..4c12be27
--- /dev/null
+++ b/makefu/2configs/home/ham/automation/shutdown_button.nix
@@ -0,0 +1,48 @@
+let
+ btn = "sensor.arbeitszimmer_btn1_action";
+ 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"
+ ];
+in {
+ services.home-assistant.config.automation =
+ [
+ { alias = "Wohnung shutdown single click";
+ trigger = [
+ {
+ platform = "state";
+ entity_id = btn;
+ to = "on";
+ }
+ ];
+ condition = [ ];
+ action = [
+ {
+ service = "home_assistant.turn_off";
+ target.entity_id = all_lights;
+ }
+ { service = "media_player.media_stop";
+ target.entity_id = all_media_player;
+ }
+ ];
+ }
+ ];
+}