From 060a8f28fa1fc648bdf66afb31a5d1efac868837 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 28 Jul 2023 22:24:15 +0200 Subject: makefu: move out to own repo, add vacation-note --- .../bureautomation/automation/bureau-shutdown.nix | 87 --------- .../bureautomation/automation/daily-news.nix | 20 -- .../bureautomation/automation/hass-restart.nix | 34 ---- .../bureautomation/automation/nachtlicht.nix | 38 ---- .../automation/philosophische-tuer.nix | 100 ---------- .../2configs/bureautomation/automation/quotes.nix | 4 - .../bureautomation/automation/schlechteluft.nix | 75 -------- .../bureautomation/binary_sensor/buttons.nix | 20 -- .../bureautomation/binary_sensor/motion.nix | 15 -- makefu/2configs/bureautomation/brother-ql-web.nix | 23 --- makefu/2configs/bureautomation/camera/comic.nix | 13 -- .../2configs/bureautomation/camera/stuttgart.nix | 30 --- .../bureautomation/camera/verkehrskamera.nix | 17 -- makefu/2configs/bureautomation/comic-updater.nix | 37 ---- makefu/2configs/bureautomation/default.nix | 203 -------------------- makefu/2configs/bureautomation/deps/aresponses.nix | 38 ---- .../bureautomation/deps/openwrt-luci-rpc.nix | 34 ---- .../bureautomation/device_tracker/openwrt.nix | 18 -- makefu/2configs/bureautomation/devices/users.nix | 17 -- makefu/2configs/bureautomation/kalauerbot.nix | 28 --- makefu/2configs/bureautomation/led-fader.nix | 23 --- makefu/2configs/bureautomation/lib/scripts.nix | 18 -- makefu/2configs/bureautomation/light/buzzer.nix | 30 --- .../2configs/bureautomation/light/statuslight.nix | 58 ------ makefu/2configs/bureautomation/mpd.nix | 9 - .../2configs/bureautomation/multi/10h_timers.nix | 210 --------------------- makefu/2configs/bureautomation/multi/aramark.nix | 27 --- .../bureautomation/multi/daily-standup.nix | 57 ------ makefu/2configs/bureautomation/multi/frosch.nix | 103 ---------- makefu/2configs/bureautomation/multi/matrix.nix | 69 ------- .../2configs/bureautomation/multi/mittagessen.nix | 92 --------- .../bureautomation/office-radio/default.nix | 6 - .../2configs/bureautomation/office-radio/mpd.nix | 58 ------ .../bureautomation/office-radio/mpdconfig.nix | 6 - .../bureautomation/office-radio/webserver.nix | 40 ---- makefu/2configs/bureautomation/ota.nix | 15 -- makefu/2configs/bureautomation/person/team.nix | 87 --------- makefu/2configs/bureautomation/printer.nix | 28 --- makefu/2configs/bureautomation/puppy-proxy.nix | 5 - makefu/2configs/bureautomation/rhasspy.nix | 41 ---- .../2configs/bureautomation/script/multi_blink.nix | 60 ------ .../2configs/bureautomation/sensor/airquality.nix | 12 -- makefu/2configs/bureautomation/sensor/espeasy.nix | 33 ---- makefu/2configs/bureautomation/sensor/outside.nix | 32 ---- makefu/2configs/bureautomation/sensor/pollen.nix | 7 - .../bureautomation/sensor/tasmota_firmware.nix | 19 -- makefu/2configs/bureautomation/stream/puppies.nix | 4 - makefu/2configs/bureautomation/switch/rfbridge.nix | 19 -- .../bureautomation/switch/tasmota_switch.nix | 25 --- .../2configs/bureautomation/visitor-photostore.nix | 57 ------ .../bureautomation/zigbee2mqtt/default.nix | 31 --- .../2configs/bureautomation/zigbee2mqtt/hass.nix | 130 ------------- 52 files changed, 2262 deletions(-) delete mode 100644 makefu/2configs/bureautomation/automation/bureau-shutdown.nix delete mode 100644 makefu/2configs/bureautomation/automation/daily-news.nix delete mode 100644 makefu/2configs/bureautomation/automation/hass-restart.nix delete mode 100644 makefu/2configs/bureautomation/automation/nachtlicht.nix delete mode 100644 makefu/2configs/bureautomation/automation/philosophische-tuer.nix delete mode 100644 makefu/2configs/bureautomation/automation/quotes.nix delete mode 100644 makefu/2configs/bureautomation/automation/schlechteluft.nix delete mode 100644 makefu/2configs/bureautomation/binary_sensor/buttons.nix delete mode 100644 makefu/2configs/bureautomation/binary_sensor/motion.nix delete mode 100644 makefu/2configs/bureautomation/brother-ql-web.nix delete mode 100644 makefu/2configs/bureautomation/camera/comic.nix delete mode 100644 makefu/2configs/bureautomation/camera/stuttgart.nix delete mode 100644 makefu/2configs/bureautomation/camera/verkehrskamera.nix delete mode 100644 makefu/2configs/bureautomation/comic-updater.nix delete mode 100644 makefu/2configs/bureautomation/default.nix delete mode 100644 makefu/2configs/bureautomation/deps/aresponses.nix delete mode 100644 makefu/2configs/bureautomation/deps/openwrt-luci-rpc.nix delete mode 100644 makefu/2configs/bureautomation/device_tracker/openwrt.nix delete mode 100644 makefu/2configs/bureautomation/devices/users.nix delete mode 100644 makefu/2configs/bureautomation/kalauerbot.nix delete mode 100644 makefu/2configs/bureautomation/led-fader.nix delete mode 100644 makefu/2configs/bureautomation/lib/scripts.nix delete mode 100644 makefu/2configs/bureautomation/light/buzzer.nix delete mode 100644 makefu/2configs/bureautomation/light/statuslight.nix delete mode 100644 makefu/2configs/bureautomation/mpd.nix delete mode 100644 makefu/2configs/bureautomation/multi/10h_timers.nix delete mode 100644 makefu/2configs/bureautomation/multi/aramark.nix delete mode 100644 makefu/2configs/bureautomation/multi/daily-standup.nix delete mode 100644 makefu/2configs/bureautomation/multi/frosch.nix delete mode 100644 makefu/2configs/bureautomation/multi/matrix.nix delete mode 100644 makefu/2configs/bureautomation/multi/mittagessen.nix delete mode 100644 makefu/2configs/bureautomation/office-radio/default.nix delete mode 100644 makefu/2configs/bureautomation/office-radio/mpd.nix delete mode 100644 makefu/2configs/bureautomation/office-radio/mpdconfig.nix delete mode 100644 makefu/2configs/bureautomation/office-radio/webserver.nix delete mode 100644 makefu/2configs/bureautomation/ota.nix delete mode 100644 makefu/2configs/bureautomation/person/team.nix delete mode 100644 makefu/2configs/bureautomation/printer.nix delete mode 100644 makefu/2configs/bureautomation/puppy-proxy.nix delete mode 100644 makefu/2configs/bureautomation/rhasspy.nix delete mode 100644 makefu/2configs/bureautomation/script/multi_blink.nix delete mode 100644 makefu/2configs/bureautomation/sensor/airquality.nix delete mode 100644 makefu/2configs/bureautomation/sensor/espeasy.nix delete mode 100644 makefu/2configs/bureautomation/sensor/outside.nix delete mode 100644 makefu/2configs/bureautomation/sensor/pollen.nix delete mode 100644 makefu/2configs/bureautomation/sensor/tasmota_firmware.nix delete mode 100644 makefu/2configs/bureautomation/stream/puppies.nix delete mode 100644 makefu/2configs/bureautomation/switch/rfbridge.nix delete mode 100644 makefu/2configs/bureautomation/switch/tasmota_switch.nix delete mode 100644 makefu/2configs/bureautomation/visitor-photostore.nix delete mode 100644 makefu/2configs/bureautomation/zigbee2mqtt/default.nix delete mode 100644 makefu/2configs/bureautomation/zigbee2mqtt/hass.nix (limited to 'makefu/2configs/bureautomation') diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix deleted file mode 100644 index f4c10adc..00000000 --- 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 2bafe479..00000000 --- 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 3b3ce059..00000000 --- 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 ade89418..00000000 --- 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 9586d9a4..00000000 --- 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 c4625ae3..00000000 --- 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 ea1d4451..00000000 --- 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 20590a6b..00000000 --- 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 0c5a808e..00000000 --- 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 26887db0..00000000 --- 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 ae24760e..00000000 --- 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 0badcb28..00000000 --- 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 f09dc942..00000000 --- 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 5804d66d..00000000 --- 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 - - #pic=$(curl -L xkcd.com 2>/dev/null | grep imgs.xkcd.com | grep title | sed -n 's/.*src="\([^"]\+\)" .*/https:\1/p') - # xkcd - pic=$(wget -O- https://xkcd.com/rss.xml \ - | xml sel -t -v '/rss/channel/item/description' \ - | head -n 1 | sed -n 's/.*src="\([^"]\+\)".*/\1/p' ) - wget "$pic" -nc && cp -v "$(basename "$pic")" xkcd.png - ''; - PrivateTmp = true; - }; - }; -} diff --git a/makefu/2configs/bureautomation/default.nix b/makefu/2configs/bureautomation/default.nix deleted file mode 100644 index cd162ba3..00000000 --- a/makefu/2configs/bureautomation/default.nix +++ /dev/null @@ -1,203 +0,0 @@ -{ config, pkgs, lib, ... }: -let - kodi-host = "192.168.8.11"; - unstable = import {}; - confdir = "/var/lib/homeassistant-docker"; -in { - imports = [ - ./ota.nix - ./comic-updater.nix - # ./puppy-proxy.nix - - ./zigbee2mqtt - ./rhasspy.nix - - # hass config - ## complex configs - # ./multi/daily-standup.nix - #./multi/aramark.nix - #./multi/matrix.nix - #./multi/frosch.nix - #./multi/mittagessen.nix - #./multi/10h_timers.nix - - #./switch/tasmota_switch.nix - #./switch/rfbridge.nix - - #./light/statuslight.nix - #./light/buzzer.nix - - #./script/multi_blink.nix - - #./binary_sensor/buttons.nix - #./binary_sensor/motion.nix - - ## ./sensor/pollen.nix requires dwd_pollen - #./sensor/espeasy.nix - #./sensor/airquality.nix - #./sensor/outside.nix - #./sensor/tasmota_firmware.nix - - #./camera/verkehrskamera.nix - #./camera/comic.nix - #./camera/stuttgart.nix - #./automation/bureau-shutdown.nix - #./automation/nachtlicht.nix - #./automation/schlechteluft.nix - #./automation/philosophische-tuer.nix - #./automation/hass-restart.nix - #./device_tracker/openwrt.nix - #./person/team.nix - ]; - - networking.firewall.allowedTCPPorts = [ 8123 ]; - state = [ "/var/lib/hass/known_devices.yaml" ]; - virtualisation.oci-containers.containers.hass = { - image = "homeassistant/home-assistant:latest"; - #user = "${toString config.users.users.kiosk.uid}:${toString config.users.groups.kiosk.gid}"; - #user = "${toString config.users.users.kiosk.uid}:root"; - environment = { - TZ = "Europe/Berlin"; - PUID = toString config.users.users.kiosk.uid; - PGID = toString config.users.groups.kiosk.gid; - UMASK = "007"; - }; - extraOptions = ["--net=host" ]; - volumes = [ - "${confdir}:/config" - "/data/music:/config/media" - #"${confdir}/docker-run:/etc/services.d/home-assistant/run:" - ]; - }; - systemd.tmpfiles.rules = [ - #"f ${confdir}/docker-run 0770 kiosk kiosk - -" - "d ${confdir} 0770 kiosk kiosk - -" - ]; - #services.home-assistant = { - # enable = true; - # package = (unstable.home-assistant.overrideAttrs (old: { - # doInstallCheck = false; - # })).override { - # extraPackages = p: [ - # # TODO: put somewhere else - # (p.callPackage {}) - # # (p.callPackage {}) - # p.APScheduler ]; - # }; - # autoExtraComponents = true; - # config = { - # config = {}; - # discovery = {}; - # homeassistant = { - # name = "Bureautomation"; - # time_zone = "Europe/Berlin"; - # latitude = "48.8265"; - # longitude = "9.0676"; - # elevation = 303; - # auth_providers = [ - # { type = "homeassistant";} - # { type = "legacy_api_password"; - # api_password = "sistemas"; - # } - # { type = "trusted_networks"; - # trusted_networks = [ - # "127.0.0.1/32" - # "192.168.8.0/24" - # "::1/128" - # "fd00::/8" - # ]; - # # allow_bypass_login = true; - # } - # ]; - # }; - # # https://www.home-assistant.io/components/influxdb/ - # influxdb = { - # database = "hass"; - # tags = { - # instance = "wbob"; - # source = "hass"; - # }; - # }; - # mqtt = { - # discovery = true; - # discovery_prefix = "homeassistant"; - # broker = "localhost"; - # port = 1883; - # client_id = "home-assistant"; - # keepalive = 60; - # protocol = 3.1; - # birth_message = { - # topic = "/bam/hass/tele/LWT"; - # payload = "Online"; - # qos = 1; - # retain = true; - # }; - # will_message = { - # topic = "/bam/hass/tele/LWT"; - # payload = "Offline"; - # qos = 1; - # retain = true; - # }; - # }; - # notify = [ - # { - # platform = "kodi"; - # name = "wbob-kodi"; - # host = kodi-host; - # } - # #{ - # # platform = "telegram"; - # # name = "telegrambot"; - # # chat_id = builtins.elemAt - # # (builtins.fromJSON (builtins.readFile - # # )).allowed_chat_ids 0; - # #} - # ]; - # media_player = [ - # { platform = "kodi"; - # host = kodi-host; - # } - # { platform = "mpd"; - # host = "127.0.0.1"; - # } - # ]; - - # # sensor = [{ platform = "version"; }]; # pyhaversion - - - - # frontend = { }; - # http = { - # # TODO: https://github.com/home-assistant/home-assistant/issues/16149 - # # base_url = "http://192.168.8.11:8123"; - # }; - # conversation = {}; - # history = {}; - # logbook = {}; - # tts = [ - # { platform = "google_translate"; - # language = "de"; - # time_memory = 57600; - # service_name = "google_say"; - # } - # { platform = "voicerss"; - # api_key = builtins.readFile ; - # language = "de-de"; - # } - # #{ platform = "picotts"; - # # language = "de-DE"; - # #} - # ]; - # recorder = {}; - # sun = {}; - # #telegram_bot = [ - # # (builtins.fromJSON - # # (builtins.readFile )) - # #]; - # # only for automation - # # feedreader.urls = [ "http://www.heise.de/security/rss/news-atom.xml" ]; - # # we don't use imports because the expressions do not merge in - # # home-assistant - # }; - #}; -} diff --git a/makefu/2configs/bureautomation/deps/aresponses.nix b/makefu/2configs/bureautomation/deps/aresponses.nix deleted file mode 100644 index 9e64d2f6..00000000 --- a/makefu/2configs/bureautomation/deps/aresponses.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ lib -, buildPythonPackage -, fetchPypi -# propagatedBuildInputs -, aiohttp -# buildInputs -, pytest -, pytest-asyncio -}: - -buildPythonPackage rec { - pname = "aresponses"; - version = "1.1.1"; - - src = fetchPypi { - inherit pname version; - sha256 = "d1d6ef52b9a97142d106688cf9b112602ef3dc66f6368de8f91f47241d8cfc9c"; - }; - - propagatedBuildInputs = [ - aiohttp - ]; - - buildInputs = [ - pytest - pytest-asyncio - ]; - - # tests only distributed via git repository, not pypi - doCheck = false; - - meta = with lib; { - description = "Asyncio testing server"; - homepage = "https://github.com/circleup/aresponses"; - license = licenses.mit; - maintainers = [ maintainers.makefu ]; - }; -} diff --git a/makefu/2configs/bureautomation/deps/openwrt-luci-rpc.nix b/makefu/2configs/bureautomation/deps/openwrt-luci-rpc.nix deleted file mode 100644 index 4eceeb14..00000000 --- a/makefu/2configs/bureautomation/deps/openwrt-luci-rpc.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ lib -, buildPythonPackage -, fetchPypi -, click -, requests -, packaging -}: - -buildPythonPackage rec { - pname = "openwrt-luci-rpc"; - version = "1.1.2"; - - src = fetchPypi { - inherit pname version; - sha256 = "174a1f6c0bb2a2ed76e5299d14e2be05c612e8bcd4c15b9a9aedee1ef8e18b90"; - }; - - patchPhase = '' - sed -i -e "s/requests==2.21.0/requests/" -e "s/packaging==19.1/packaging/" setup.py - ''; - - propagatedBuildInputs = [ - click - requests - packaging - ]; - - meta = with lib; { - description = "Module for interacting with OpenWrt Luci RPC interface"; - homepage = https://github.com/fbradyirl/openwrt-luci-rpc; - license = licenses.asl20; - maintainers = [ maintainers.makefu ]; - }; -} diff --git a/makefu/2configs/bureautomation/device_tracker/openwrt.nix b/makefu/2configs/bureautomation/device_tracker/openwrt.nix deleted file mode 100644 index b597548e..00000000 --- a/makefu/2configs/bureautomation/device_tracker/openwrt.nix +++ /dev/null @@ -1,18 +0,0 @@ -# requires `opkg install luci-mod-rpc` on router -# see https://www.home-assistant.io/components/luci/ - -{ - services.home-assistant.config.device_tracker = - [ - { platform = "luci"; - host = "192.168.8.1"; - username = "root"; - password = import ; - interval_seconds = 30; # instead of 12seconds - consider_home = 300; # 5 minutes timeout - new_device_defaults = { - track_new_devices = true; - }; - } - ]; -} diff --git a/makefu/2configs/bureautomation/devices/users.nix b/makefu/2configs/bureautomation/devices/users.nix deleted file mode 100644 index 305c0ca8..00000000 --- a/makefu/2configs/bureautomation/devices/users.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - thorsten-phone = { - name = "Thorsten"; - mac = "8c:f5:a3:bc:83:a0"; - track = true; - hide_if_away = true; - }; - felix-laptop = { - name = "Felix"; - mac = "6c:88:14:b4:43:9c"; - track = true; - hide_if_away = true; - }; - # b0:e5:ed:52:ee:43 - honor8 - # 38:94:96:b0:13:c7 - android-4ef03e4f4a14b6b9 - # ac:5f:3e:cc:b8:5e - Galaxy S7 -} diff --git a/makefu/2configs/bureautomation/kalauerbot.nix b/makefu/2configs/bureautomation/kalauerbot.nix deleted file mode 100644 index aa66e30b..00000000 --- a/makefu/2configs/bureautomation/kalauerbot.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ config, lib, pkgs, ... }: -let - oofdir = fetchTarball { - url = "https://o.euer.krebsco.de/s/AZn9QPLGFZeDfNq/download"; - sha256 = "1wa59rkgffql6hbiw9vv0zh35wx9x1cp4bnwicprbd0kdxj75miz"; - }; - -in -{ - systemd.services.kalauerbot = { - description = "Kalauerbot"; - after = [ "network-online.target" ]; - wantedBy = [ "multi-user.target" ]; - environment = import // { - "KALAUER_OOFDIR" = oofdir; - }; - serviceConfig = { - DynamicUser = true; - StateDirectory = "kalauerbot"; - WorkingDirectory = "/var/lib/kalauerbot"; - ExecStart = "${pkgs.kalauerbot}/bin/kalauerbot"; - PrivateTmp = true; - - Restart = "always"; - RuntimeMaxSec = "12h"; - }; - }; -} diff --git a/makefu/2configs/bureautomation/led-fader.nix b/makefu/2configs/bureautomation/led-fader.nix deleted file mode 100644 index d7f72853..00000000 --- a/makefu/2configs/bureautomation/led-fader.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ config, lib, pkgs, buildPythonPackage, ... }: - -let - mq = "192.168.8.11"; - pkg = pkgs.ampel; -in { - systemd.services.led-fader = { - description = "Send led change to message queue"; - environment = { - NIX_PATH = "/var/src"; - }; - after = [ "network-online.target" ] ++ (lib.optional config.services.mosquitto.enable "mosquitto.service"); - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - # User = "nobody"; # need a user with permissions to run nix-shell - ExecStartPre = pkgs.writeDash "sleep.sh" "sleep 2"; - ExecStart = "${pkg}/bin/ampel"; - Restart = "always"; - RestartSec = 10; - PrivateTmp = true; - }; - }; -} diff --git a/makefu/2configs/bureautomation/lib/scripts.nix b/makefu/2configs/bureautomation/lib/scripts.nix deleted file mode 100644 index d8665f94..00000000 --- a/makefu/2configs/bureautomation/lib/scripts.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ lib, ... }: -{ - multi_flash = { entity, delays ? [ 500 ], alias ? "${entity}_multi_flash_${toString (lib.length delays)}" }: - { - inherit alias; - sequence = lib.flatten (builtins.map (delay: [ - { service = "homeassistant.turn_on"; - data.entity_id = entity; - } - { delay.milliseconds = delay; } - { service = "homeassistant.turn_off"; - data.entity_id = entity; - } - { delay.milliseconds = delay; } - ] - ) delays); - }; -} diff --git a/makefu/2configs/bureautomation/light/buzzer.nix b/makefu/2configs/bureautomation/light/buzzer.nix deleted file mode 100644 index 4851dbd9..00000000 --- a/makefu/2configs/bureautomation/light/buzzer.nix +++ /dev/null @@ -1,30 +0,0 @@ -let - tasmota_pwm = name: topic: pwmid: max: - let - id = "PWM${toString pwmid}"; - in { platform = "mqtt"; - inherit name; - state_topic = "/bam/${topic}/stat/RESULT"; - state_value_template = ''{%- if value_json["PWM"]["${id}"]| int > 0 -%} ${toString max} {%- else -%} 0 {%- endif -%}''; - - command_topic = "/bam/${topic}/cmnd/${id}"; - on_command_type = "brightness"; - brightness_command_topic = "/bam/${topic}/cmnd/${id}"; - brightness_value_template = ''{{value_json["PWM"]["${id}"]}}''; - brightness_scale = max; - payload_on = "${toString max}"; - payload_off = "0"; - availability_topic = "/bam/${topic}/tele/LWT"; - payload_available= "Online"; - payload_not_available= "Offline"; - retain = true; - optimistic = false; - qos = 0; - }; -in { - services.home-assistant.config.light = - [ - # (tasmota_pwm "RedButton LED" "redbutton" 1 1023) #LED PWM1 - # (tasmota_pwm "RedButton Buzzer" "redbutton" 2 512) #buzzer PWM2 - ]; -} diff --git a/makefu/2configs/bureautomation/light/statuslight.nix b/makefu/2configs/bureautomation/light/statuslight.nix deleted file mode 100644 index de65a237..00000000 --- a/makefu/2configs/bureautomation/light/statuslight.nix +++ /dev/null @@ -1,58 +0,0 @@ -let - tasmota_rgb = name: topic: -# LED WS2812b -# effect_state_topic: "stat/led/Scheme" -# effect_command_topic: "cmnd/led/Scheme" -# effect_value_template: "{{ value_json.Scheme }}" - { platform = "mqtt"; - inherit name; - retain = false; - qos = 1; - #optimistic = true; - # state - command_topic = "/bam/${topic}/cmnd/POWER"; - state_topic = "/bam/${topic}/tele/STATE"; - value_template = "{{ value_json.POWER }}"; - availability_topic = "/bam/${topic}/tele/LWT"; - payload_on = "ON"; - payload_off = "OFF"; - payload_available= "Online"; - payload_not_available= "Offline"; - # brightness - brightness_state_topic = "/bam/${topic}/tele/STATE"; - brightness_value_template = "{{value_json.Dimmer|default(100)}}"; - brightness_command_topic = "/bam/${topic}/cmnd/Dimmer"; - brightness_scale = 100; - # color - rgb_state_topic = "/bam/${topic}/stat/RESULT"; - rgb_command_topic = "/bam/${topic}/cmnd/Color2"; - rgb_value_template = "{{(value_json.Channel[0]*2.55)|int}},{{(value_json.Channel[1]*2.55)|int}},{{(value_json.Channel[2]*2.55)|int}}"; - - # effects - effect_state_topic = "/bam/${topic}/tele/STATE"; - effect_value_template = "{{value_json.Scheme|default(0)}}"; - effect_command_topic = "/bam/${topic}/cmnd/Scheme"; - effect_list = [ - 0 # single color for LED light - 1 # start wake up sequence (same as Wakeup) - 2 # cycle up through colors using Speed option - 3 # cycle down through colors using Speed option - 4 # random cycle through colors using Speed and Fade - 5 # clock mode (example) - 6 # candlelight pattern - 7 # RGB pattern - 8 # Christmas pattern - 9 # Hannukah pattern - 10 # Kwanzaa pattern - 11 # rainbow pattern - 12 # fire pattern - ]; - }; -in { - services.home-assistant.config.light = - [ - (tasmota_rgb "Status Felix" "status1") - (tasmota_rgb "Status Daniel" "status2") - (tasmota_rgb "Buslicht" "buslicht") - ]; -} diff --git a/makefu/2configs/bureautomation/mpd.nix b/makefu/2configs/bureautomation/mpd.nix deleted file mode 100644 index 1f5acb35..00000000 --- a/makefu/2configs/bureautomation/mpd.nix +++ /dev/null @@ -1,9 +0,0 @@ -{lib,pkgs, ... }: - -{ - systemd.services."ympd-wbob" = { - description = "mpd "; - wantedBy = [ "multi-user.target" ]; - serviceConfig.ExecStart = "${pkgs.ympd}/bin/ympd --host localhost --port 6600 --webport 8866 --user nobody"; - }; -} diff --git a/makefu/2configs/bureautomation/multi/10h_timers.nix b/makefu/2configs/bureautomation/multi/10h_timers.nix deleted file mode 100644 index 6edcde4b..00000000 --- a/makefu/2configs/bureautomation/multi/10h_timers.nix +++ /dev/null @@ -1,210 +0,0 @@ -{lib, ... }: -let - persons = [ "frank" "daniel" "thorsten" "carsten" "ecki" "felix" - "thierry" # tjeri - "emeka" - "tancrede" - ]; - random_zu_lange = name: ''{{ [ - "Du musst jetzt endlich nach Hause gehen ${name}!", - "${name} - 10 Stunden sind rum, bald schenkst du den Franzosen deine Lebenszeit", - "Nur eine Minute über 10 Stunden kann zu einer Stunde Arbeit für Thorsten werden, ${name}.", - "In 10 Minuten kommt dich der Security Mann holen, ${name}", - "Das Sandmännchen ist schon vorbei, gleich fallen dir die Augen zu ${name}.", - "Wenn ${name} sofort los geht, dann ist er noch rechtzeitig für den Tatort zu Hause.", - "${name} muss jetzt gehen, sonst verpasst er die Tagesschau!", - "Es ist spät ${name}. Ausstempeln hilft zwar kurzfristig, kann aber zu langfristigen Problemen führen.", - "${name}, wenn du nach zehn Stunden nach Hause gehst, muss dir dein Vorgesetzter ein Taxi bestellen", - "${name}, wenn du nach zehn Stunden nach Hause gehst, bist du auf dem Rückweg nicht mehr versichert!", - "Zu lange, ${name}!" ] | random }}'' ; - - - random_announce = name: ''{{ [ - "${name} is in da House", - "Ahoi ${name}", - "Hallöchen Popöchen ${name}", - "Moinsen ${name}", - "Moin Moin ${name}", - "Palim, Palim ${name}", - "Vorwärts Genosse ${name}", - "Gemeinsame Grüße, Genosse ${name}", - "Sozialistische Grüße, Genosse ${name}", - "Konzentrierte Grüße, Genosse ${name}", - "Ach, der ${name} ist auch wieder da...", - "Nicht ${name} schon wieder", - "Tri tra tralala, der ${name} ist wieder da.", - "Na sieh mal einer an, ${name} hat es auch her geschafft", - "Wer ist im Büro eingetroffen? ${name} ist es!", - "Willkommen in deinem Lieblingsbüro, ${name}.", - "Klopf, Klopf, wer ist da? ${name} ist da!", - "Messer, Gabel, Schere, Licht sind für kleinen ${name} nicht.", - "Ich kenne ein Geheimnis, ${name} ist angekommen", - "Wir sind ${name}. Sie werden assimiliert werden", - "Achtung, es erfolgt eine Durchsage. ${name} ist eingetroffen", - "Die Scanner haben eine dem System bekannte Lebensform mit dem Namen ${name} detektiert", - "Das Büro sieht dich, ${name}", - "Das Büro riecht dich, ${name}", - "Im Kalender von ${name} sind heute acht Meetings eingeplant, von denen zwei bereits verpasst wurden", - "Das Postfach von ${name} beinhaltet einhundertachtundzwanzig ungelesene E-Mails.", - "Nachricht von Serge: ${name}, bitte melden Sie sich Umgehend bei mir im Büro!", - "Luftqualität hat sich durch das Eintreffen von ${name} um zweihundert Punkte verschlechtert, bitte alle Fenster öffnen.", - "Die Tür geht auf, wer mag das sein? Schon schreitet hier der ${name} ein. Das Volk, es jubelt, Dirnen schmachten. Fürs Festmahl beginnt man schon zu schlachten. Er wird nur nach dem besten streben! Der ${name}, er soll lange leben!", - "${name} arbeitet gern für seinen Konzern", - "${name} ist nur froh im Großraumbüro", - "Für ${name} ist die schönste Zeit ... die Arbeit", - "Ein Fleißbienchen für ${name} zum rechtzeitigen Erscheinen im Büro", - "${name} ist heute wohl doch nicht im Office Home", - "${name} ist bereit für einen Tag voller Meetings", - "Und es startet für ${name} wieder ein Tag im Paradies", - "Lieber ${name}, Markus Keck hat dich bereits drei mal Versucht anzurufen!", - "Trotz schwerer Männergrippe ist ${name} heute im Büro erschienen.", - "${name} kennt keine Parteien mehr, ${name} kennt nur noch Arbeitsplätze", - "${name}, Frage nicht, was dein Arbeitsplatz für dich tun kann. Frage, was du für deinen Arbeitsplatz tun kannst", - "${name} läuft bis in den Jemen - für sein Unternehmen. ${name} schwimmt bis nach Birma - für seine Firma", - "Der Cyberian ${name} ist gekommen um die Bahnwelt vor Cyber-Angriffen zu schützen", - "Alles paletto im Ghetto, ${name}?", - "Hach, ${name}, wenn du hier rein kommst fühlt es sich gleich wieder an wie Montag.", - "Oh nein, nicht schon wieder ${name}", - "Wer wohnt in der Ananas ganz tief im Meer? ${name} Schwammkopf!", - "Arbeit ist Freizeit! Wachstum ist Fortschritt! Sicherheit ist Freiheit! Eine kleine Erinnerung für ${name}"] | random }}'' ; - tmr_10h = name: { - "${name}_10h" = { - name = "${name} 10h Timer"; - duration = "10:00:00"; - }; - }; - - zu_lange_user = name: - { "zu_lange_${name}" = { - alias = "Random Zu Lange ${name}"; - - sequence = [ - { service = "media_player.play_media"; - data = { - entity_id = "media_player.mpd"; - media_content_type = "playlist"; - media_content_id = "ansage"; - }; - } - { delay.seconds = 5; } - { service = "tts.google_say"; - entity_id = "media_player.mpd"; - data_template = { - message = random_zu_lange name; - language = "de"; - }; - } - ]; - }; - }; - announce_user = name: - { "announce_${name}" = { - alias = "Random Announce ${name}"; - sequence = [ - { delay.seconds = 7; } - { service = "media_player.play_media"; - data = { - entity_id = "media_player.mpd"; - media_content_type = "playlist"; - media_content_id = "ansage"; - }; - } - { delay.seconds = 4; } - { service = "tts.google_say"; - entity_id = "media_player.mpd"; - data_template = { - message = random_announce name; - language = "de"; - }; - } - ]; - }; - }; - automation_10h = name: [ - { alias = "start ${name} 10h"; - trigger = { - platform = "state"; - entity_id = [ "person.${name}"]; - from = "not_home"; - to = "home"; - }; - condition = { - condition = "and"; - conditions = [ - { condition = "state"; - entity_id = "timer.${name}_10h"; - state = "idle"; - } - { condition = "time"; - after = "06:00:00"; - before = "12:00:00"; - } - ]; - }; - action = [ - { service = "timer.start"; - entity_id = [ "timer.${name}_10h" ] ; - } - { service = "homeassistant.turn_on"; - entity_id = - [ "switch.fernseher" - "script.blitz_10s" - "script.announce_${name}" - ]; - } - ]; - } - - { alias = "pommes announce ${name}"; - trigger = - { platform = "event"; - event_type = "timer.started"; - event_data.entity_id = "timer.${name}_10h"; - }; - - condition = - { condition = "state"; - entity_id = "binary_sensor.pommes"; - state = "on"; - }; - - action = - { service = "homeassistant.turn_on"; - entity_id = "script.blasen_10s" ; - }; - } - - { alias = "Zu lange ${name}!"; - trigger = - { platform = "event"; - event_type = "timer.finished"; - event_data.entity_id = "timer.${name}_10h"; - }; - - condition = - { condition = "state"; - entity_id = "person.${name}"; - state = "home"; - }; - - action = - { service = "homeassistant.turn_on"; - entity_id = [ - "script.blitz_10s" - "script.zu_lange_${name}" - ]; - }; - } - ]; -in -{ - services.home-assistant.config = { - timer =lib.fold lib.recursiveUpdate {} - (map tmr_10h persons); - automation = (lib.flatten (map automation_10h persons)); - script = lib.fold lib.recursiveUpdate {} ( - (map announce_user persons) ++ - (map zu_lange_user persons) - ); - }; -} diff --git a/makefu/2configs/bureautomation/multi/aramark.nix b/makefu/2configs/bureautomation/multi/aramark.nix deleted file mode 100644 index 45fadb08..00000000 --- a/makefu/2configs/bureautomation/multi/aramark.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ lib, ... }: -let - aramark = topic: name: - { platform = "mqtt"; - inherit name; - state_topic = "/aramark/thales-deutschland/${topic}"; - }; - aramark_menue = menue: - [ - (aramark "${menue}/title" menue) - (aramark "${menue}/description" "${menue} Text") - ((aramark "${menue}/price" "${menue} Preis") // { unit_of_measurement = "€"; }) - ]; -in - { - services.home-assistant.config = - { - sensor = (aramark_menue "Menü 1") - ++ (aramark_menue "Menü 2") - ++ (aramark_menue "Mercato") - ++ (aramark_menue "Aktion"); - binary_sensor = - [ - ((aramark "pommes" "Pommes" ) // { payload_on = "True"; payload_off = "False"; }) - ]; - }; -} diff --git a/makefu/2configs/bureautomation/multi/daily-standup.nix b/makefu/2configs/bureautomation/multi/daily-standup.nix deleted file mode 100644 index 063def1e..00000000 --- a/makefu/2configs/bureautomation/multi/daily-standup.nix +++ /dev/null @@ -1,57 +0,0 @@ -{lib, ... }: -let - random_daily_text = ''{{ [ - "Es ist so weit, es ist Standup Zeit!", - "Zehn Uhr Fünfunddreissig ist genau die richtige Zeit für ein Standup!", - "Hat jeder seine zum Standup seine Hausaufgaben gemacht. Bitte einmal aufstehen und den Zettel nach rechts geben", - "Aufstehen zum Appell, es wird die Anwesenheit kontrolliert!", - "Hallo Kinder, wisst ihr welche Zeit es ist ... Genau ... Standup Zeit!", - "Morgens, halb elf in Deutschland - das Standupchen" ] | random }}''; - -in { - services.home-assistant.config = - { - script = - { "random_daily" = { - alias = "Random Daily Introduction"; - - sequence = [ - { service = "media_player.play_media"; - data = { - entity_id = "media_player.mpd"; - media_content_type = "playlist"; - media_content_id = "ansage"; - }; - } - { delay.seconds = 5; } - { service = "tts.google_say"; - entity_id = "media_player.mpd"; - data_template = { - message = random_daily_text; - language = "de"; - }; - } - ]; - }; - }; - automation = [ - { - alias = "Daily Standup"; - trigger = { - platform = "time"; - at = "10:35:00"; - }; - action = - [ - { service = "homeassistant.turn_on"; - entity_id = [ - "script.blitz_10s" - "script.random_daily" - ]; - } - ]; - - } - ]; - }; -} diff --git a/makefu/2configs/bureautomation/multi/frosch.nix b/makefu/2configs/bureautomation/multi/frosch.nix deleted file mode 100644 index 61606d4e..00000000 --- a/makefu/2configs/bureautomation/multi/frosch.nix +++ /dev/null @@ -1,103 +0,0 @@ -{lib, ... }: -# needs: binary_sensor.pommes -# notify.matrix_notify -let - random_pommes = '' {{ [ - "Nur ein Pommes Tag ist ein guter Tag", - "Schaut wie schön sie fliegen, die Pommes Seifenblasen", - "zwo ... eins ... Pommes Zeit", - "I cannot believe it is not Pommes", - "Naja, wenn es sonst schon nichts anderes gibt, kann man jetzt auch pommes nehmen", - "Wenn Aramark was kann, dann ist es frittieren", - "Einmal das Hauptgericht mit Pommes, ohne Hauptgericht", - "Rieche ich da etwa Pommes? JA!", - "Pommes ist auch nur Gemüse,also keine Reue und schlag zu!", - "Mit nur fünf Portionen Pommes kann man schon satt werden.", - "Heute für Sie, 15 Pommes von hand abgezählt", - "Der Weltmarktpreis von Pommes ist durch verschiedene Weltkrisen leider so hoch, dass Aramark den Verkaufspreis verdoppeln musste.", - "Vorfreude, schönste Freude, Freude bei Aramark. Pommes in die Schale rein, alle Kunden werden glücklich sein.", - "In 15 Minuten ist es wieder so weit, es ist Pommes Zeit!"] | random }}''; -in -{ - services.home-assistant.config = - { - sensor = [ - { platform = "mqtt"; - name = "frosch brightness"; - device_class = "illuminance"; - state_topic = "/bam/frosch/sensor/brightness/state"; - availability_topic = "/bam/frosch/status"; - payload_available = "online"; - payload_not_available = "offline"; - } - ]; - binary_sensor = [ - { platform = "mqtt"; - name = "frosch auge"; - state_topic = "/bam/frosch/binary_sensor/froschauge/state"; - availability_topic = "/bam/frosch/status"; - payload_available = "online"; - payload_not_available = "offline"; - } - ]; - switch = [ - { platform = "mqtt"; - name = "frosch blasen"; - state_topic = "/bam/frosch/switch/blasen/state"; - command_topic = "/bam/frosch/switch/blasen/command"; - availability_topic = "/bam/frosch/status"; - payload_available = "online"; - payload_not_available = "offline"; - } - ]; - light = []; - automation = [ - { alias = "Pommeszeit"; - trigger = { - platform = "time"; - at = "11:00:00"; - }; - condition = { - condition = "state"; - entity_id = "binary_sensor.pommes"; # from multi/aramark.nix - state = "on"; - }; - action = [ - { service = "homeassistant.turn_on"; - entity_id = [ - "script.pommes_announce" - "script.seifenblasen_30s" # from script/multi_blink.nix - ]; - } - ]; - } - ]; - script = { - pommes_announce = { - alias = "Random Pommes announce"; - sequence = [ - { - service = "media_player.play_media"; - data = { - entity_id = "media_player.mpd"; - media_content_type = "playlist"; - media_content_id = "ansage"; - }; - } - { delay.seconds = 5; } - { - service = "tts.google_say"; - entity_id = "media_player.mpd"; - data_template = { - message = random_pommes; - language = "de"; - }; - } - { service = "notify.matrix_notify"; - data_template.message = random_pommes; - } - ]; - }; - }; - }; -} diff --git a/makefu/2configs/bureautomation/multi/matrix.nix b/makefu/2configs/bureautomation/multi/matrix.nix deleted file mode 100644 index b9b8fc4e..00000000 --- a/makefu/2configs/bureautomation/multi/matrix.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ lib, ... }: -#matrix: -# password: supersecurepassword -# rooms: -# - "#hasstest:matrix.org" -# commands: -# - word: my_command -# name: my_command -let - mom_room = "!kTQjvTQvfVsvfEtmth:thales.citadel.team"; -in -{ - services.home-assistant.config = - { - matrix = - { - # secrets: - # homeserver, username, password - homeserver = "https://ext01.citadel.team"; - rooms = [ - mom_room - ]; - commands = [ - { - # alternative: expression for regexp - word = "version"; - name = "version"; - } - { - word = "luftqualität"; - name = "luftqualitaet"; - } - ]; - } // (builtins.fromJSON (builtins.readFile - )); - automation = [ - { - alias = "React to !version"; - trigger = { - platform = "event"; - event_type = "matrix_command"; - event_data.command = "version"; - }; - action = { - service = "notify.matrix_notify"; - data_template.message = "Running home-assistant {{states.sensor.current_version.state}}"; - }; - } - { - alias = "React to !luftqualität"; - trigger = { - platform = "event"; - event_type = "matrix_command"; - event_data.command = "luftqualitaet"; - }; - action = { - service = "notify.matrix_notify"; - data_template.message = ''Temp: {{states.sensor.notizen_temperature.state_with_unit | replace (" ","")}}, Hum:{{states.sensor.notizen_humidity.state_with_unit | replace (" ","")}}, airquality:{{states.sensor.air_quality.state_with_unit}}''; - }; - } - - ]; - notify = [{ - name = "matrix_notify"; - platform = "matrix"; - default_room = mom_room; - }]; - }; -} diff --git a/makefu/2configs/bureautomation/multi/mittagessen.nix b/makefu/2configs/bureautomation/multi/mittagessen.nix deleted file mode 100644 index 52ec99a9..00000000 --- a/makefu/2configs/bureautomation/multi/mittagessen.nix +++ /dev/null @@ -1,92 +0,0 @@ -{ lib, ... }: -let - # TODO: remove redundant code (from multi_blink) via lib - flash_entity = { entity, delay ? 500, count ? 4, alias ? "${entity}_blink_${toString count}_${toString delay}" }: - { - inherit alias; - sequence = lib.flatten (builtins.genList (i: [ - { service = "homeassistant.turn_on"; - data.entity_id = entity; - } - { delay.milliseconds = delay; } - { service = "homeassistant.turn_off"; - data.entity_id = entity; - } - { delay.milliseconds = delay; } - ] - ) count); - }; - # TODO: use influxdb and check if pommes - random_mittagessen = '' {{ [ - "Es ist 12 uhr 30. Der Aramark Gourmettempel hat, wie jeden Tag, wieder die feinsten Köstlichkeiten für euch Vorbereitet", - "Heute bei Aramark: Rezepte aus Ländern, von denen Ihr noch nie gehört habt, Deutsch zubereitet", - "Heute bei Aramark im Angebot: Scheiss mit Reis oder Reste von Freitag", - "MHHHH es ist wieder mal so weit, lecker Bayerisch Kraut mit asiatischen Nudeln", - "Es ist 12 Uhr 30 und Heute gibt es nur Pommes, wenn der Pommesfrosch Blasen gespuckt hat.", - "Heute gibt es Pommes leider nicht einzeln zu verkaufen, da die Schälchen alle sind", - "Heute gibt es Pommes, verarscht! Natürlich gibt es nur salzlosen Reis, oder salzlose Nudeln.", - "Heute auf dem Speiseplan: Sushi vom Vortag", - "Aramark Kantinenessen: Der Hunger treibt es rein, der Geiz hält es drin.", - "Das Essen in der Snackeria sieht heute wie die bessere Alternative aus", - "Heute ist wohl wieder ein Beilagen-Tag", - "Lunch time! Good luck, you will need it!", - "Heute vielleicht lieber doch nur einen Salat?", - "Im Büro ist es eh gerade viel zu warm, also ab zur Kantine", - "Im Büro ist es eh gerade viel zu kalt, also ab zur Kantine", - "Heute scheint die Auswahl wieder sehr schwierig zu sein. Vielleicht doch lieber ein Brötchen mit Fleischkäse vom Bäcker beim Baumarkt?", - "Wer hat hier schon wieder ein Meeting auf 12 Uhr gelegt? Skandal!", - "Jetzt nur noch kurz die Mail fertig schreiben und schon kann es los gehen.", - "Es ist 13 Uhr und die Mittagspause ist bald vorbei .... Kleiner Scherz, es ist erst 12:30, aber Ihr hättet auch nicht wirklich etwas verpasst.", - "Hallo, es ist nun 12 Uhr 30! Dies entspricht der Essenszeit aller Büroinsassen. Bitte begebt euch zur Aramark Essensausgabe um euren menschlichen Bedürfnissen nachzukommen."] | random }}''; -in -{ - services.home-assistant.config = { - automation = [ - { alias = "Mittagessen"; - trigger = { - platform = "time"; - at = "12:30:00"; - }; - action = [ - { service = "homeassistant.turn_on"; - entity_id = [ - "script.mittagessen_announce" - "script.blitz_10s" - "script.mittagessenlicht" - ]; - } - ]; - } - ]; - script = { - mittagessenlicht = (flash_entity { - entity = "switch.bauarbeiterlampe"; - alias = "Bauarbeiterlampe Mittagessenlicht"; - delay = 1000; - count = 5; - }); - mittagessen_announce = { - alias = "Random Mittagessen announce"; - sequence = [ - { - service = "media_player.play_media"; - data = { - entity_id = "media_player.mpd"; - media_content_type = "playlist"; - media_content_id = "ansage"; - }; - } - { delay.seconds = 5; } - { - service = "tts.google_say"; - entity_id = "media_player.mpd"; - data_template = { - message = random_mittagessen; - language = "de"; - }; - } - ]; - }; - }; - }; -} diff --git a/makefu/2configs/bureautomation/office-radio/default.nix b/makefu/2configs/bureautomation/office-radio/default.nix deleted file mode 100644 index d1c0f473..00000000 --- a/makefu/2configs/bureautomation/office-radio/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - imports = [ - ./mpd.nix - ./webserver.nix - ]; -} diff --git a/makefu/2configs/bureautomation/office-radio/mpd.nix b/makefu/2configs/bureautomation/office-radio/mpd.nix deleted file mode 100644 index 4fc31fff..00000000 --- a/makefu/2configs/bureautomation/office-radio/mpd.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ config, lib, pkgs, ... }: - -let - mpds = import ./mpdconfig.nix; - systemd_mpd = name: value: let - path = "/var/lib/mpd-${name}"; - num = lib.strings.fixedWidthNumber 2 value; - mpdconf = pkgs.writeText "mpd-config-${name}" '' - music_directory "${path}/music" - playlist_directory "${path}/playlists" - db_file "${path}/tag_cache" - state_file "${path}/state" - sticker_file "${path}/sticker.sql" - - bind_to_address "127.0.0.1" - port "66${num}" - log_level "default" - auto_update "yes" - audio_output { - type "httpd" - name "Office Radio ${num} - ${name}" - encoder "vorbis" # optional - port "280${num}" - quality "5.0" # do not define if bitrate is defined - # bitrate "128" # do not define if quality is defined - format "44100:16:2" - always_on "yes" # prevent MPD from disconnecting all listeners when playback is stopped. - tags "yes" # httpd supports sending tags to listening streams. - } - ''; -in { - after = [ "network.target" ]; - description = "Office Radio MPD ${toString value} - ${name}"; - wantedBy