diff options
Diffstat (limited to 'makefu/2configs/bureautomation')
52 files changed, 0 insertions, 2262 deletions
diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix deleted file mode 100644 index f4c10adc8..000000000 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ /dev/null @@ -1,87 +0,0 @@ -{ - services.home-assistant.config.automation = - [ - { alias = "Turn on Fernseher on group home"; - trigger = { - platform = "state"; - entity_id = "group.team"; - from = "not_home"; - to = "home"; - for.seconds = 30; - }; - action = [ - { - service = "homeassistant.turn_on"; - entity_id = [ - "switch.fernseher" - "switch.feuer" - ]; - } - { - service = "media_player.kodi_call_method"; - data = { - entity_id = "media_player.kodi"; - method = "Player.Open"; - item.partymode = "music"; - }; - } - { - service = "notify.telegrambot"; - data = { - title = "Bureau Startup"; - message = "Das Büro wurde eröffnet"; - }; - } - ]; - } - { alias = "Turn off Fernseher after last in group left"; - trigger = [ - { # trigger when movement was detected at the time - platform = "state"; - entity_id = "group.team"; - from = "home"; - to = "not_home"; - } - { # trigger at 18:00 no matter what - # to avoid 'everybody left before 18:00:00' - platform = "time"; - at = "18:00:00"; - } - ]; - action = [ - { - service = "homeassistant.turn_off"; - entity_id = [ - "switch.fernseher" - "switch.feuer" - "light.status_felix" - "light.status_daniel" - ]; - } - { - service = "notify.telegrambot"; - data_template = { - title = "Bureau Shutdown"; - message = "All devices are turned off due to {{ trigger.platform }}"; - }; - } - ]; - condition = - { condition = "and"; - conditions = [ - { - condition = "time"; - before = "06:30:00"; #only turn off between 6:30 and 18:00 - after = "18:00:00"; - # weekday = [ "mon" "tue" "wed" "thu" "fri" ]; - } - { # if anybody is still there - condition = "state"; - entity_id = "group.team"; - state = "not_home"; - } - ]; - }; - } - ]; -} diff --git a/makefu/2configs/bureautomation/automation/daily-news.nix b/makefu/2configs/bureautomation/automation/daily-news.nix deleted file mode 100644 index 2bafe4795..000000000 --- a/makefu/2configs/bureautomation/automation/daily-news.nix +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - alias = "Daily news for Felix"; - trigger = { - platform = "time"; - at = "07:35:00"; - }; - action = - [ - { - service = "notify.telegrambot"; - data_template = { - title = "Daily News"; - # TODO - message = ""; - }; - } - ]; - } -] diff --git a/makefu/2configs/bureautomation/automation/hass-restart.nix b/makefu/2configs/bureautomation/automation/hass-restart.nix deleted file mode 100644 index 3b3ce0599..000000000 --- a/makefu/2configs/bureautomation/automation/hass-restart.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - services.home-assistant.config.automation = - [ - { alias = "State on HA start-up"; - trigger = { - platform = "homeassistant"; - event = "start"; - }; - action = [ - # Startup State - { service = "mqtt.publish"; - data = { - topic = "/bam/sonoffs/cmnd/state"; - payload = ""; - }; - } - # Firmware Version - { service = "mqtt.publish"; - data = { - topic = "/bam/sonoffs/cmnd/status"; - payload = "2"; - }; - } - # Will trigger restart of all devices! - #{ service = "mqtt.publish"; - # data = { - # topic = "sonoffs/cmnd/SetOption59"; # configure sending state on power change - # payload = "1"; - # }; - #} - ]; - } - ]; -} diff --git a/makefu/2configs/bureautomation/automation/nachtlicht.nix b/makefu/2configs/bureautomation/automation/nachtlicht.nix deleted file mode 100644 index ade89418d..000000000 --- a/makefu/2configs/bureautomation/automation/nachtlicht.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - services.home-assistant.config.automation = - [ - # 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 = "sun.sun"; - value_template = "{{ state.attributes.elevation }}"; - below = 10; - - }; - action = - { service = "homeassistant.turn_on"; - entity_id = [ "group.nachtlicht" ]; - }; - } - { - alias = "Turn off Nachtlicht at dawn"; - trigger = - { platform = "sun"; - event = "sunrise"; - offset = "01:30:00"; # on dawn - }; - # TODO: when somebody is still in the buero - # condition = - #{ - #}; - action = - { service = "homeassistant.turn_off"; - entity_id = [ "group.nachtlicht" ]; - }; - } - ]; -} diff --git a/makefu/2configs/bureautomation/automation/philosophische-tuer.nix b/makefu/2configs/bureautomation/automation/philosophische-tuer.nix deleted file mode 100644 index 9586d9a46..000000000 --- a/makefu/2configs/bureautomation/automation/philosophische-tuer.nix +++ /dev/null @@ -1,100 +0,0 @@ -{ config, pkgs, lib, ... }: - -let - short_threshold = 30; #seconds - long_threshold = 30; #minutes - sensor = "binary_sensor.buerotuer_contact"; - - # get the list of all - name = "tueraudio"; - prefix = "http://localhost:8123/local/${name}"; - audiodir = "${config.services.home-assistant.configDir}/www/${name}"; - recordrepo = pkgs.fetchFromGitHub { - owner = "makefu"; - repo = "philosophische_tuer"; - rev = "607eff7"; - sha256 = "1qlyqmc65yfb42q4fzd92vinx4i191w431skmcp7xjncb45lfp8j"; - }; - samples = user: lib.mapAttrsToList - (file: _: ''"${prefix}/${user}/${file}"'') - (builtins.readDir (toString ( recordrepo+ "/recordings/${user}"))); - random_tuerspruch = ''{{['' + (lib.concatStringsSep "," ( - (samples "Felix") ++ (samples "Sofia") ++ (samples "Markus") - )) + ''] | random}}''; # TODO read from derivation -in -{ - systemd.services.copy-philosophische-tuersounds = { - description = "copy philosophische tuer"; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Type = "oneshot"; - ExecStart = pkgs.writeDash "update-samples" '' - rm -rf "${audiodir}" - cp -vr "${recordrepo}/recordings" "${audiodir}" - ''; - }; - }; - services.home-assistant.config = { - media_extractor = { }; - script."philosophische_tuer" = { - alias = "Durchsage der philosophischen Tür"; - sequence = [ - { service = "media_player.play_media"; - data = { - entity_id = "media_player.mpd"; - media_content_type = "playlist"; - media_content_id = "ansage"; - }; - } - { delay.seconds = 5; } - { service = "media_extractor.play_media"; - entity_id = "media_player.mpd"; - data_template = { - media_content_id = random_tuerspruch; - media_content_type = "MUSIC"; - }; - } - ]; - }; - automation = - [ - { - alias = "Tür offen seit ${toString short_threshold} sekunden"; - trigger = - { platform = "state"; - entity_id = sensor; - to = "on"; - for.seconds = 60; - }; - action = [ - { service = "homeassistant.turn_on"; - entity_id = "script.philosophische_tuer"; - } - ]; - } - { - alias = "Tür offen seit ${toString long_threshold} minuten"; - trigger = - { platform = "state"; - entity_id = sensor; - to = "on"; - for.minutes = long_threshold; - }; - - action = [ - { service = "homeassistant.turn_on"; - entity_id = "script.philosophische_tuer" ; - } - { service = "tts.google_say"; - entity_id = "media_player.mpd"; - data_template = { - message = "BEEP BOOP - Die Tür ist schon seit ${toString long_threshold} Minuten offen! Student Nummer {{ range(1,500) | random }}, bitte schliesse die Tür"; - language = "de"; - }; - } - ]; - } - ]; - }; - -} diff --git a/makefu/2configs/bureautomation/automation/quotes.nix b/makefu/2configs/bureautomation/automation/quotes.nix deleted file mode 100644 index c4625ae30..000000000 --- a/makefu/2configs/bureautomation/automation/quotes.nix +++ /dev/null @@ -1,4 +0,0 @@ -# heiss -Lieber Freund, was für ein Sommer! Ich denke Sie mir im Zimmer sitzend, mehr Omelette als Mensch. -Sommer ist die Zeit, in der es zu heiß ist, um das zu tun, wozu es im Winter zu kalt war. - diff --git a/makefu/2configs/bureautomation/automation/schlechteluft.nix b/makefu/2configs/bureautomation/automation/schlechteluft.nix deleted file mode 100644 index ea1d44515..000000000 --- a/makefu/2configs/bureautomation/automation/schlechteluft.nix +++ /dev/null @@ -1,75 +0,0 @@ -let - long_threshold = 30; -in -{ - services.home-assistant.config.automation = - [ - { - alias = "Bad Air Alarm 60 seconds"; - trigger = - { platform = "numeric_state"; - entity_id = "sensor.air_quality"; - above = 1523; - for.seconds = 60; - }; - 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" - ]; - } - ]; - } - { - 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"; - }; - } - ]; - } - ]; -} diff --git a/makefu/2configs/bureautomation/binary_sensor/buttons.nix b/makefu/2configs/bureautomation/binary_sensor/buttons.nix deleted file mode 100644 index 20590a6b3..000000000 --- a/makefu/2configs/bureautomation/binary_sensor/buttons.nix +++ /dev/null @@ -1,20 +0,0 @@ -let - tasmota_button = name: topic: - # detects a pushbutton press from tasmota - { platform = "mqtt"; - inherit name; - state_topic = "/bam/${topic}/cmnd/POWER"; - availability_topic = "/bam/${topic}/tele/LWT"; - payload_on = "ON"; - payload_off = "OFF"; - payload_available= "Online"; - payload_not_available= "Offline"; - # expire_after = "5"; #expire after 5 seconds - qos = 1; - }; -in { - services.home-assistant.config.binary_sensor = - [ - (tasmota_button "RedButton" "redbutton") - ]; -} diff --git a/makefu/2configs/bureautomation/binary_sensor/motion.nix b/makefu/2configs/bureautomation/binary_sensor/motion.nix deleted file mode 100644 index 0c5a808e0..000000000 --- a/makefu/2configs/bureautomation/binary_sensor/motion.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - services.home-assistant.config.binary_sensor = - [ - { platform = "mqtt"; - device_class = "motion"; - name = "Motion"; - state_topic = "/bam/easy2/movement/Switch"; - payload_on = "1"; - payload_off = "0"; - availability_topic = "/bam/easy2/tele/LWT"; - payload_available = "Online"; - payload_not_available = "Offline"; - } - ]; -} diff --git a/makefu/2configs/bureautomation/brother-ql-web.nix b/makefu/2configs/bureautomation/brother-ql-web.nix deleted file mode 100644 index 26887db03..000000000 --- a/makefu/2configs/bureautomation/brother-ql-web.nix +++ /dev/null @@ -1,23 +0,0 @@ - {pkgs, ... }: - let - pkg = pkgs.brother_ql_web; - in { - systemd.services.brother-ql-web = { - after = [ "network.target" ]; - description = "Brother QL Web Interface"; - wantedBy = [ "multi-user.target" ]; - environment = { - FLASK_PRINTER = "usb://0x04f9:0x209b/000F1Z401759"; - FLASK_MODEL = "QL-800"; - #FLASK_SERVER_PORT = "8013"; - #FLASK_LABEL_DEFAULT_SIZE = "d24"; - #FLASK_LABEL_DEFAULT_QR_SIZE = "7"; - }; - serviceConfig = { - ExecStart = "${pkg}/bin/brother_ql_web"; - DynamicUser = true; - SupplementaryGroups = "lp"; - Restart = "always"; - }; - }; -} diff --git a/makefu/2configs/bureautomation/camera/comic.nix b/makefu/2configs/bureautomation/camera/comic.nix deleted file mode 100644 index ae24760e3..000000000 --- a/makefu/2configs/bureautomation/camera/comic.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - services.home-assistant.config.camera = - [ - { name = "Poorly Drawn Lines"; - platform = "generic"; - still_image_url = http://127.0.0.1:8123/local/lines.png ; - } - { name = "XKCD"; - platform = "generic"; - still_image_url = http://127.0.0.1:8123/local/xkcd.png ; - } - ]; -} diff --git a/makefu/2configs/bureautomation/camera/stuttgart.nix b/makefu/2configs/bureautomation/camera/stuttgart.nix deleted file mode 100644 index 0badcb285..000000000 --- a/makefu/2configs/bureautomation/camera/stuttgart.nix +++ /dev/null @@ -1,30 +0,0 @@ - -let - cam = name: still_image_url: - { - inherit name still_image_url; - platform = "generic"; - }; -in -{ - services.home-assistant.config.camera = - [ - ( cam "Max-Eyth-See" https://www.wav-stuttgart.de/webcam/_/webcam1.jpg ) - ( cam "Wilhelma" http://webcam.wilhelma.de/webcam02/webcam02.jpg ) - ( cam "Marktplatz" https://webcam.stuttgart.de/wcam007/current.jpg ) - ( cam "Schoch Areal" https://webcam.stuttgart.de/wcam004/current.jpg ) - ( cam "Leuze" https://webcam.stuttgart.de/wcam005/current.jpg ) - ( cam "Straße Wilhelma" https://webcam.stuttgart.de/wcam006/current.jpg ) - ( cam "Fernsehturm 1" http://webcam.fernsehturmstuttgart.com/current.jpg ) - ( cam "Fernsehturm 2" http://webcam.fernsehturmstuttgart.com/current2.jpg ) - ( cam "Feuerbach Lemberg" http://www.regio7.de/handy/current.jpg ) - ( cam "Flughafen Stuttgart 1" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam2.jpg ) - ( cam "Flughafen Stuttgart 2" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam5.jpg ) - ( cam "Flughafen Stuttgart 3" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam7.jpg ) - ( cam "S21 1" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-03/s21-turm03.jpg ) - ( cam "S21 2" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-02/s21-turm-02.jpg ) - ( cam "S21 3" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-01/s21-turm-01.jpg ) - ( cam "S21 4" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Jaegerstrasse-Nordkopf/s21-jaegerstrassse-nordkopf.jpg ) - ( cam "S21 5" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Bahndirektion-Nord/S21-Bundesbahndirektion-Nord.jpg ) - ]; -} diff --git a/makefu/2configs/bureautomation/camera/verkehrskamera.nix b/makefu/2configs/bureautomation/camera/verkehrskamera.nix deleted file mode 100644 index f09dc9423..000000000 --- a/makefu/2configs/bureautomation/camera/verkehrskamera.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - services.home-assistant.config.camera = - [ - { name = "Baumarkt"; - platform = "generic"; - still_image_url = http://t4915209254324-p80-c0-h6jv2afnujcoftrcstsafb45kdrqv4buy.webdirect.mdex.de/oneshotimage ;# baumarkt - } - { name = "Autobahn Heilbronn"; - platform = "generic"; - still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K10 ; - } - { name = "Autobahn Singen"; - platform = "generic"; - still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K11 ; - } - ]; -} diff --git a/makefu/2configs/bureautomation/comic-updater.nix b/makefu/2configs/bureautomation/comic-updater.nix deleted file mode 100644 index 5804d66d2..000000000 --- a/makefu/2configs/bureautomation/comic-updater.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ config, lib, pkgs, buildPythonPackage, ... }: - -let - mq = "192.168.8.11"; - pkg = pkgs.ampel; -in { - systemd.services.comic-updater = { - startAt = "daily"; - description = "update our comics"; - after = [ "network-online.target" ] ++ (lib.optional config.services.mosquitto.enable "mosquitto.service"); - path = with pkgs; [ wget xmlstarlet ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - # User = "hass"; - #WorkingDirectory = config.services.home-assistant.configDir; - WorkingDirectory = "/var/lib/homeassistant-docker"; - ExecStart = pkgs.writeDash "update-comics" '' - set -euf - mkdir -p www/ - cd www/ - # poorly drawn lines - pic=$(wget -O- http://www.poorlydrawnlines.com/feed/ \ - | xml sel -t -v '/rss/channel/item/content:encoded' \ - | head -n 2 | sed -n 's/.*src="\([^"]\+\)".*/\1/p' ) - wget "$pic" -nc && cp -v "$(basename "$pic")" lines.png - |