diff options
52 files changed, 1365 insertions, 1292 deletions
diff --git a/makefu/1systems/omo/config.nix b/makefu/1systems/omo/config.nix index cbe97e28a..a9e307ddf 100644 --- a/makefu/1systems/omo/config.nix +++ b/makefu/1systems/omo/config.nix @@ -92,7 +92,6 @@ in { <stockholm/makefu/2configs/bluetooth-mpd.nix> <stockholm/makefu/2configs/ham> - <stockholm/makefu/2configs/ham/zigbee2mqtt> { makefu.ps3netsrv = { enable = true; diff --git a/makefu/2configs/bgt/download.binaergewitter.de.nix b/makefu/2configs/bgt/download.binaergewitter.de.nix index 77c9ddc81..4abc7d345 100644 --- a/makefu/2configs/bgt/download.binaergewitter.de.nix +++ b/makefu/2configs/bgt/download.binaergewitter.de.nix @@ -17,12 +17,14 @@ in { PasswordAuthentication no ''; }; + users.users.auphonic = { uid = genid "auphonic"; group = "nginx"; useDefaultShell = true; openssh.authorizedKeys.keys = [ ident config.krebs.users.makefu.pubkey ]; }; + services.logrotate = { enable = true; config = '' @@ -36,6 +38,12 @@ in { } ''; }; + + # 20.09 unharden nginx to write logs + systemd.services.nginx.serviceConfig.ReadWritePaths = [ + "/var/spool/nginx/logs/" + ]; + services.nginx = { appendHttpConfig = '' types { @@ -55,15 +63,4 @@ in { ''; }; }; - environment.etc."netdata/python.d/web_log.conf".text = '' - nginx_log3: - name: 'nginx' - path: '/var/spool/nginx/logs/access.log' - nginx_log4: - name: 'bgt' - path: '${bgtaccess}' - ''; - - users.users.netdata.extraGroups = [ "nginx" ]; - } diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix index b9aa710c3..f4c10adc8 100644 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix @@ -1,84 +1,87 @@ -[ - { 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 +{ + services.home-assistant.config.automation = + [ + { alias = "Turn on Fernseher on group home"; + trigger = { 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 = [ + from = "not_home"; + to = "home"; + for.seconds = 30; + }; + action = [ + { + service = "homeassistant.turn_on"; + entity_id = [ + "switch.fernseher" + "switch.feuer" + ]; + } { - 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" ]; + service = "media_player.kodi_call_method"; + data = { + entity_id = "media_player.kodi"; + method = "Player.Open"; + item.partymode = "music"; + }; } - { # if anybody is still there - condition = "state"; + { + 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"; - state = "not_home"; + 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/hass-restart.nix b/makefu/2configs/bureautomation/automation/hass-restart.nix index be16f6966..3b3ce0599 100644 --- a/makefu/2configs/bureautomation/automation/hass-restart.nix +++ b/makefu/2configs/bureautomation/automation/hass-restart.nix @@ -1,31 +1,34 @@ -[ - { 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"; - # }; - #} - ]; - } -] +{ + 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 index ec6fa20c7..ade89418d 100644 --- a/makefu/2configs/bureautomation/automation/nachtlicht.nix +++ b/makefu/2configs/bureautomation/automation/nachtlicht.nix @@ -1,35 +1,38 @@ -[ - # 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; +{ + 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" ]; - }; - } -] + }; + 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/schlechteluft.nix b/makefu/2configs/bureautomation/automation/schlechteluft.nix index 370334743..ea1d44515 100644 --- a/makefu/2configs/bureautomation/automation/schlechteluft.nix +++ b/makefu/2configs/bureautomation/automation/schlechteluft.nix @@ -1,71 +1,75 @@ let long_threshold = 30; -in [ - { - 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"; +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" + ]; } ]; - }; - - 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"; + } ]; - } - ]; - } - { - 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"; + }; + + action = [ + { service = "homeassistant.turn_on"; + entity_id = [ + "script.schlechteluft" + ]; } - { condition = "time"; - after = "06:00:00"; - before = "20:00:00"; + { 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"; + }; } ]; - }; - - 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 index e23c4a362..20590a6b3 100644 --- a/makefu/2configs/bureautomation/binary_sensor/buttons.nix +++ b/makefu/2configs/bureautomation/binary_sensor/buttons.nix @@ -12,6 +12,9 @@ let # expire_after = "5"; #expire after 5 seconds qos = 1; }; -in [ - (tasmota_button "RedButton" "redbutton") -] +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 index ad8fab038..0c5a808e0 100644 --- a/makefu/2configs/bureautomation/binary_sensor/motion.nix +++ b/makefu/2configs/bureautomation/binary_sensor/motion.nix @@ -1,12 +1,15 @@ -[ - { 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"; - } -] +{ + 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/camera/comic.nix b/makefu/2configs/bureautomation/camera/comic.nix index a523d032e..ae24760e3 100644 --- a/makefu/2configs/bureautomation/camera/comic.nix +++ b/makefu/2configs/bureautomation/camera/comic.nix @@ -1,10 +1,13 @@ -[ - { 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 ; - } -] +{ + 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 index 78cbeb3e2..0badcb285 100644 --- a/makefu/2configs/bureautomation/camera/stuttgart.nix +++ b/makefu/2configs/bureautomation/camera/stuttgart.nix @@ -5,22 +5,26 @@ let inherit name still_image_url; platform = "generic"; }; -i |