From 965a6c96c3b7216bf8ca1b985f8bece6c73213c4 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 30 Jan 2022 23:51:32 +0100 Subject: ma ham: commit open changes --- makefu/2configs/home/ham/automation/check-in.nix | 62 ++++++++++++++++++++++ makefu/2configs/home/ham/automation/flurlicht.nix | 31 ++++++++--- .../home/ham/automation/shutdown_button.nix | 48 +++++++++++++++++ makefu/2configs/home/ham/automation/urlaub.nix | 8 +-- .../ham/automation/wohnzimmer_rf_fernbedienung.nix | 2 +- 5 files changed, 141 insertions(+), 10 deletions(-) create mode 100644 makefu/2configs/home/ham/automation/check-in.nix create mode 100644 makefu/2configs/home/ham/automation/shutdown_button.nix (limited to 'makefu/2configs/home/ham/automation') diff --git a/makefu/2configs/home/ham/automation/check-in.nix b/makefu/2configs/home/ham/automation/check-in.nix new file mode 100644 index 000000000..21040b409 --- /dev/null +++ b/makefu/2configs/home/ham/automation/check-in.nix @@ -0,0 +1,62 @@ +let + button = "binary_sensor.arbeitszimmer_onebutton_button"; + light = "light.arbeitszimmer_onebutton_led"; + at_work = "input_boolean.felix_at_work"; + lib = import ../lib; + say = lib.say.living_room; +in +{ + services.home-assistant.config.input_boolean.felix_at_work.name = "Felix auf Arbeit"; + services.home-assistant.config.automation = + [ + { alias = "Push Check-in Button Felix with button"; + trigger = [ + { + platform = "state"; + entity_id = button; + to = "on"; + for.seconds = 1; + } + ]; + condition = [ + ]; + action = + [ + { choose = [ + { + conditions = { + condition = "state"; + entity_id = at_work; + state = "off"; + }; + sequence = [ + { service = "light.turn_on"; + target.entity_id = light; + data.brightness = 200; + } + { service = "homeassistant.turn_on"; + entity_id = at_work; + } + ] ++ (say "Willkommen auf Arbeit"); + } + { + conditions = { + condition = "state"; + entity_id = at_work; + state = "on"; + }; + sequence = [ + { service = "light.turn_off"; + target.entity_id = light; + } + { service = "homeassistant.turn_off"; + entity_id = at_work; + } + ] ++ (say "Endlich ist Pappa fertig mit arbeit!"); + } + ]; + } + ]; + } + ]; +} diff --git a/makefu/2configs/home/ham/automation/flurlicht.nix b/makefu/2configs/home/ham/automation/flurlicht.nix index d40022540..c26f7e3e0 100644 --- a/makefu/2configs/home/ham/automation/flurlicht.nix +++ b/makefu/2configs/home/ham/automation/flurlicht.nix @@ -1,5 +1,7 @@ let - licht = "light.flur_statuslight"; + licht = [ "light.flur_statuslight" "light.wohnzimmer_status_led" ]; + kehrwoche_color = [ 204 0 255 ]; # pink + nachtlicht_color = [ 255 190 0 ]; # ein dunkles rot in { services.home-assistant.config.automation = @@ -16,22 +18,39 @@ in target.entity_id = licht; data = { brightness = 87; - rgbw_color = [ 255 190 0 0 ]; # ein dunkles rot + rgb_color = nachtlicht_color; #effect = "None"; }; } ]; } - { alias = "Nachtlicht in Flur aus"; + { alias = "Nachtlicht in Flur aus, Kehrwoche an"; trigger = { platform = "sun"; event = "sunrise"; }; action = [ - { - service = "light.turn_off"; - entity_id = licht; + { choose = [ + { + conditions = { + condition = "state"; + entity_id = "calendar.kehrwoche_kehrwoche"; + state = "on"; + }; + sequence = { + service = "light.turn_on"; + target.entity_id = licht; + data = { + brightness = 190; + rgb_color = kehrwoche_color; # pink + }; + }; + }]; + default = { + service = "light.turn_off"; + entity_id = licht; + }; } ]; } 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 000000000..4c12be277 --- /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; + } + ]; + } + ]; +} diff --git a/makefu/2configs/home/ham/automation/urlaub.nix b/makefu/2configs/home/ham/automation/urlaub.nix index a6b9be96f..50294514c 100644 --- a/makefu/2configs/home/ham/automation/urlaub.nix +++ b/makefu/2configs/home/ham/automation/urlaub.nix @@ -5,8 +5,9 @@ let schranklicht = "light.wohnzimmer_schrank_osram"; - fernsehlicht = "light.wohnzimmer_fernseher_led_strip"; - final_off = "01:00"; + weihnachtslicht = "light.wohnzimmer_fenster_lichterkette_licht"; + fernsehlicht = "light.wled"; + final_off = "00:37"; turn_on = entity_id: at: { alias = "Turn on ${entity_id} at ${at}"; @@ -25,6 +26,7 @@ in automation = [ (turn_on schranklicht "17:30") + (turn_on weihnachtslicht "17:30") (turn_on fernsehlicht "19:00") { alias = "Always turn off the urlaub lights at ${final_off}"; @@ -35,7 +37,7 @@ in [ { service = "light.turn_off"; - entity_id = [ schranklicht fernsehlicht ]; + entity_id = [ schranklicht weihnachtslicht fernsehlicht ]; } ]; } diff --git a/makefu/2configs/home/ham/automation/wohnzimmer_rf_fernbedienung.nix b/makefu/2configs/home/ham/automation/wohnzimmer_rf_fernbedienung.nix index 31d9b1634..b67dacb14 100644 --- a/makefu/2configs/home/ham/automation/wohnzimmer_rf_fernbedienung.nix +++ b/makefu/2configs/home/ham/automation/wohnzimmer_rf_fernbedienung.nix @@ -135,7 +135,7 @@ in data.entity_id = [ "light.wohnzimmer_fernseher_led_strip" "light.wohnzimmer_stehlampe_osram" "light.wohnzimmer_komode_osram" "light.wohnzimmer_schrank_osram" - "light.wohnzimmer_fenster_lichterkette_licht" "light.wohnzimmer_fernsehwand_led" + "light.wohnzimmer_fenster_lichterkette_licht" "light.wled" ]; }; }) -- cgit v1.2.3