summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/glados/automation/shack-startup.nix
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2020-12-30 09:13:07 +0100
committerlassulus <lassulus@lassul.us>2020-12-30 09:13:07 +0100
commite0bb61d3d3c2e053ab8c8c22f9cdded409ecece7 (patch)
treecb00a8eeead2d80cb05bc561005b8e9cf6edfb6a /krebs/2configs/shack/glados/automation/shack-startup.nix
parentba47b90d7326c262f3e3327781a16fd8400df062 (diff)
parentc370c87da36bc256cfbc59bb2b0b9ffa1d457168 (diff)
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'krebs/2configs/shack/glados/automation/shack-startup.nix')
-rw-r--r--krebs/2configs/shack/glados/automation/shack-startup.nix165
1 files changed, 84 insertions, 81 deletions
diff --git a/krebs/2configs/shack/glados/automation/shack-startup.nix b/krebs/2configs/shack/glados/automation/shack-startup.nix
index ac7dd4f1e..471d817a2 100644
--- a/krebs/2configs/shack/glados/automation/shack-startup.nix
+++ b/krebs/2configs/shack/glados/automation/shack-startup.nix
@@ -13,85 +13,88 @@
let
glados = import ../lib;
in
-[
- {
- alias = "Bedanken bei Übernahme von Key";
- initial_state = true;
- trigger = {
- platform = "state";
- entity_id = "sensor.keyholder";
- };
- condition = {
- condition = "template";
- value_template = "{{ (trigger.from_state.state != 'No Keyholder') and (trigger.from_state.state != 'No Keyholder') }}";
- };
- action = glados.say.kiosk "Danke {{ trigger.to_state.state }} für das Übernehmen des Keys von {{ trigger.from_state.state }}";
- }
- {
- alias = "Keyholder Begrüßen wenn MPD hoch fährt";
- initial_state = true;
- trigger = {
- platform = "state";
- from = "unavailable";
- entity_id = "media_player.kiosk";
- };
- action = glados.say.kiosk (builtins.readFile ./announcement.j2);
- }
- {
- alias = "Start Music on portal lock on";
- trigger = {
- platform = "state";
- entity_id = "binary_sensor.portal_lock";
- to = "on";
- for.seconds = 30;
- };
- condition = {
- condition = "and";
- conditions =
- [
- { # only start if a keyholder opened the door and if the lounge mpd is currently not playing anything
- condition = "template";
- value_template = "{{ state('sensor.keyholder') != 'No Keyholder' }}";
- }
- {
- condition = "state";
- entity_id = "media_player.lounge";
- state = "idle";
- }
- ];
- };
- action = [
- {
- service = "media_player.volume_set";
- data = {
+{
+ services.home-assistant.config.automation =
+ [
+ {
+ alias = "Bedanken bei Übernahme von Key";
+ initial_state = true;
+ trigger = {
+ platform = "state";
+ entity_id = "sensor.keyholder";
+ };
+ condition = {
+ condition = "template";
+ value_template = "{{ (trigger.from_state.state != 'No Keyholder') and (trigger.from_state.state != 'No Keyholder') }}";
+ };
+ action = glados.say.kiosk "Danke {{ trigger.to_state.state }} für das Übernehmen des Keys von {{ trigger.from_state.state }}";
+ }
+ {
+ alias = "Keyholder Begrüßen wenn MPD hoch fährt";
+ initial_state = true;
+ trigger = {
+ platform = "state";
+ from = "unavailable";
+ entity_id = "media_player.kiosk";
+ };
+ action = glados.say.kiosk (builtins.readFile ./announcement.j2);
+ }
+ {
+ alias = "Start Music on portal lock on";
+ trigger = {
+ platform = "state";
+ entity_id = "binary_sensor.portal_lock";
+ to = "on";
+ for.seconds = 30;
+ };
+ condition = {
+ condition = "and";
+ conditions =
+ [
+ { # only start if a keyholder opened the door and if the lounge mpd is currently not playing anything
+ condition = "template";
+ value_template = "{{ state('sensor.keyholder') != 'No Keyholder' }}";
+ }
+ {
+ condition = "state";
entity_id = "media_player.lounge";
- volume_level = 1.0;
- };
- }
- {
- service = "media_player.play_media";
- data = {
- entity_id = "media_player.lounge";
- media_content_type = "playlist";
- media_content_id = "ansage";
- };
- }
- { delay.seconds = 8.5; }
- {
- service = "media_player.volume_set";
- data = {
- entity_id = "media_player.lounge";
- volume_level = 0.6;
- };
- }
- {
- service = "media_player.play_media";
- data = {
- entity_id = "media_player.lounge";
- media_content_type = "playlist";
- media_content_id = "lassulus";
- };
- }
- ];
- }
-]
+ state = "idle";
+ }
+ ];
+ };
+ action = [
+ {
+ service = "media_player.volume_set";
+ data = {
+ entity_id = "media_player.lounge";
+ volume_level = 1.0;
+ };
+ }
+ {
+ service = "media_player.play_media";
+ data = {
+ entity_id = "media_player.lounge";
+ media_content_type = "playlist";
+ media_content_id = "ansage";
+ };
+ }
+ { delay.seconds = 8.5; }
+ {
+ service = "media_player.volume_set";
+ data = {
+ entity_id = "media_player.lounge";
+ volume_level = 0.6;
+ };
+ }
+ {
+ service = "media_player.play_media";
+ data = {
+ entity_id = "media_player.lounge";
+ media_content_type = "playlist";
+ media_content_id = "lassulus";
+ };
+ }
+ ];
+ }
+ ];
+}