From 4ecfee1606645c14dc258c34e087342306f698b5 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 28 Jun 2019 22:01:27 +0200 Subject: ma bureautomation: add 10h timers for all participants move into combination folders, fix mittagessen, add working tts with random output --- .../bureautomation/automation/10h_timer.nix | 154 --------------------- .../bureautomation/automation/bureau-shutdown.nix | 4 +- 2 files changed, 2 insertions(+), 156 deletions(-) delete mode 100644 makefu/2configs/bureautomation/automation/10h_timer.nix (limited to 'makefu/2configs/bureautomation/automation') diff --git a/makefu/2configs/bureautomation/automation/10h_timer.nix b/makefu/2configs/bureautomation/automation/10h_timer.nix deleted file mode 100644 index dd747114..00000000 --- a/makefu/2configs/bureautomation/automation/10h_timer.nix +++ /dev/null @@ -1,154 +0,0 @@ -[ - { alias = "start Felix 10h"; - trigger = { - platform = "state"; - entity_id = [ "device_tracker.felix_phone" "device_tracker.felix_laptop" ]; - from = "not_home"; - to = "home"; - }; - condition = { - condition = "and"; - conditions = [ - { - condition = "state"; - entity_id = "timer.felix_10h"; - state = "idle"; - } - { - condition = "time"; - after = "06:00:00"; - before = "12:00:00"; - } - ]; - }; - action = [ - { service = "timer.start"; - entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ] ; - } - { service = "homeassistant.turn_on"; - entity_id = [ - "script.buzz_red_led_fast" - "script.blitz_10s" - ]; - } - { service = "light.turn_on"; - data = { - effect = "2"; - entity_id = [ "light.status_felix" ]; - }; - } - ]; - } - - { alias = "Disable Felix timer at button press"; - trigger = { - platform = "state"; - entity_id = "binary_sensor.redbutton"; - to = "on"; - }; - condition = { - condition = "and"; - conditions = [ - { - condition = "state"; - entity_id = "timer.felix_10h"; - state = "active"; - } - { - condition = "time"; - after = "12:00:00"; - before = "22:00:00"; - } - ]; - }; - action = - [ - { - service = "timer.cancel"; - entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ]; - } - { - service = "homeassistant.turn_on"; - entity_id = [ "script.buzz_red_led_fast" ]; - } - { - service = "homeassistant.turn_off"; - entity_id = [ "light.status_felix" ]; - } - ]; - } - - { - alias = "Genug gearbeitet Felix"; - trigger = - { - platform = "event"; - event_type = "timer.finished"; - event_data.entity_id = "timer.felix_7h"; - }; - action = - [ - { service = "light.turn_on"; - data = { - rgb_color= [0 255 0]; - # effect = "0"; - entity_id = [ "light.status_felix" ]; - }; - } - ]; - } - - { - alias = "nun aber nach hause"; - trigger = - { - platform = "event"; - event_type = "timer.finished"; - event_data.entity_id = "timer.felix_8_30h"; - }; - action = - [ - { service = "light.turn_on"; - data = { - rgb_color= [255 255 0]; - # effect = "0"; - entity_id = [ "light.status_felix" ]; - }; - } - ]; - } - - { - alias = "Zu lange Felix!"; - trigger = - { - platform = "event"; - event_type = "timer.finished"; - event_data.entity_id = "timer.felix_10h"; - }; - action = - [ - { - service = "notify.telegrambot"; - data = { - title = "Zu lange Felix!"; - message = "Du bist schon 10 Stunden auf Arbeit, geh jetzt gefälligst nach Hause!"; - }; - } - { - service = "homeassistant.turn_on"; - entity_id = [ - "script.buzz_red_led" - "script.blitz_10s" - ]; - } - { service = "light.turn_on"; - data = { - rgb_color= [255 0 0]; - effect = "0"; - entity_id = [ "light.status_felix" ]; - }; - } - ]; - } -] diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix index d54d9762..3fa23a83 100644 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix @@ -25,7 +25,7 @@ } { service = "tts.google_say"; - entity_id = "media_player.kodi"; + entity_id = "media_player.mpd"; data = { message = "Willkommen in deinem Lieblingsbüro"; language = "de"; @@ -35,7 +35,7 @@ service = "notify.telegrambot"; data = { title = "Bureau Startup"; - message = "Willkommen {{ trigger.platform }}"; + message = "Das Büro wurde eröffnet"; }; } ]; -- cgit v1.2.3 From 72d614cf2a266478be71eca34d75a5ab387b8b89 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 3 Jul 2019 23:03:33 +0200 Subject: ma bureautomation: refactor air quality alarm --- .../bureautomation/automation/schlechteluft.nix | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 makefu/2configs/bureautomation/automation/schlechteluft.nix (limited to 'makefu/2configs/bureautomation/automation') diff --git a/makefu/2configs/bureautomation/automation/schlechteluft.nix b/makefu/2configs/bureautomation/automation/schlechteluft.nix new file mode 100644 index 00000000..9a5c4c5c --- /dev/null +++ b/makefu/2configs/bureautomation/automation/schlechteluft.nix @@ -0,0 +1,40 @@ +let +secs = 60; +in [ + # TODO: trigger if it is before dusk and somebody arives but nachtlichter are + # off from last day + # TODO: do not have nachtlicht turned on at night + { + alias = "Turn on Nachtlicht at dusk"; # when it gets dim + trigger = + { platform = "numeric_state"; + entity_id = "sensor.air_quality"; + above = 1523; + for.seconds = secs; + }; + condition = { + condition = "and"; + conditions = [ + { condition = "state"; + entity_id = "group.team"; + state = "home"; + } + { condition = "time"; + after = "06:00:00"; + before = "20:00:00"; + } + ]; + }; + + action = [ + { service = "homeassistant.turn_on"; + entity_id = [ + "script.schlechteluft" + ]; + } + { service = "notify.matrix_notify"; + data_template.message = "Bad Air Alarm! VOC above threshold for ${toString secs} seconds ({{state.sensor.air_quality.state_with_unit}})"; + } + ]; + } +] -- cgit v1.2.3 From c2230d30c5d75622eb25f3e0df977691cbf01058 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Jul 2019 08:03:50 +0200 Subject: ma bureautomation: remove announcement, fix schlechteluft --- makefu/2configs/bureautomation/automation/bureau-shutdown.nix | 8 -------- makefu/2configs/bureautomation/automation/schlechteluft.nix | 7 ++----- 2 files changed, 2 insertions(+), 13 deletions(-) (limited to 'makefu/2configs/bureautomation/automation') diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix index 3fa23a83..007f6064 100644 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix @@ -23,14 +23,6 @@ item.partymode = "music"; }; } - { - service = "tts.google_say"; - entity_id = "media_player.mpd"; - data = { - message = "Willkommen in deinem Lieblingsbüro"; - language = "de"; - }; - } { service = "notify.telegrambot"; data = { diff --git a/makefu/2configs/bureautomation/automation/schlechteluft.nix b/makefu/2configs/bureautomation/automation/schlechteluft.nix index 9a5c4c5c..4a5fb17c 100644 --- a/makefu/2configs/bureautomation/automation/schlechteluft.nix +++ b/makefu/2configs/bureautomation/automation/schlechteluft.nix @@ -1,11 +1,8 @@ let secs = 60; in [ - # TODO: trigger if it is before dusk and somebody arives but nachtlichter are - # off from last day - # TODO: do not have nachtlicht turned on at night { - alias = "Turn on Nachtlicht at dusk"; # when it gets dim + alias = "Bad Air Alarm"; trigger = { platform = "numeric_state"; entity_id = "sensor.air_quality"; @@ -33,7 +30,7 @@ in [ ]; } { service = "notify.matrix_notify"; - data_template.message = "Bad Air Alarm! VOC above threshold for ${toString secs} seconds ({{state.sensor.air_quality.state_with_unit}})"; + data_template.message = "Bad Air Alarm! VOC above threshold for ${toString secs} seconds ({{states.sensor.air_quality.state_with_unit}})"; } ]; } -- cgit v1.2.3 From 4ce32d170826360f577624323d94a4c5432764f7 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 9 Jul 2019 13:35:47 +0200 Subject: ma bureautomation: split schlechteluft in 2 automations (long and short) --- .../bureautomation/automation/schlechteluft.nix | 45 ++++++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'makefu/2configs/bureautomation/automation') diff --git a/makefu/2configs/bureautomation/automation/schlechteluft.nix b/makefu/2configs/bureautomation/automation/schlechteluft.nix index 4a5fb17c..8787ee28 100644 --- a/makefu/2configs/bureautomation/automation/schlechteluft.nix +++ b/makefu/2configs/bureautomation/automation/schlechteluft.nix @@ -1,13 +1,13 @@ let -secs = 60; + long_threshold = 30; in [ { - alias = "Bad Air Alarm"; + alias = "Bad Air Alarm 60 seconds"; trigger = { platform = "numeric_state"; entity_id = "sensor.air_quality"; above = 1523; - for.seconds = secs; + for.seconds = 60; }; condition = { condition = "and"; @@ -29,8 +29,45 @@ in [ "script.schlechteluft" ]; } + ]; + } + { + alias = "Bad Air Alarm ${toString long_threshold} Minutes"; + trigger = + { platform = "numeric_state"; + entity_id = "sensor.air_quality"; + above = 1523; + for.minutes = long_threshold; + }; + condition = { + condition = "and"; + conditions = [ + { condition = "state"; + entity_id = "group.team"; + state = "home"; + } + { condition = "time"; + after = "06:00:00"; + before = "20:00:00"; + } + ]; + }; + + action = [ + { service = "homeassistant.turn_on"; + entity_id = [ + "script.schlechteluft" + ]; + } + { service = "tts.google_say"; + entity_id = "media_player.mpd"; + data_template = { + message = "BEEP BEEP - Die luft ist schon ${toString long_threshold} Minuten schlecht! Student Nummer {{ range(1,500) | random }}, öffne ein Fenster."; + language = "de"; + }; + } { service = "notify.matrix_notify"; - data_template.message = "Bad Air Alarm! VOC above threshold for ${toString secs} seconds ({{states.sensor.air_quality.state_with_unit}})"; + data_template.message = "Schlechte Luft Alarm seit ${toString long_threshold} Minuten ({{states.sensor.air_quality.state_with_unit}})!"; } ]; } -- cgit v1.2.3