diff options
author | makefu <github@syntax-fehler.de> | 2023-07-28 22:24:15 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2023-07-28 22:24:15 +0200 |
commit | 060a8f28fa1fc648bdf66afb31a5d1efac868837 (patch) | |
tree | 2b354eacc7897365ee45244fe7a51720e0d0333f /makefu/2configs/home | |
parent | cbfcc890e3b76d942b927809bf981a5fa7289e6a (diff) |
makefu: move out to own repo, add vacation-note
Diffstat (limited to 'makefu/2configs/home')
70 files changed, 0 insertions, 4258 deletions
diff --git a/makefu/2configs/home/3dprint.nix b/makefu/2configs/home/3dprint.nix deleted file mode 100644 index aac962787..000000000 --- a/makefu/2configs/home/3dprint.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ pkgs, ... }: -let - #dev = "/dev/web_cam"; - dev = "/dev/video0"; -in -{ - services.mjpg-streamer = { - enable = true; - inputPlugin = "input_uvc.so -d ${dev} -r 1280x960"; - }; - users.users.octoprint.extraGroups = [ "video" ]; - # allow octoprint to access /dev/vchiq - # also ensure that the webcam always comes up under the same name - services.udev.extraRules = '' - SUBSYSTEM=="vchiq",GROUP="video",MODE="0660" - KERNEL=="video*",ATTRS{vendor}=="0x046d", ATTRS{device}=="0x0825", GROUP="video", SYMLINK+="web_cam" - ''; - systemd.services.octoprint = { - path = [ pkgs.libraspberrypi ]; - }; - services.octoprint = { - enable = true; - plugins = plugins: with plugins;[ - costestimation - displayprogress - mqtt - stlviewer - themeify - # octolapse - (buildPlugin rec { - pname = "OctoPrint-HomeAssistant"; - version = "3.6.2"; - src = pkgs.fetchFromGitHub { - owner = "cmroche"; - repo = pname; - rev = version; - hash = "sha256-oo9OBmHoJFNGK7u9cVouMuBuUcUxRUrY0ppRq0OS1ro="; - }; - }) - ]; - extraConfig.plugins.mqtt.broker = { - url = "omo.lan"; - # TODO TODO TODO - username = "hass"; - password = "lksue43jrf"; - # TODO TODO TODO - }; - }; -} diff --git a/makefu/2configs/home/ham/automation/buttonboard.nix b/makefu/2configs/home/ham/automation/buttonboard.nix deleted file mode 100644 index 533311fc5..000000000 --- a/makefu/2configs/home/ham/automation/buttonboard.nix +++ /dev/null @@ -1,4 +0,0 @@ -# good, bad radio -# stop -# start radio -# lauter, leister diff --git a/makefu/2configs/home/ham/automation/bye.txt.j2 b/makefu/2configs/home/ham/automation/bye.txt.j2 deleted file mode 100644 index 8a5ba7257..000000000 --- a/makefu/2configs/home/ham/automation/bye.txt.j2 +++ /dev/null @@ -1,2 +0,0 @@ -Endlich ist Pappa fertig mit arbeit! -Heute hast du {{ states("sensor.felix_at_work_today") |round(1) }} Stunden gearbeitet. diff --git a/makefu/2configs/home/ham/automation/check-in.nix b/makefu/2configs/home/ham/automation/check-in.nix deleted file mode 100644 index db051757e..000000000 --- a/makefu/2configs/home/ham/automation/check-in.nix +++ /dev/null @@ -1,133 +0,0 @@ -let - button = "binary_sensor.arbeitszimmer_onebutton_button"; - light = "light.arbeitszimmer_onebutton_led"; - at_work = "input_boolean.felix_at_work"; - lib = import ../lib; - say = lib.say.office; -in -{ - services.home-assistant.config.input_boolean.felix_at_work.name = "Felix auf Arbeit"; - services.home-assistant.config.timer.felix_at_work = { - name = "Felix auf Arbeit Timer"; - duration = "10:00:00"; - }; - services.home-assistant.config.sensor = [ - { - platform = "history_stats"; - name = "Felix at work today"; - entity_id = "input_boolean.felix_at_work"; - state = "on"; - type = "time"; - start = "{{ now().replace(hour=0, minute=0, second=0) }}"; - end = "{{ now() }}"; - } - ]; - services.home-assistant.config.script.start_office_radio.sequence = - [ - { service = "media_player.play_media"; - data = { - media_content_id = "http://radio.lassul.us:8000/radio.mp3"; - media_content_type = "music"; - }; - target.entity_id = "media_player.office"; - } - ]; - services.home-assistant.config.automation = - [ - { alias = "Zu lange Felix!"; - trigger = - { platform = "event"; - event_type = "timer.finished"; - event_data.entity_id = "timer.felix_at_work"; - }; - - condition = - { - condition = "state"; - entity_id = at_work; - state = "off"; - }; - - action = (say "Felix, die zehn Stunden sind um, aufhören jetzt"); - } - { alias = "Turn off at work sensor"; - trigger = [ - { platform = "time"; at = "00:00:00"; } - ]; - condition = - { - condition = "state"; - entity_id = at_work; - state = "off"; - }; - action = - [ - # felix forgot to stamp out ... - { - service = "homeassistant.turn_off"; - entity_id = [ at_work ]; - } - ]; - } - { alias = "Push Check-in Button Felix with button"; - trigger = [ - { - platform = "state"; - entity_id = button; - to = "on"; - for.seconds = 1; - } - ]; - condition = [ - ]; - action = - [ - { choose = [ - { - conditions = { - condition = "state"; - entity_id = at_work; - state = "off"; - }; - sequence = [ - { service = "light.turn_on"; - target.entity_id = light; - data.brightness = 200; - } - { service = "homeassistant.turn_on"; - entity_id = at_work; - } - { service = "timer.start"; - entity_id = [ "timer.felix_at_work" ] ; - } - ] ++ (say (builtins.readFile ./welcome.txt.j2)) ++ - [ - { service = "script.start_office_radio"; } - ]; - } - { - conditions = { - condition = "state"; - entity_id = at_work; - state = "on"; - }; - sequence = [ - { service = "light.turn_off"; - target.entity_id = light; - } - { service = "homeassistant.turn_off"; - entity_id = at_work; - } - ] ++ (say (builtins.readFile ./bye.txt.j2)) ++ - [ - { service = "timer.stop"; - entity_id = [ "timer.felix_at_work" ] ; - } - ]; - } - ]; - } - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/automation/daily_speedtext.nix b/makefu/2configs/home/ham/automation/daily_speedtext.nix deleted file mode 100644 index 70d59f6e1..000000000 --- a/makefu/2configs/home/ham/automation/daily_speedtext.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - services.home-assistant.config.automation = - [ - { - trigger = [ - { platform = "time"; at = "03:21"; } - ]; - action = - [ - { - service = "speedtestdotnet.speedtest"; - } - ]; - } - ]; - -} diff --git a/makefu/2configs/home/ham/automation/fenster_auf.nix b/makefu/2configs/home/ham/automation/fenster_auf.nix deleted file mode 100644 index 698327ff4..000000000 --- a/makefu/2configs/home/ham/automation/fenster_auf.nix +++ /dev/null @@ -1,138 +0,0 @@ -{ lib, ... }: -#uses: -# notify.signal -# binary_sensor.badezimmer_fenster_contact -# binary_sensor.dusche_fenster_contact -let - hlib = import ../lib; - say = hlib.say.office; - draussen = "sensor.wohnzimmer_temp_temperature"; - draussen_diff = "sensor.unterschied_draussen_drinnen"; - draussen_heiss = 23; - min = 20; - fenster_offen = name: entity: - { alias = "${name} seit ${toString min} Minuten offen"; - trigger = [ - { - platform = "state"; - entity_id = entity; - to = "on"; - for.minutes = min; - } - ]; - condition = [ - ]; - action = - [ - { - service = "notify.signal_home"; - data_template = { - message = "${name} seit ${toString min} Minuten offen und draussen ist es gerade {{states.sensor.dark_sky_temperature.state}}°C bei {{states.sensor.dark_sky_humidity.state}}% Luftfeuchte"; - }; - } - { - service = "input_boolean.turn_on"; - target.entity_id = "input_boolean.${lib.toLower name}_lang_offen"; - } - ]; - }; - fenster_geschlossen_lang = name: entity: - { alias = "${name} wieder geschlossen"; - trigger = [ - { - platform = "state"; - entity_id = entity; - to = "off"; - for.seconds = 10; - } - ]; - condition = [ - { condition = "state"; - entity_id = "input_boolean.${lib.toLower name}_lang_offen"; - state = "on"; - } - ]; - action = - [ - { - service = "notify.signal_home"; - data = { - message= "${name} ist wieder geschlossen, Danke!"; - }; - } - { - service = "input_boolean.turn_off"; - target.entity_id = "input_boolean.${lib.toLower name}_lang_offen"; - } - ]; - }; -in { - services.home-assistant.config = { - template = [ - { sensor = { - name = "Unterschied Draussen Drinnen"; - unit_of_measurement = "°C"; - state = '' - {% set inside = states("${draussen}") | float | round(2) -%} - {% set outside = states("sensor.dark_sky_temperature") | float | round(2) -%} - {{ ((outside - inside) | round(1) )}}''; - }; - } - ]; - sensor = [ - { platform = "season"; type = "meteorological";} - ]; - - input_boolean = { - badezimmerfenster_lang_offen.name = "Badezimmer lange offen"; - duschfenster_lang_offen.name = "Duschfenster lange offen"; - ist_sommer = { - name = "Es ist Sommer"; - initial = false; # TODO - }; - }; - - automation = [ - (fenster_geschlossen_lang "Badezimmerfenster" "binary_sensor.badezimmer_fenster_contact") - (fenster_geschlossen_lang "Duschfenster" "binary_sensor.dusche_fenster_contact") - - (fenster_offen "Badezimmerfenster" "binary_sensor.badezimmer_fenster_contact") - (fenster_offen "Duschfenster" "binary_sensor.dusche_fenster_contact") - - { alias = "Draussen ist wieder kaelter"; - trigger = [ - { - platform = "numeric_state"; - entity_id = draussen_diff; - below = 0; - for.minutes = 20; - } - ]; - condition = [ - { condition = "numeric_state"; - entity_id = draussen; - above = draussen_heiss; - } - ]; - action = (say "Draussen ist es endlich kühler, jetzt kann man die Fenster auf machen"); - } - { alias = "Draussen ist zu warm"; - trigger = [ - { - platform = "numeric_state"; - entity_id = draussen_diff; - above = 0; - for.minutes = 20; - } - ]; - condition = [ - { condition = "numeric_state"; - entity_id = draussen; - above = draussen_heiss; - } - ]; - action = (say "Draussen wird es jetzt zu warm, besser das fenster schliessen"); - } - ]; - }; -} diff --git a/makefu/2configs/home/ham/automation/find_phone.nix b/makefu/2configs/home/ham/automation/find_phone.nix deleted file mode 100644 index d94942c9f..000000000 --- a/makefu/2configs/home/ham/automation/find_phone.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - services.home-assistant.config.script = { - find_felix_phone.sequence = [ - { - service = "notify.mobile_app_pixel_3a"; - data = { - title= "Finde Mich!"; - message= "Such Such Such"; - data = { - ttl = 0; - priority = "high"; - channel = "alarm_stream"; - }; - }; - } - ]; - find_tablet.sequence = [ - { - service = "notify.mobile_app_nova3"; - data = { - title = "Finde Mich!"; - message = "Such Such Such"; - data = { - ttl = 0; - priority = "high"; - channel = "alarm_stream"; - }; - }; - } - ]; - }; -} diff --git a/makefu/2configs/home/ham/automation/firetv_restart.nix b/makefu/2configs/home/ham/automation/firetv_restart.nix deleted file mode 100644 index 01d1ba6e9..000000000 --- a/makefu/2configs/home/ham/automation/firetv_restart.nix +++ /dev/null @@ -1,37 +0,0 @@ -let - cmd = command: { - service = "androidtv.adb_command"; - data = { - entity_id = "media_player.firetv_stick"; - inherit command; - }; - }; - sec = seconds: { delay.seconds = seconds; }; -in -{ - services.home-assistant.config.automation = - [ - { - alias = "Nightly reboot of firetv"; - trigger = { - platform = "time"; - at = "03:00:00"; - }; - action = [ - (cmd "reboot") - (sec 90) # go to my music because apparently select_source does not seem to always work - #(cmd "HOME") - #(sec 2) - #(cmd "DOWN") - #(sec 2) - #(cmd "DOWN") - #(sec 2) - #(cmd "ENTER") - #(sec 4) - #(cmd "RIGHT") - #(sec 2) - #(cmd "RIGHT") - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/automation/flurlicht.nix b/makefu/2configs/home/ham/automation/flurlicht.nix deleted file mode 100644 index bb4877100..000000000 --- a/makefu/2configs/home/ham/automation/flurlicht.nix +++ /dev/null @@ -1,63 +0,0 @@ -let - nachtlicht = [ "light.flur_statuslight" "light.wohnzimmer_status_led" ]; - - # flurlicht an - lightcond = name: conditions: rgb_color: brightness: - { - inherit conditions; - sequence = { - service = "light.turn_on"; - target.entity_id = nachtlicht; - data = { - inherit rgb_color brightness; - }; - }; - }; -in -{ - services.home-assistant.config.automation = - [ - { alias = "Nachtlicht trigger"; - trigger = [ - { platform = "sun"; event = "sunset"; } - { platform = "sun"; event = "sunrise"; } - { platform = "state"; entity_id = [ - "calendar.kehrwoche_kehrwoche" - "binary_sensor.badezimmer_fenster_contact" - "binary_sensor.dusche_fenster_contact" - ]; - } - ]; - action = - [ - { choose = [ - (lightcond "Badezimmer Fenster Auf" - [ { condition = "state"; entity_id = "binary_sensor.badezimmer_fenster_contact"; state = "on"; } - { condition = "state"; entity_id = "input_boolean.ist_sommer"; state = "off"; } - - ] - [ 64 207 255 ] 128 # hellblau - ) - (lightcond "Duschenster auf" - [ { condition = "state"; entity_id = "binary_sensor.dusche_fenster_contact"; state = "on"; } - { condition = "state"; entity_id = "input_boolean.ist_sommer"; state = "off"; } ] - [ 64 207 255 ] 128 # hellblau - ) - (lightcond "Nachtlicht" - { condition = "state"; entity_id = "sun.sun"; state = "below_horizon"; } - [ 255 190 0 ] 90 # red - ) - (lightcond "Kehrwoche" - { condition = "state"; entity_id = "calendar.kehrwoche_kehrwoche"; state = "on"; } - [ 204 0 255 ] 128 # pink - ) - ]; - default = { - service = "light.turn_off"; - entity_id = nachtlicht; - }; - } - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/automation/giesskanne.nix b/makefu/2configs/home/ham/automation/giesskanne.nix deleted file mode 100644 index 400e553e8..000000000 --- a/makefu/2configs/home/ham/automation/giesskanne.nix +++ /dev/null @@ -1,99 +0,0 @@ -# uses: -# switch.crafting_giesskanne_relay -let - cam = { - name = "chilicam"; - camera = "camera.espcam_02"; - light = "light.espcam_02_light"; - seconds = 90; # default shutoff to protect the LED from burning out - }; - seconds = 60*5; # time for giesskanne - 5 minutes - pump = "switch.arbeitszimmer_giesskanne_relay"; - light = "switch.terrasse_plug_relay"; - - # sensor = "sensor.statistics_for_sensor_crafting_brotbox_soil_moisture"; -in -{ - services.home-assistant.config = - { - #sensor = map ( entity_id: { - # platform = "statistics"; - # name = "Statistics for ${entity_id}"; - # inherit entity_id; - # max_age.minutes = "60"; - # sampling_size = 1000; - # }) [ "sensor.crafting_brotbox_soil_moisture" ]; - - automation = - [ - - ##### brotbox - { alias = "Water the plant for ${toString seconds} seconds and turn on the light"; - trigger = [ - { # trigger at 23:15 no matter what - # TODO: retry or run only if switch.wasser is available - platform = "sun"; - event = "sunrise"; - } - ]; - action = - [ - - { # now turn on the pumping services - # i do not start hte pump and light before the snapshot because i do - # not know how long it takes (do not want to water the plants for too long) - service = "homeassistant.turn_on"; - entity_id = [ pump light ]; - } - { delay.seconds = seconds; } - { - service = "homeassistant.turn_off"; - entity_id = [ pump cam.light ]; - } - { # TODO: we could also create a recording with camera.record - service = "camera.snapshot"; - data = { - entity_id = cam.camera; - # TODO: create /var/lib/hass/cam/ - now being done manually - filename = "/var/lib/hass/cam/${cam.name}_{{ now().strftime('%Y%m%d-%H%M%S') }}.jpg"; - }; - } - ]; - } - { alias = "Turn off the light at sunset"; - trigger = [ - { - platform = "sun"; - event = "sunset"; - # offset = "+02:00:00"; - } - ]; - action = - [ - { - service = "homeassistant.turn_off"; - entity_id = [ light ]; - } - ]; - } - - { alias = "Always turn off water after ${toString (seconds * 2)}s"; - trigger = [ - { - platform = "state"; - entity_id = pump; - to = "on"; - for.seconds = seconds*2; - } - ]; - action = - [ - { - service = "homeassistant.turn_off"; - entity_id = [ pump ]; - } - ]; - } - ]; - }; -} diff --git a/makefu/2configs/home/ham/automation/ladestecker_timer.nix b/makefu/2configs/home/ham/automation/ladestecker_timer.nix deleted file mode 100644 index 8e877129c..000000000 --- a/makefu/2configs/home/ham/automation/ladestecker_timer.nix +++ /dev/null @@ -1,24 +0,0 @@ -let - relay = "switch.terrasse_plug_relay"; - timeout = "300"; -in { - services.home-assistant.config.automation = [ - { alias = "Always turn off Charging station after ${toString (timeout)}m"; - trigger = [ - { - platform = "state"; - entity_id = relay; - to = "on"; - for.minutes = timeout; - } - ]; - action = - [ - { - service = "homeassistant.turn_off"; - entity_id = [ relay ]; - } - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/automation/lichter_dimmen.nix b/makefu/2configs/home/ham/automation/lichter_dimmen.nix deleted file mode 100644 index 4303cdfa5..000000000 --- a/makefu/2configs/home/ham/automation/lichter_dimmen.nix +++ /dev/null @@ -1,135 +0,0 @@ -# This module maps the RF433 Remote Control to zigbee and wifi lights -let - rf_turn_off = code: light: - { - alias = "Turn off ${light} via rf code ${code}"; - trigger = { - platform = "event"; - event_type = "esphome.rf_code_received"; - event_data.code = code; - }; - action = { - service = "light.turn_off"; - data.entity_id = light; - }; - }; - rf_turn_on = code: light: - { - alias = "Turn on ${light} via rf code ${code}"; - trigger = { - platform = "event"; - event_type = "esphome.rf_code_received"; - event_data.code = code; - }; - action = { - service = "light.turn_on"; - data.entity_id = light; - }; - }; - rf_state = code: light: halfbright: - let - maxbright = 255; - transition = 0.2; # seconds - in - # this function implements a simple state machine based on the state and brightness of the light (light must support brightness - { - alias = "Cycle through states of ${light} via rf code ${code}"; - trigger = { - platform = "event"; - event_type = "esphome.rf_code_received"; - event_data.code = code; - }; - action = { - choose = [ - { - # state 0: off to half - conditions = { - condition = "template"; - value_template = ''{{ states("${light}") == "off" }}''; - }; - sequence = [ - { - service = "light.turn_on"; - data = { - entity_id = light; - brightness = halfbright; - }; - } - ]; - } - { - # state 1: half to full - conditions = { - condition = "template"; - value_template = ''{{ states('${light}') == 'on' and ( ${toString (halfbright - 1)} <= state_attr("${light}","brightness") <= ${toString (halfbright + 1)})}}''; - }; - sequence = [ - { - service = "light.turn_on"; - data = { - entity_id = light; - brightness = maxbright; - }; - } - ]; - } - { - # state 2: full to off - conditions = { - condition = "template"; - # TODO: it seems like the devices respond with brightness-1 , maybe off-by-one somewhere? - value_template = ''{{ states("${light}") == "on" and state_attr("${light}","brightness") >= ${toString (maxbright - 1)}}}''; - }; - sequence = [ - { - service = "light.turn_off"; - data = { - entity_id = light; - }; - } - ]; - } - ]; - # default: on to off - # this works because state 0 checks for "state == off" - default = [{ - service = "light.turn_off"; - data = { - entity_id = light; - }; - }]; - }; - } -; - rf_toggle = code: light: - { - alias = "Toggle ${light} via rf code ${code}"; - trigger = { - platform = "event"; - event_type = "esphome.rf_code_received"; - event_data.code = code; - }; - action = { - service = "light.toggle"; - data.entity_id = light; - }; - }; -in -{ - services.home-assistant.config.automation = [ - (rf_toggle "400551" "light.wohnzimmer_fernseher_led_strip") # A - (rf_state "401151" "light.wohnzimmer_stehlampe_osram" 128) # B - (rf_state "401451" "light.wohnzimmer_komode_osram" 128) # C - (rf_state "401511" "light.wohnzimmer_schrank_osram" 128) # D - - # OFF Lane - (rf_turn_off "400554" "all") # A - (rf_toggle "401154" "light.wohnzimmer_fenster_lichterkette_licht") # B - (rf_toggle "401454" "light.wohnzimmer_fernsehwand_led") # C - # (rf_toggle "401514" "") # D - ]; - # "400554" # A OFF - # "401154" # B OFF - # "401454" # C OFF - # "401514" # D OFF -} diff --git a/makefu/2configs/home/ham/automation/light_buttons.nix b/makefu/2configs/home/ham/automation/light_buttons.nix deleted file mode 100644 index 460d48bc4..000000000 --- a/makefu/2configs/home/ham/automation/light_buttons.nix +++ /dev/null @@ -1,69 +0,0 @@ - -let - inherit (import ../lib) btn_cycle_light; - schlafzimmer_komode = "light.schlafzimmer_komode_osram"; - schlafzimmer_button = "sensor.schlafzimmer_btn2_click"; -in { - services.home-assistant.config.automation = [ - # (btn_cycle_light "light.arbeitszimmerbeleuchtung" "arbeitszimmer_btn1") - - { - alias = "toggle keller"; - trigger = { - platform = "state"; - entity_id = "sensor.keller_btn1_click"; - to = "single"; - }; - action = { - service = "light.toggle"; - #entity_id = lights; - data = { - entity_id = "light.keller_osram"; - brightness = 255; - }; - }; - } - { - alias = "low brightness keller with doubleclick"; - trigger = { - platform = "state"; - entity_id = "sensor.keller_btn1_click"; - to = "double"; - }; - action = { - service = "light.toggle"; - data = { - entity_id = "light.keller_osram"; - brightness = 25; - }; - }; - } - # (btn_cycle_light "light.wohnzimmerbeleuchtung" "wohnzimmer_btn3") - { - alias = "Dim Toggle schlafzimmer komode"; - trigger = { - platform = "state"; - entity_id = schlafzimmer_button; - to = "single"; - }; - action = { - service = "light.toggle"; - entity_id = schlafzimmer_komode; - brightness = 1; - }; - } - { - alias = "Bright Toggle schlafzimmer komode"; - trigger = { - platform = "state"; - entity_id = schlafzimmer_button; - to = "double"; - }; - action = { - service = "light.toggle"; - entity_id = schlafzimmer_komode; - brightness = 255; - }; - } - ]; -} diff --git a/makefu/2configs/home/ham/automation/moodlight.nix b/makefu/2configs/home/ham/automation/moodlight.nix deleted file mode 100644 index d0e336851..000000000 --- a/makefu/2configs/home/ham/automation/moodlight.nix +++ /dev/null @@ -1,46 +0,0 @@ -# uses: - -let - wohnzimmer = "light.wohnzimmer_fenster_lichterkette_licht"; - arbeitszimmer = "light.box_led_status"; - final_off = "01:00"; - - turn_on = entity_id: at: extra: - { alias = "Turn on ${entity_id} at ${at}"; - trigger = [ - { platform = "time"; inherit at; } - ]; - action = - [ - ({ service = "light.turn_on"; - data = { - inherit entity_id; - - } // extra; - }) - ]; - }; -in -{ - services.home-assistant.config = - { - automation = - [ - # (turn_on wohnzimmer "17:30") - (turn_on arbeitszimmer "9:00" { effect = "Slow Random Twinkle";}) - - { alias = "Always turn off the lights at ${final_off}"; - trigger = [ - { platform = "time"; at = final_off; } - ]; - action = - [ - { - service = "light.turn_off"; - entity_id = [ wohnzimmer arbeitszimmer]; - } - ]; - } - ]; - }; -} diff --git a/makefu/2configs/home/ham/automation/pflanzen_giessen_erinnerung.nix b/makefu/2configs/home/ham/automation/pflanzen_giessen_erinnerung.nix deleted file mode 100644 index 32a373edc..000000000 --- a/makefu/2configs/home/ham/automation/pflanzen_giessen_erinnerung.nix +++ /dev/null @@ -1,43 +0,0 @@ -let - notify_felix = message: { - service = "notify.signal_felix"; - data.message = message; - }; - notify_home = message: { - service = "notify.signal_home"; - data_template.message = message; - }; -in -{ - services.home-assistant.config.automation = - [ - #{ - # alias = "Pflanzen Giessen Erinnerung Daily"; - # trigger = { - # platform = "time"; - # at = "12:15:00"; - # }; - # action = [ - # (notify_felix "Es ist Mittagszeit und du kannst ruhig einmal alle Blumen im Zimmer giessen") - # ]; - #} - { - alias = "Pflanzen Giessen Erinnerung Weekly"; - trigger = { - platform = "time"; - at = "12:15:00"; - }; - condition = { - condition = "time"; - weekday = [ "sat" ]; - }; - action = [ - (notify_home - ''Es ist Wochenende und die Pflanzen würden sich über ein bisschen Wasser freuen. - Die Wettervorhersage: {{states.sensor.dark_sky_summary.state}} mit einer Regenwahrscheinlichkeit von {{states.sensor.dark_sky_precip_probability.state}}%. - Aktuell sind es {{states.sensor.dark_sky_temperature.state}}°C bei {{states.sensor.dark_sky_humidity.state}}% Luftfeuchte. - Der UV Index liegt bei {{states.sensor.dark_sky_uv_index.state}}'') - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/automation/project_tracker.nix b/makefu/2configs/home/ham/automation/project_tracker.nix deleted file mode 100644 index cb279b2fe..000000000 --- a/makefu/2configs/home/ham/automation/project_tracker.nix +++ /dev/null @@ -1,68 +0,0 @@ -{ lib, ... }: -# uses: -# -let - at_work = "input_boolean.felix_at_work"; - dice_action = "sensor.arbeitszimmer_cube_action"; - project_sensor = "sensor.felix_project"; - hlib = import ../lib; - say = hlib.say.office; - sides = [ "BDK" "LBS6" "random" "BNO" "CyberShield" "ILBS" ]; - hist_stat = state: { - platform = "history_stats"; - name = "Felix Project ${state}"; - entity_id = project_sensor; - inherit state; - type = "time"; - start = "{{ now().replace(hour=0, minute=0, second=0) }}"; - end = "{{ now() }}"; - }; - -in - { - services.home-assistant.config.sensor = map hist_stat (sides ++ ["not at work" "unknown"]); - services.home-assistant.config.automation = [ - { alias = "Felix Project Change"; - trigger = - { - platform = "state"; - entity_id = project_sensor; - # ignore login and log out - not_from = [ "not at work" ]; - not_to = [ "not at work" ]; - }; - - action = (say "Wechsel auf Projekt {{ trigger.to_state.state }}"); - } - ]; - services.home-assistant.config.template = [ - { - trigger = [ - { - platform = "state"; - entity_id = at_work; - } - { - platform = "state"; - attribute = "side"; - entity_id = dice_action; - not_from = ""; - } - ]; - sensor = [ - { name = "Felix Project"; - state = '' - {% set at_work = states('${at_work}') == 'on' %} - {% set side = state_attr('${dice_action}','side') %} - {% if not at_work %}not at work - '' + (lib.concatImapStringsSep "\n" (i: project: - "{% elif side == ${toString (i - 1)} %}${project}") sides) + - '' - {% else %}unknown - {% endif %} - ''; - } - ]; - } - ]; - } diff --git a/makefu/2configs/home/ham/automation/shutdown_button.nix b/makefu/2configs/home/ham/automation/shutdown_button.nix deleted file mode 100644 index ec84bbe94..000000000 --- a/makefu/2configs/home/ham/automation/shutdown_button.nix +++ /dev/null @@ -1,56 +0,0 @@ -let - btn = "sensor.arbeitszimmer_btn1_action"; - lib = import ../lib; - say = lib.say.living_room; - - all_lights = [ - # Wohnzimmer - "light.wled" - "light.wled_2" - "light.wohnzimmer_komode_osram" - "light.wohnzimmer_schrank_osram" - "light.wohnzimmer_fenster_lichterkette_licht" - - # Arbeitszimmer - "light.wled_3" - "light.wled_4" - "light.arbeitszimmer_schrank_dimmer" - "light.arbeitszimmer_pflanzenlicht" - "light.wohnzimmer_stehlampe_osram" - - # Keller - "light.keller_osram" - ]; - all_media_player = [ - "media_player.living_room" - "media_player.office" - "media_player.bedroom" - - ]; -in { - services.home-assistant.config.automation = - [ - { alias = "Wohnung shutdown single click"; - trigger = [ - { - platform = "state"; - entity_id = btn; - to = "single"; - } - ]; - condition = [ ]; - action = (say "Alles Aus" )++ [ - { - service = "light.turn_off"; - target.entity_id = all_lights; - } - { service = "media_player.media_stop"; - target.entity_id = all_media_player; - } - { service = "script.turn_on"; - target.entity_id = "script.alle_heizungen_aus"; - } - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/automation/urlaub.nix b/makefu/2configs/home/ham/automation/urlaub.nix deleted file mode 100644 index abfe5031d..000000000 --- a/makefu/2configs/home/ham/automation/urlaub.nix +++ /dev/null @@ -1,51 +0,0 @@ -# uses: -# light.wohnzimmer_schrank_osram -# light.wohnzimmer_fernseher_led_strip -# "all" lights - -let - schranklicht = [ - "light.wohnzimmer_schrank_osram" - # "light.wohnzimmer_komode_osram" - ]; - weihnachtslicht = "light.wohnzimmer_fenster_lichterkette_licht"; - fernsehlicht = "light.wled"; - - final_off = "00:37"; - - turn_on = entity_id: offset: - # negative offset => before sunset - { alias = "Turn on ${toString entity_id} at sunset ${offset}"; - trigger = [ - { platform = "sun"; event = "sunset"; inherit offset; } - ]; - action = - [ - { service = "light.turn_on"; inherit entity_id; } - ]; - }; -in -{ - services.home-assistant.config = - { - automation = - [ - (turn_on schranklicht "-00:30:00") - (turn_on weihnachtslicht "-00:00:00") - #(turn_on fernsehlicht "-00:00:00") - - { alias = "Always turn off the urlaub lights at ${final_off}"; - trigger = [ - { platform = "time"; at = final_off; } - ]; - action = - [ - { - service = "light.turn_off"; - entity_id = [ schranklicht weihnachtslicht fernsehlicht ]; - } - ]; - } - ]; - }; -} diff --git a/makefu/2configs/home/ham/automation/welcome.txt.j2 b/makefu/2configs/home/ham/automation/welcome.txt.j2 deleted file mode 100644 index d2a2b573b..000000000 --- a/makefu/2configs/home/ham/automation/welcome.txt.j2 +++ /dev/null @@ -1,45 +0,0 @@ -{% set arbeit_heute = is_state("binary_sensor.arbeitstag","on") -%} -{% set weekday = ['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag'][now().weekday()] -%} -{% set is_friday = now().weekday() == 4 %} - -{% if not arbeit_heute %} -Heute ist {{ weekday }}, du solltest gar nicht arbeiten! -{% else %} -Willkommen auf Arbeit Felix. -{% endif -%} -Dein Projekt ist {{ states("sensor.felix_project") }}. - -{% set inside = states("sensor.wohnzimmer_temp_temperature") | float | round(2) -%} -{% set outside = states("sensor.dark_sky_temperature") | float | round(2) -%} -{% set arbeit_morgen = is_state("binary_sensor.arbeitstag_morgen","on") -%} - -Die Wetteraussichten: {{ states("sensor.dark_sky_hourly_summary") | replace(".","")}} bei {{ states("sensor.dark_sky_temperature") }} Grad mit {{ states("sensor.dark_sky_humidity") | round(0) }}% Luftfeuchtigkeit. -{% if states("calendar.abfall_papiermuell") == "on" %} -Heute ist Papiermuell, bring noch schnell dein Papier raus -{% endif %} -{% if states("calendar.abfall_restmuell") == "on" %} -Ausserdem ist heute Restmuell. -{% endif -%} - -{% if ( outside < inside ) and ( outside > 18 ) %} -Draussen ist es gerade {{ ((inside - outside) | round(1) )}} gerade kühler -{% endif -%} - -{% set current_count = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_count") %} -{% for i in range(current_count) %} -{% set idx = i + 1 %} - {% set headline = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ idx ~ "_headline") %} - {% set description = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ idx ~ "_description") %} - {% set level = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ idx ~ "_level") %} - {% set time_start = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ idx ~ "_start") %} - {% set time_end = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ idx ~ "_end") %} -Wetterwarnung {{idx}}: {{ headline }} Stufe {{level}} von {{ time_start.strftime("%H:%M") ~ " bis " ~ time_end.strftime("%H:%M") }} Uhr - -{{ description }} -{% endfor %} - -{% if is_friday %} -Endlich ist Freitag! -{% elif not arbeit_morgen %} -Morgen ist Feiertag, also nicht versehentlich arbeiten -{% endif -%} diff --git a/makefu/2configs/home/ham/automation/wohnzimmer_rf_fernbedienung.nix b/makefu/2configs/home/ham/automation/wohnzimmer_rf_fernbedienung.nix deleted file mode 100644 index b67dacb14..000000000 --- a/makefu/2configs/home/ham/automation/wohnzimmer_rf_fernbedienung.nix +++ /dev/null @@ -1,151 +0,0 @@ -# This module maps the RF433 Remote Control to zigbee and wifi lights -let - rf_turn_off = code: light: - { - alias = "Turn off ${light} via rf code ${code}"; - trigger = { - platform = "event"; - event_type = "esphome.rf_code_received"; - event_data.code = code; - }; - action = { - service = "light.turn_off"; - data.entity_id = light; - }; - }; - rf_turn_on = code: light: - { - alias = "Turn on ${light} via rf code ${code}"; - trigger = { - platform = "event"; - event_type = "esphome.rf_code_received"; - event_data.code = code; - }; - action = { - service = "light.turn_on"; - data.entity_id = light; - }; - }; - rf_state = code: light: halfbright: - let - maxbright = 255; - transition = 0.2; # seconds - in - # this function implements a simple state machine based on the state and brightness of the light (light must support brightness - { - alias = "Cycle through states of ${light} via rf code ${code}"; - trigger = { - platform = "event"; - event_type = "esphome.rf_code_received"; - event_data.code = code; - }; - action = { - choose = [ - { - # state 0: off to half - conditions = { - condition = "template"; - value_template = ''{{ states("${light}") == "off" }}''; - }; - sequence = [ - { - service = "light.turn_on"; - data = { - entity_id = light; - brightness = halfbright; - }; - } - ]; - } - { - # state 1: half to full - conditions = { - condition = "template"; - value_template = ''{{ states('${light}') == 'on' and ( ${toString (halfbright - 1)} <= state_attr("${light}","brightness") <= ${toString (halfbright + 1)})}}''; - }; - sequence = [ - { - service = "light.turn_on"; - data = { - entity_id = light; - brightness = maxbright; - }; - } - ]; - } - { - # state 2: full to off - conditions = { - condition = "template"; - # TODO: it seems like the devices respond with brightness-1 , maybe off-by-one somewhere? - value_template = ''{{ states("${light}") == "on" and state_attr("${light}","brightness") >= ${toString (maxbright - 1)}}}''; - }; - sequence = [ - { - service = "light.turn_off"; - data = { - entity_id = light; - }; - } - ]; - } - ]; - # default: on to off - # this works because state 0 checks for "state == off" - default = [{ - service = "light.turn_off"; - data = { - entity_id = light; - }; - }]; - }; - } -; - rf_toggle = code: light: - { - alias = "Toggle ${light} via rf code ${code}"; - trigger = { - platform = "event"; - event_type = "esphome.rf_code_received"; - event_data.code = code; - }; - action = { - service = "light.toggle"; - data.entity_id = light; - }; - }; -in -{ - services.home-assistant.config.automation = [ - (rf_toggle "400551" "light.wohnzimmer_fernseher_led_strip") # A - (rf_state "401151" "light.wohnzimmer_stehlampe_osram" 128) # B - (rf_state "401451" "light.wohnzimmer_komode_osram" 128) # C - (rf_state "401511" "light.wohnzimmer_schrank_osram" 128) # D - - # OFF Lane - (let code = "400554"; in { - alias = "Turn off living room light via rf code ${code}"; # A - trigger = { - platform = "event"; - event_type = "esphome.rf_code_received"; - event_data.code = code; - }; - action = { - service = "light.turn_off"; - data.entity_id = [ - "light.wohnzimmer_fernseher_led_strip" "light.wohnzimmer_stehlampe_osram" - "light.wohnzimmer_komode_osram" "light.wohnzimmer_schrank_osram" - "light.wohnzimmer_fenster_lichterkette_licht" "light.wled" - ]; - }; - }) - - (rf_toggle "401154" "light.wohnzimmer_fenster_lichterkette_licht") # B - (rf_toggle "401454" "light.wohnzimmer_fernsehwand_led") # C - # (rf_toggle "401514" "") # D - ]; - # "400554" # A OFF - # "401154" # B OFF - # "401454" # C OFF - # "401514" # D OFF -} diff --git a/makefu/2configs/home/ham/calendar/nextcloud.nix b/makefu/2configs/home/ham/calendar/nextcloud.nix deleted file mode 100644 index 3eb68de7d..000000000 --- a/makefu/2configs/home/ham/calendar/nextcloud.nix +++ /dev/null @@ -1,41 +0,0 @@ -let - cred = import <secrets/ham/nextcloud-calendar>; -in -{ - services.home-assistant.config.calendar = - [ - { - platform = "caldav"; - inherit (cred) username password; - url = "https://o.euer.krebsco.de/remote.php/dav"; - custom_calendars = [ - { - name = "Gelbersack"; - calendar = "Abfall"; - search = "Gelber Sack.*"; - } - { - name = "Biomuell"; - calendar = "Abfall"; - search = "Bio.*"; - } - { - name = "Restmuell"; - calendar = "Abfall"; - search = "Rest.*"; - } - { - name = "Papiermuell"; - calendar = "Abfall"; - search = "Altpapier.*"; - } - { - name = "Kehrwoche"; - calendar = "Kehrwoche"; - search = ".*"; - } - ]; - } - - ]; -} diff --git a/makefu/2configs/home/ham/default.nix b/makefu/2configs/home/ham/default.nix deleted file mode 100644 index 98269959d..000000000 --- a/makefu/2configs/home/ham/default.nix +++ /dev/null @@ -1,205 +0,0 @@ -{ pkgs, lib, config, ... }: -# Ideas: -## wake-on-lan server -## -let - prefix = (import ./lib).prefix; - hassdir = "/var/lib/hass"; - - -in { - imports = [ - ./nginx.nix - ./mqtt.nix - ./signal-rest - - # hass config - ./zigbee2mqtt.nix - # ./multi/flurlicht.nix - ./multi/kurzzeitwecker.nix - ./intents - ./multi/the_playlist.nix - ./multi/heizung.nix - # ./multi/fliegen-couter.nix - - ./device_tracker/openwrt.nix - ./device_tracker/tile.nix - - ./sensor/outside.nix - ./sensor/pollen.nix - ./sensor/dwd.nix - - ./calendar/nextcloud.nix - - ./media/firetv.nix - ./media/sonos.nix - ./media/schlafzimmer_music_remote.nix - ./media/remote_sound_wohnzimmer.nix - ./media/remote_sound_arbeitszimmer.nix - ./media/arbeitszimmer_matrix.nix - - ./automation/check-in.nix - ./automation/fenster_auf.nix - ./automation/firetv_restart.nix - ./automation/light_buttons.nix - ./automation/wohnzimmer_rf_fernbedienung.nix - # ./automation/ladestecker_timer.nix - ./automation/flurlicht.nix - # ./automation/giesskanne.nix - # ./automation/pflanzen_giessen_erinnerung.nix - ./automation/find_phone.nix - ./automation/urlaub.nix - ./automation/moodlight.nix - ./automation/shutdown_button.nix - ./automation/project_tracker.nix - ./automation/daily_speedtext.nix - - - ./light/arbeitszimmer.nix - ./light/schlafzimmer.nix - ./light/wohnzimmer.nix - - ./tts/google.nix - ]; - - services.home-assistant = { - extraComponents = [ "mobile_app" ]; - extraPackages = python3Packages: with python3Packages; [ pytz ]; - - config = { - default_config = {}; # for sonos aiodiscover - - influxdb = { - api_version = 1; - database = "ham"; - host = "localhost"; - tags = { - instance = "omo"; - source = "hass"; - }; - }; - - config = {}; - homeassistant = { - name = "Home"; time_zone = "Europe/Berlin"; - latitude = "48.7687"; - longitude = "9.2478"; - elevation = 247; - auth_providers = [ - { type = "trusted_networks"; - trusted_networks = [ "192.168.1.0/24" ]; - allow_bypass_login = true; - } - { type = "homeassistant"; } - ]; - }; - tasmota = {}; - binary_sensor = [ - { platform = "workday"; - name = "Arbeitstag"; - country = "DE"; - province = "BW"; - } - { platform = "workday"; - name = "Arbeitstag Morgen"; - country = "DE"; - province = "BW"; - days_offset = 1; - } - { platform = "workday"; - name = "Arbeitstag Gestern"; - country = "DE"; - province = "BW"; - days_offset = 1; - } - ]; - discovery = {}; - conversation = {}; - history = {}; - logbook = {}; - logger = { - default = "info"; - }; - rest_command = {}; - api = {}; - esphome = {}; # fails - camera = []; - #telegram_bot = [ - # # secrets file: { - # # "platform": "broadcast", - # # "api_key": "", # talk to Botfather /newbot - # # "allowed_chat_ids": [ ID ] # curl -X GET # https://api.telegram.org/bot<YOUR_API_TOKEN>/getUpdates - # # } - # (builtins.fromJSON - # (builtins.readFile <secrets/hass/telegram-bot.json>)) - #]; - notify = [ - #{ - # platform = "telegram"; - # name = "telegrambot"; - # chat_id = builtins.elemAt - # (builtins.fromJSON (builtins.readFile - # <secrets/hass/telegram-bot.json>)).allowed_chat_ids 0; - #} - ]; - sun.elevation = 247; - recorder = {}; - mqtt = { - broker = "localhost"; - discovery = true; #enable esphome discovery - discovery_prefix = "homeassistant"; - port = 1883; - client_id = "home-assistant"; - username = "hass"; - password = lib.removeSuffix "\n" (builtins.readFile <secrets/mqtt/hass>); - keepalive = 60; - protocol = 3.1; - birth_message = { - topic = "${prefix}/hass/tele/LWT"; - payload = "Online"; - qos = 1; - retain = true; - }; - will_message = { - topic = "${prefix}/hass/tele/LWT"; - payload = "Offline"; - qos = 1; - retain = true; - }; - }; - luftdaten = { - # show_on_map = true; - sensor_id = 72935; - # sensors.monitored_conditions = [ "P1" "P2" ]; - }; - #binary_sensor = - # flurlicht.binary_sensor; - - sensor = [ - # https://www.home-assistant.io/cookbook/automation_for_rainy_days/ - ]; - frontend = { }; - speedtestdotnet = { }; - http = { - use_x_forwarded_for = true; - #server_host = "127.0.0.1"; - server_host = "0.0.0.0"; - trusted_proxies = [ "127.0.0.1" ]; - #trusted_proxies = [ "192.168.1.0/24" ]; - }; - switch = []; - automation = []; - script = { }; - media_source = {}; - }; - enable = true; - configDir = hassdir; - }; - - krebs.secret.files."hass-secrets" = { - source-path = toString <secrets> + "/hass/secrets.yaml"; - path = "/var/lib/hass/secrets.yaml"; - owner.name = "hass"; - }; - state = [ "/var/lib/hass/known_devices.yaml" ]; -} diff --git a/makefu/2configs/home/ham/deps/dwdwfsapi.nix b/makefu/2configs/home/ham/deps/dwdwfsapi.nix deleted file mode 100644 index d59dfa9e8..000000000 --- a/makefu/2configs/home/ham/deps/dwdwfsapi.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ lib -, buildPythonPackage -, fetchPypi -, requests -, ciso8601 -, urllib3 -}: - -buildPythonPackage rec { - pname = "dwdwfsapi"; - version = "1.0.3"; - - disabled = false; # requires python version >=3.6 - - src = fetchPypi { - inherit pname version; - sha256 = "3d7d5bd66b1a647f07295068dc653b4ceafc2e8ec834b8e32419031c7b3a9b39"; - }; - - # # Package conditions to handle - # # might have to sed setup.py and egg.info in patchPhase - # # sed -i "s/<package>.../<package>/" - # requests>=2.23.0,<3 - # ciso8601>=2.1.3,<3 - # urllib3>=1.25.8,<2 - propagatedBuildInputs = [ - requests - ciso8601 - urllib3 - ]; - - meta = with lib; { - description = "Python client to retrieve data provided by DWD via their geoserver WFS API"; - homepage = https://github.com/stephan192/dwdwfsapi; - license = licenses.mit; - # maintainers = [ maintainers. ]; - }; -} diff --git a/makefu/2configs/home/ham/deps/pykodi.nix b/makefu/2configs/home/ham/deps/pykodi.nix deleted file mode 100644 index 85a541f8a..000000000 --- a/makefu/2configs/home/ham/deps/pykodi.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ lib -, buildPythonPackage -, fetchPypi -, jsonrpc-async -, jsonrpc-websocket -, aiohttp -}: - -buildPythonPackage rec { - pname = "pykodi"; - version = "0.2.2"; - - disabled = false; # requires python version >=3.7.0 - - src = fetchPypi { - inherit pname version; - sha256 = "43e7036a00a76f65c34dc5e7f1065a3ef071eea7619c2e6228e521b638e640bc"; - }; - - # # Package conditions to handle - # # might have to sed setup.py and egg.info in patchPhase - # # sed -i "s/<package>.../<package>/" - # jsonrpc-async>=1.1.0 - # jsonrpc-websocket>=1.2.1 - propagatedBuildInputs = [ - jsonrpc-async - jsonrpc-websocket - aiohttp - ]; - - meta = with lib; { - description = "An async python interface for Kodi over JSON-RPC"; - homepage = https://github.com/OnFreund/PyKodi; - license = licenses.mit; - # maintainers = [ maintainers. ]; - }; -} diff --git a/makefu/2configs/home/ham/device_tracker/openwrt.nix b/makefu/2configs/home/ham/device_tracker/openwrt.nix deleted file mode 100644 index c2b0353c6..000000000 --- a/makefu/2configs/home/ham/device_tracker/openwrt.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - services.home-assistant.config.device_tracker = - [ - { platform = "luci"; - host = "192.168.111.5"; - username = "root"; - password = import <secrets/hass/router.nix>; - interval_seconds = 30; # instead of 12seconds - consider_home = 300; # 5 minutes timeout - new_device_defaults.track_new_devices = true; - } - ]; -} diff --git a/makefu/2configs/home/ham/device_tracker/tile.nix b/makefu/2configs/home/ham/device_tracker/tile.nix deleted file mode 100644 index ad1e6c15d..000000000 --- a/makefu/2configs/home/ham/device_tracker/tile.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - - services.home-assistant.config.device_tracker = - [ - { inherit (import <secrets/hass/tile.nix>) username password; - platform = "tile"; - show_inactive = true; - } - ]; -} diff --git a/makefu/2configs/home/ham/docker.nix b/makefu/2configs/home/ham/docker.nix deleted file mode 100644 index e8a47dbbb..000000000 --- a/makefu/2configs/home/ham/docker.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ config, pkgs, lib, ... }: -let - confdir = "/var/lib/homeassistant-docker"; -in { - imports = [ - ./nginx.nix - ./mqtt.nix - ./signal-rest - ./signal-rest/service.nix - ]; - - networking.firewall.allowedTCPPorts = [ 8123 ]; - state = [ "/var/lib/hass/known_devices.yaml" ]; - virtualisation.oci-containers.containers.hass = { - image = "homeassistant/home-assistant:latest"; - environment = { - TZ = "Europe/Berlin"; - UMASK = "007"; - }; - extraOptions = ["--net=host" ]; - volumes = [ - "${confdir}:/config" - #"/data/music:/config/media" - ]; - }; - systemd.tmpfiles.rules = [ - #"f ${confdir}/docker-run 0770 kiosk kiosk - -" - "d ${confdir} 0770 kiosk kiosk - -" - ]; -} diff --git a/makefu/2configs/home/ham/intents/default.nix b/makefu/2configs/home/ham/intents/default.nix deleted file mode 100644 index 24594b4a2..000000000 --- a/makefu/2configs/home/ham/intents/default.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - services.home-assistant.config = { - intent_script = { - GetTime.speech.text = '' - Es ist {{ now().hour }} Uhr {{ now().minute }} - ''; - GutenMorgen.speech.text = '' - Einen wunderschönen Guten Morgen wünsche ich dir - ''; - WieGehtEsDir.speech.text = '' - Mir geht es sehr gut, und dir? - ''; - Statusreport.speech.text = builtins.readFile ./statusbericht.txt.j2; - StartMusic = { - speech.text = "Spiele {{ music }} musik"; - action_async = [ - { - service = "media_player.play_media"; - data_template = { - entity_id = "media_player.{{ _intent.siteId }}"; - media_content_id = builtins.readFile ./music_chooser.txt.j2; - media_content_type = "music"; - }; - } - ]; - }; - GetWeather = { - #speech.text = '' - # {{ states('sensor.openweathermap_weather') }} bei {{ states('sensor.openweathermap_temperature') }} Grad - #''; - speech.text = "{{ states('sensor.swr_prognose') }}"; - }; - }; - }; -} diff --git a/makefu/2configs/home/ham/intents/music_chooser.txt.j2 b/makefu/2configs/home/ham/intents/music_chooser.txt.j2 deleted file mode 100644 index b66ed2721..000000000 --- a/makefu/2configs/home/ham/intents/music_chooser.txt.j2 +++ /dev/null @@ -1,13 +0,0 @@ -{% if music == "lounge" -%} -https://cast1.asurahosting.com/proxy/julien/stream.mp3 -{% elif music == "lassulus" -%} -http://radio.lassul.us:8000/radio.mp3 -{% elif music == "groove" -%} -http://ice2.somafm.com/groovesalad-128.mp3 -{% elif music == "swr3" -%} -https://liveradio.swr.de/sw282p3/swr3/play.mp3 -{% elif music == "swr1" -%} -https://liveradio.swr.de/sw282p3/swr1bw/play.mp3 -{% elif music == "radio" -%} -https://liveradio.swr.de/sw282p3/swr1bw/play.mp3 -{% endif %} diff --git a/makefu/2configs/home/ham/intents/statusbericht.txt.j2 b/makefu/2configs/home/ham/intents/statusbericht.txt.j2 deleted file mode 100644 index c17ad455c..000000000 --- a/makefu/2configs/home/ham/intents/statusbericht.txt.j2 +++ /dev/null @@ -1,37 +0,0 @@ -{% set arbeit_heute = is_state("binary_sensor.arbeitstag","on") -%} -{% set weekday = ['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag'][now().weekday()] -%} -{% set is_friday = now().weekday() == 4 %} - -Dies ist deine Persönliche Zusammenfassung -{% set inside = states("sensor.wohnzimmer_temp_temperature") | float | round(2) -%} -{% set outside = states("sensor.dark_sky_temperature") | float | round(2) -%} -{% set arbeit_morgen = is_state("binary_sensor.arbeitstag_morgen","on") -%} - -Die Wetteraussichten: {{ states("sensor.dark_sky_hourly_summary") | replace(".","")}} bei {{ states("sensor.dark_sky_temperature") }} Grad mit {{ states("sensor.dark_sky_humidity") | round(0) }}% Luftfeuchtigkeit. -{% if states("calendar.abfall_papiermuell") == "on" %} -Heute ist Papiermuell, bring noch schnell dein Papier raus -{% endif %} -{% if states("calendar.abfall_restmuell") == "on" %} -Ausserdem ist heute Restmuell. -{% endif -%} - -{% if ( outside < inside ) and ( outside > 18 ) %} -Draussen ist es gerade {{ ((inside - outside) | round(1) )}} gerade kühler -{% endif -%} - -{% set current_count = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_count") %} -{% for i in range(current_count) %} -{% set idx = i + 1 %} - {% set headline = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ idx ~ "_headline") %} - {% set description = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ idx ~ "_description") %} - {% set level = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ idx ~ "_level") %} - {% set time_start = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ idx ~ "_start") %} - {% set time_end = state_attr("sensor.dwd_weather_warnings_current_warning_level", "warning_" ~ idx ~ "_end") %} -Wetterwarnung {{idx}}: {{ headline }} Stufe {{level}} von {{ time_start.strftime("%H:%M") ~ " bis " ~ time_end.strftime("%H:%M") }} Uhr - -{{ description }} -{% endfor %} - -{% if is_friday %} -Endlich ist Freitag! -{% endif -%} diff --git a/makefu/2configs/home/ham/lib/cheat-sheet.nix b/makefu/2configs/home/ham/lib/cheat-sheet.nix deleted file mode 100644 index f593ef4ec..000000000 --- a/makefu/2configs/home/ham/lib/cheat-sheet.nix +++ /dev/null @@ -1,42 +0,0 @@ -# Begin -let -in { - services.home-assistant.config.automation = - [ - ]; -} - -# example automation - { alias = ""; - trigger = [ - { - platform = "state"; - entity_id = ""; - to = "on"; - for.seconds = 0; - } - ]; - condition = [ - { condition = "state"; - entity_id = ""; - state = "off"; - } - ]; - action = - [ - { choose = [ - { - conditions = { - condition = "state"; - entity_id = ""; - state = "on"; - }; - sequence = [{ - service = "home_assistant.turn_on"; - target.entity_id = ""; - }]; - }]; - default = { }; - } - ]; - } diff --git a/makefu/2configs/home/ham/lib/default.nix b/makefu/2configs/home/ham/lib/default.nix deleted file mode 100644 index 0d89d1e9e..000000000 --- a/makefu/2configs/home/ham/lib/default.nix +++ /dev/null @@ -1,134 +0,0 @@ -let - prefix = "/ham"; -in -{ - inherit prefix; - say = let - # returns a list of actions to be performed on an mpd to say something - tts = { message, entity }: - [ - { - service = "sonos.snapshot"; - target.entity_id = entity; - } - { - service = "tts.google_say"; - data = { - entity_id = entity; - inherit message; - language = "de"; - }; - } - #{ wait_template = "{{ is_state('${entity}' , 'playing') }}"; - # timeout = "00:00:02"; - #} - #{ wait_template = "{{ not is_state('${entity}' , 'playing') }}"; - # timeout = "00:01:00"; - #} - { delay.seconds = 1; } - { delay = '' - {% set duration = state_attr("${entity}","media_duration") or 0 %} - {% set seconds = (duration % 60 ) %} - {% set minutes = (duration / 60)|int % 60 %} - {% set hours = (duration / 3600)|int %} - {{ "%02i:%02i:%02i"|format(hours, minutes, seconds)}} - ''; - } - { - service = "sonos.restore"; - target.entity_id = entity; - } - ]; - in - { - living_room = message: tts { - inherit message; - entity = "media_player.living_room"; - }; - office = message: tts { - inherit message; - entity = "media_player.office"; - }; - bedroom = message: tts { - inherit message; - entity = "media_player.bedroom"; - }; - }; - - zigbee.prefix = "/ham/zigbee"; - - btn_cycle_light = light: btn: halfbright: - let - maxbright = 255; - transition = 0.2; # seconds - in - # this function implements a simple state machine based on the state and brightness of the light (light must support brightness - { - alias = "Cycle through states of ${light} via button ${btn}"; - trigger = { - platform = "state"; - entity_id = "sensor.${btn}_click"; - to = "single"; - }; - action = { - choose = [ - { - # state 0: off to half - conditions = { - condition = "template"; - value_template = ''{{ states("${light}") == "off" }}''; - }; - sequence = [ - { - service = "light.turn_on"; - data = { - entity_id = light; - brightness = halfbright; - }; - } - ]; - } - { - # state 1: half to full - conditions = { - condition = "template"; - value_template = ''{{ states('${light}') == 'on' and ( ${toString (halfbright - 1)} <= state_attr("${light}","brightness") <= ${toString (halfbright + 1)})}}''; - }; - sequence = [ - { - service = "light.turn_on"; - data = { - entity_id = light; - brightness = maxbright; - }; - } - ]; - } - { - # state 2: full to off - conditions = { - condition = "template"; - # TODO: it seems like the devices respond with brightness-1 , maybe off-by-one somewhere? - value_template = ''{{ states("${light}") == "on" and state_attr("${light}","brightness") >= ${toString (maxbright - 1)}}}''; - }; - sequence = [ - { - service = "light.turn_off"; - data = { - entity_id = light; - }; - } - ]; - } - ]; - # default: on to off - # this works because state 0 checks for "state == off" - default = [{ - service = "light.turn_off"; - data = { - entity_id = light; - }; - }]; - }; - }; -} diff --git a/makefu/2configs/home/ham/light/arbeitszimmer.nix b/makefu/2configs/home/ham/light/arbeitszimmer.nix deleted file mode 100644 index 6e572c763..000000000 --- a/makefu/2configs/home/ham/light/arbeitszimmer.nix +++ /dev/null @@ -1,33 +0,0 @@ -let - arbeitszimmer_deko = [ - "light.led_wand" - "light.box_led_status" - "light.arbeitszimmer_led1_led_strip" # LED-Kreis in cube - ]; - arbeitszimmerbeleuchtung = [ - "light.arbeitszimmer_schrank_dimmer" - "light.arbeitszimmer_kerze" - "light.arbeitszimmer_pflanzenlicht" - ]; -in { - imports = [ ./tint_arbeitszimmer.nix ]; - - services.home-assistant.config.light = [ - { - platform = "group"; - name = "Arbeitszimmerbeleuchtung"; - entities = arbeitszimmerbeleuchtung; - } - { - platform = "group"; - name = "Arbeitszimmer Deko"; - entities = arbeitszimmer_deko; - } - { platform = "switch"; - name = "Arbeitszimmer Pflanzenlicht"; - entity_id = "switch.arbeitszimmer_stecker1"; - } - ]; - services.home-assistant.config.automation = [ - ]; -} diff --git a/makefu/2configs/home/ham/light/schlafzimmer.nix b/makefu/2configs/home/ham/light/schlafzimmer.nix deleted file mode 100644 index e5370e3f8..000000000 --- a/makefu/2configs/home/ham/light/schlafzimmer.nix +++ /dev/null @@ -1,14 +0,0 @@ -let - schlafzimmer_licht = [ - "light.schlafzimmer_komode_osram" - # "light.schlafzimmer_schrank_osram" - ]; -in { - services.home-assistant.config.light = [ - { - platform = "group"; - name = "Schlafzimmerbeleuchtung"; - entities = schlafzimmer_licht; - } - ]; -} diff --git a/makefu/2configs/home/ham/light/tint_arbeitszimmer.nix b/makefu/2configs/home/ham/light/tint_arbeitszimmer.nix deleted file mode 100644 index 4ae91ac54..000000000 --- a/makefu/2configs/home/ham/light/tint_arbeitszimmer.nix +++ /dev/null @@ -1,281 +0,0 @@ -{ lib, ...}: - -let - # effect - color - # Solid Pattern - Hult - group_id_1 = 16388; - group_id_2 = 16389; - group_id_3 = 16390; - remote = "sensor.arbeitszimmer_remote1_action"; - main_light_1 = "light.wled_4"; - default_scene_1 = "Solid"; - default_color_1 = "Default"; - main_color_select_1 = "select.wled_color_palette_4"; - light_group_1.entity_id = [ - main_light_1 - ]; - - # contains only the actually changeable lights - light_group_2.entity_id = [ - "light.arbeitszimmer_schrank_dimmer" - ]; - light_group_3.entity_id = [ - "light.arbeitszimmer_pflanzenlicht" - ]; - - statecond = cond: { # cond must be a list - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action in ( " + - (lib.concatMapStringsSep "," (x: "'${x}'") cond) + ") }}"; - }; -in { - services.home-assistant.config.automation = [ - { - alias = "Perform Actions with ${remote}"; - mode = "queued"; - max = 5; - max_exceeded = "silent"; - trigger = { - platform = "state"; - entity_id = remote; - }; - condition = { - condition = "and"; - conditions = [ - { - condition = "template"; - value_template = "{{ trigger.from_state.state != trigger.to_state.state }}"; - } - ( statecond [ "off" "on" "color_wheel" - "brightness_up_click" "brightness_down_click" - "color_temp" "color_temperature_move" - "brightness_step_down" "brightness_step_up" "brightness_down_hold" "brightness_down_release" "brightness_up_hold" "brightness_up_release" - "scene_3" "scene_1" "scene_2" # working sunset party - "scene_6" "scene_4" "scene_5" # night campfire romantic - ]) - ]; - }; - action = [ - { service = "system_log.write"; - data = { - level = "info"; - message = "Tint Button pressed: {{ trigger.to_state.state }} Group: {{ trigger.to_state.attributes.action_group }} Length {{ input_working_scene_1 | length }}"; - }; - } - { - choose = [ - { # light group 1 - conditions = { - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action_group == ${toString group_id_1} }}"; - }; - sequence = [ - { - choose = [ - { - conditions = statecond [ "on" "off" ]; - sequence = { - service = "light.turn_{{ trigger.to_state.state }}"; - target = light_group_1; - }; - } - { - conditions = statecond [ "color_wheel" ]; - sequence = { - data.xy_color = [ - "{{ trigger.to_state.attributes.action_color.x | float }}" - "{{ trigger.to_state.attributes.action_color.y | float }}" - ]; - service = "light.turn_on"; - target = light_group_1; - }; - } - { - conditions = statecond [ "color_temp" ]; - sequence = { - data.color_temp = "{{ trigger.to_state.attributes.action_color_temperature | float }}"; - service = "light.turn_on"; - target = light_group_1; - }; - } - { - conditions = statecond [ "brightness_up_click" "brightness_down_click" ]; - sequence = [ - { - variables.factor = ''{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}''; - } - { - data.brightness_step_pct = "{{ factor | int }}"; - service = "light.turn_on"; - target = light_group_1; - } - ]; - } - { - conditions = statecond [ - "scene_3" # working => previous scene - "scene_1" # sunset => default scene (solid) - "scene_2" # party => next scene - - ]; - sequence = [ - { - data.effect = '' - {% set options = state_attr("${main_light_1}","effect_list") -%} - {% set selection = options.index(state_attr("${main_light_1}","effect")) -%} - {% if trigger.to_state.attributes.action == "scene_2" -%} - {% if (selection + 1) >= options | length -%} - {{ options[0] }} - {% else -%} - {{ options[selection + 1] }} - {% endif %} - {% elif trigger.to_state.attributes.action == "scene_1" -%} - ${default_scene_1} - {% elif trigger.to_state.attributes.action == "scene_3" -%} - {{ options[selection - 1] }} - {% endif -%} - ''; - service = "light.turn_on"; - target.entity_id = main_light_1; - } - ]; - } - { - conditions = statecond [ - "scene_6" # night => previous color - "scene_4" # campfire => default Color (Default) - "scene_5" # romance => next color - - ]; - sequence = [ - { - data.option = '' - {% set options = state_attr("${main_color_select_1}","options") -%} - {% set selection = options.index(states("${main_color_select_1}")) -%} - {% if trigger.to_state.attributes.action == "scene_5" -%} - {% if (selection + 1) >= options | length -%} - {{ options[0] }} - {% else -%} - {{ options[selection + 1] }} - {% endif %} - {% elif trigger.to_state.attributes.action == "scene_4" -%} - ${default_color_1} - {% elif trigger.to_state.attributes.action == "scene_6" -%} - {{ options[selection - 1] }} - {% endif -%} - ''; - service = "select.select_option"; - target.entity_id = main_color_select_1; - } - ]; - } - ]; - } - ]; - } - { # light group 2 - conditions = { - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action_group == ${toString group_id_2} }}"; - }; - sequence = [ - { - choose = [ - { conditions = statecond [ "on" "off" ]; - sequence = { - service = "light.turn_{{ trigger.to_state.state }}"; - target = light_group_2; - }; - } - { - conditions = statecond [ "color_wheel" ]; - sequence = { - data.xy_color = [ - "{{ trigger.to_state.attributes.action_color.x | float }}" - "{{ trigger.to_state.attributes.action_color.y | float }}" - ]; - service = "light.turn_on"; - target = light_group_2; - }; - } - { - conditions = statecond [ "color_temp" ]; - sequence = { - data.color_temp = "{{ trigger.to_state.attributes.action_color_temperature | float }}"; - service = "light.turn_on"; - target = light_group_2; - }; - } - { - conditions = statecond [ "brightness_up_click" "brightness_down_click" ]; - sequence = [ - { - variables.factor = ''{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}''; - } - { - data.brightness_step_pct = "{{ factor | int }}"; - service = "light.turn_on"; - target = light_group_2; - } - ]; - } - ]; - } - ]; - } - { # light group 3 - conditions = { - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action_group == ${toString group_id_3} }}"; - }; - sequence = [ - { - choose = [ - { conditions = statecond [ "on" "off" ]; - sequence = { - service = "light.turn_{{ trigger.to_state.state }}"; - target = light_group_3; - }; - } - { - conditions = statecond [ "color_wheel" ]; - sequence = { - data.xy_color = [ - "{{ trigger.to_state.attributes.action_color.x | float }}" - "{{ trigger.to_state.attributes.action_color.y | float }}" - ]; - service = "light.turn_on"; - target = light_group_3; - }; - } - { - conditions = statecond [ "color_temperature_move" ]; - sequence = { - data.color_temp = "{{ trigger.to_state.attributes.action_color_temperature | float }}"; - service = "light.turn_on"; - target = light_group_3; - }; - } - { - conditions = statecond [ "brightness_up_click" "brightness_down_click" ]; - sequence = [ - { - variables.factor = ''{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}''; - } - { - data.brightness_step_pct = "{{ factor | int }}"; - service = "light.turn_on"; - target = light_group_3; - } - ]; - } - ]; - } - ]; - } - ]; - } - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/light/tint_wohnzimmer.nix b/makefu/2configs/home/ham/light/tint_wohnzimmer.nix deleted file mode 100644 index 243243816..000000000 --- a/makefu/2configs/home/ham/light/tint_wohnzimmer.nix +++ /dev/null @@ -1,300 +0,0 @@ -{ lib, ...}: -# cycle through scenes - -# cycle through color palettes -# {% set options = state_attr('select.wled_color_palette','options') -%} -# {% set selection = options.index(states('select.wled_color_palette')) -%} -# {% if false -%} -# {% if (selection + 1) >= options | length -%} -# {{ options[0] }} -# {% else -%} -# {{ options[selection + 1] }} -# {% endif %} -# {% elif true -%} -# {{ options[selection -1] }} -# {% endif -%} - -let - # Solid Pattern - # Hult - group_id_1 = 16388; - group_id_2 = 16389; - group_id_3 = 16390; - remote = "sensor.schlafzimmer_remote1_action"; - main_light_1 = "light.wled"; # fernseher - main_light_2 = "light.wled_2"; #fernsehwand - - default_scene_1 = "Solid"; - default_color_1 = "Default"; - main_color_select_1 = "select.wled_color_palette"; - light_group_1.entity_id = [ - main_light_1 - main_light_2 - ]; - - # contains only the actually changeable lights - light_group_2.entity_id = [ - "light.wohnzimmer_komode_osram" - "light.wohnzimmer_schrank_osram" - "light.wohnzimmer_fenster_lichterkette_licht" - ]; - light_group_3.entity_id = [ - "light.wohnzimmer_stehlampe_osram" - ]; - - statecond = cond: { # cond must be a list - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action in ( " + - (lib.concatMapStringsSep "," (x: "'${x}'") cond) + ") }}"; - }; -in { - services.home-assistant.config.automation = [ - { - alias = "Perform Actions with ${remote}"; - mode = "queued"; - max = 5; - max_exceeded = "silent"; - trigger = { - platform = "state"; - entity_id = remote; - }; - condition = { - condition = "and"; - conditions = [ - { - condition = "template"; - value_template = "{{ trigger.from_state.state != trigger.to_state.state }}"; - } - ( statecond [ "off" "on" "color_wheel" - "brightness_up_click" "brightness_down_click" - "color_temp" "color_temperature_move" - "brightness_step_down" "brightness_step_up" "brightness_down_hold" "brightness_down_release" "brightness_up_hold" "brightness_up_release" - "scene_3" "scene_1" "scene_2" # working sunset party - "scene_6" "scene_4" "scene_5" # night campfire romantic - ]) - ]; - }; - action = [ - { service = "system_log.write"; - data = { - level = "info"; - message = "Tint Button pressed: {{ trigger.to_state.state }} Group: {{ trigger.to_state.attributes.action_group }} Length {{ input_working_scene_1 | length }}"; - }; - } - { - choose = [ - { # light group 1 - conditions = { - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action_group == ${toString group_id_1} }}"; - }; - sequence = [ - { - choose = [ - { - conditions = statecond [ "on" "off" ]; - sequence = { - service = "light.turn_{{ trigger.to_state.state }}"; - target = light_group_1; - }; - } - { - conditions = statecond [ "color_wheel" ]; - sequence = { - data.xy_color = [ - "{{ trigger.to_state.attributes.action_color.x | float }}" - "{{ trigger.to_state.attributes.action_color.y | float }}" - ]; - service = "light.turn_on"; - target = light_group_1; - }; - } - { - conditions = statecond [ "color_temp" ]; - sequence = { - data.color_temp = "{{ trigger.to_state.attributes.action_color_temperature | float }}"; - service = "light.turn_on"; - target = light_group_1; - }; - } - { - conditions = statecond [ "brightness_up_click" "brightness_down_click" ]; - sequence = [ - { - variables.factor = ''{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}''; - } - { - data.brightness_step_pct = "{{ factor | int }}"; - service = "light.turn_on"; - target = light_group_1; - } - ]; - } - { - conditions = statecond [ - "scene_3" # working => previous scene - "scene_1" # sunset => default scene (solid) - "scene_2" # party => next scene - - ]; - sequence = [ - { - data.effect = '' - {% set options = state_attr("${main_light_1}","effect_list") -%} - {% set selection = options.index(state_attr("${main_light_1}","effect")) -%} - {% if trigger.to_state.attributes.action == "scene_2" -%} - {% if (selection + 1) >= options | length -%} - {{ options[0] }} - {% else -%} - {{ options[selection + 1] }} - {% endif %} - {% elif trigger.to_state.attributes.action == "scene_1" -%} - ${default_scene_1} - {% elif trigger.to_state.attributes.action == "scene_3" -%} - {{ options[selection - 1] }} - {% endif -%} - ''; - service = "light.turn_on"; - target.entity_id = main_light_1; - } - ]; - } - { - conditions = statecond [ - "scene_6" # night => previous color - "scene_4" # campfire => default Color (Default) - "scene_5" # romance => next color - - ]; - sequence = [ - { - data.option = '' - {% set options = state_attr("${main_color_select_1}","options") -%} - {% set selection = options.index(states("${main_color_select_1}")) -%} - {% if trigger.to_state.attributes.action == "scene_5" -%} - {% if (selection + 1) >= options | length -%} - {{ options[0] }} - {% else -%} - {{ options[selection + 1] }} - {% endif %} - {% elif trigger.to_state.attributes.action == "scene_4" -%} - ${default_color_1} - {% elif trigger.to_state.attributes.action == "scene_6" -%} - {{ options[selection - 1] }} - {% endif -%} - ''; - service = "select.select_option"; - target.entity_id = main_color_select_1; - } - ]; - } - ]; - } - ]; - } - { # light group 2 - conditions = { - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action_group == ${toString group_id_2} }}"; - }; - sequence = [ - { - choose = [ - { conditions = statecond [ "on" "off" ]; - sequence = { - service = "light.turn_{{ trigger.to_state.state }}"; - target = light_group_2; - }; - } - { - conditions = statecond [ "color_wheel" ]; - sequence = { - data.xy_color = [ - "{{ trigger.to_state.attributes.action_color.x | float }}" - "{{ trigger.to_state.attributes.action_color.y | float }}" - ]; - service = "light.turn_on"; - target = light_group_2; - }; - } - { - conditions = statecond [ "color_temp" ]; - sequence = { - data.color_temp = "{{ trigger.to_state.attributes.action_color_temperature | float }}"; - service = "light.turn_on"; - target = light_group_2; - }; - } - { - conditions = statecond [ "brightness_up_click" "brightness_down_click" ]; - sequence = [ - { - variables.factor = ''{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}''; - } - { - data.brightness_step_pct = "{{ factor | int }}"; - service = "light.turn_on"; - target = light_group_2; - } - ]; - } - ]; - } - ]; - } - { # light group 3 - conditions = { - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action_group == ${toString group_id_3} }}"; - }; - sequence = [ - { - choose = [ - { conditions = statecond [ "on" "off" ]; - sequence = { - service = "light.turn_{{ trigger.to_state.state }}"; - target = light_group_3; - }; - } - { - conditions = statecond [ "color_wheel" ]; - sequence = { - data.xy_color = [ - "{{ trigger.to_state.attributes.action_color.x | float }}" - "{{ trigger.to_state.attributes.action_color.y | float }}" - ]; - service = "light.turn_on"; - target = light_group_3; - }; - } - { - conditions = statecond [ "color_temperature_move" ]; - sequence = { - data.color_temp = "{{ trigger.to_state.attributes.action_color_temperature | float }}"; - service = "light.turn_on"; - target = light_group_3; - }; - } - { - conditions = statecond [ "brightness_up_click" "brightness_down_click" ]; - sequence = [ - { - variables.factor = ''{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}''; - } - { - data.brightness_step_pct = "{{ factor | int }}"; - service = "light.turn_on"; - target = light_group_3; - } - ]; - } - ]; - } - ]; - } - ]; - } - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/light/wohnzimmer.nix b/makefu/2configs/home/ham/light/wohnzimmer.nix deleted file mode 100644 index 7fc7af038..000000000 --- a/makefu/2configs/home/ham/light/wohnzimmer.nix +++ /dev/null @@ -1,56 +0,0 @@ -let - wohnzimmerbeleuchtung = [ - "light.wohnzimmer_komode_osram_light" - "light.wohnzimmer_schrank_osram_light" - ]; - wohnzimmer_deko = [ - "light.wohnzimmer_fernseher_led_strip" # led um fernseher - "light.wohnzimmer_lichterkette_led_strip" # led um fernsehwand - "light.wohnzimmer_fenster_lichterkette_licht" # led um fenster - ]; -in { - imports = [ ./tint_wohnzimmer.nix ]; - services.home-assistant.config.scene = [ - { name = "Wohnzimmer Abendlicht"; - id = "living_room_evening"; - entities = { - "light.wohnzimmer_komode_osram_light" = { - state = "on"; - brightness = 128; - }; - "light.wohnzimmer_schrank_osram_light" = { - state = "on"; - brightness = 128; - }; - "light.wohnzimmer_fenster_lichterkette_licht" = "on"; - "light.wohnzimmer_fernseher_led_strip" = { - state = "on"; - }; - }; - - } - ]; - services.home-assistant.config.wled = {}; - services.home-assistant.config.light = [ - { - platform = "group"; - name = "Wohnzimmerbeleuchtung"; - entities = wohnzimmerbeleuchtung; - } - { - platform = "group"; - name = "Wohnzimmer Deko"; - entities = wohnzimmer_deko; - } - { - platform = "group"; - name = "living_room_lights"; - entities = wohnzimmerbeleuchtung ++ wohnzimmer_deko; - } - ]; -} - -# trigger.to_state.attributes.action_group: -# 1: 18388 -# 2: 18389 -# 3: 18390 diff --git a/makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix b/makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix deleted file mode 100644 index 11d13886e..000000000 --- a/makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix +++ /dev/null @@ -1,110 +0,0 @@ -{ lib, ... }: -let - remote = "sensor.schlafzimmer_music_remote_action"; - hlib = import ../lib; - step = 0.02; - #room = "bedroom"; - room = "office"; - - player = "media_player.${room}"; - say = hlib.say."${room}"; - - remote_action = key: actions: { - conditions = ''{{ trigger.entity_id == 'binary_sensor.matrix_button_${toString key}' }}''; - sequence = actions; - }; - all_buttons = map (key: "binary_sensor.matrix_button_${toString key}") [ - 0 1 2 3 4 5 6 7 8 9 - "b9" "b10" "b11" "b12" "b13" "b14" - ]; -in - { - services.home-assistant.config.rest_command = { - good_song = { - url = "http://prism.r:8001/good"; - method = "POST"; - }; - bad_song = { - url = "http://prism.r:8001/skip"; - method = "POST"; - }; - }; - services.home-assistant.config.automation = - [ - { alias = "Arbeitszimmer Matrix music action"; - mode = "queued"; - trigger = [ - { - platform = "state"; - entity_id = all_buttons; - to = "on"; # ignore 'unavailable' - } - ]; - action = - [ - { choose = [ - (remote_action "9" { - service = "media_player.media_play"; - target.entity_id = player; - }) - (remote_action "7" - { - service = "media_player.media_mute"; - target.entity_id = player; - data.is_volume_muted = ''{{ not state_attr('${player}' , 'is_volume_muted') }}''; - } - ) - (remote_action "2" - { - service = "media_player.media_stop"; - target.entity_id = player; - } - ) - - (remote_action "b9" [ { service = "rest_command.good_song"; } ]) - (remote_action "b10" [ { service = "rest_command.bad_song"; } ]) - (remote_action "b11" [ - { - service = "script.turn_on"; - target.entity_id = "script.find_felix_phone"; - } - ]) - - (remote_action "3" - ((say "Starte Lass") ++ [ - { service = "media_player.play_media"; - data = { - media_content_id = "http://radio.lassul.us:8000/radio.mp3"; - media_content_type = "music"; - }; - target.entity_id = player; - } - ])) - (remote_action "1" - ((say "Starte Groovesalad") ++ [ - { service = "media_player.play_media"; - data = { - media_content_id = "http://ice2.somafm.com/groovesalad-128.mp3"; - media_content_type = "music"; - }; - target.entity_id = player; - } - ])) - (remote_action "8" { - service = "media_player.volume_set"; - target.entity_id = player; - data.volume_level = ''{{ state_attr("${player}","volume_level") + (${toString step}|float) }}''; - }) - (remote_action "5"{ - service = "media_player.volume_set"; - target.entity_id = player; - data.volume_level = ''{{ state_attr("${player}","volume_level") - (${toString step}|float) }}''; - }) - ]; - #default = { }; - } - ]; - } - ]; - -} diff --git a/makefu/2configs/home/ham/media/firetv.nix b/makefu/2configs/home/ham/media/firetv.nix deleted file mode 100644 index e2ac1ef76..000000000 --- a/makefu/2configs/home/ham/media/firetv.nix +++ /dev/null @@ -1,27 +0,0 @@ -let - firetv_stick = "192.168.111.24"; -in { - services.home-assistant.config = { - notify = [ - #{ - #platform = "nfandroidtv"; - #name = "FireTV Wohnzimmer Notification"; - #host = firetv_stick; - #} - ]; - media_player = [ - #{ - # platform = "kodi"; - # name = "FireTV Stick kodi"; - # host = firetv_stick; - #} - # Configuration needs to be done by hand via web interface "integration" - #{ platform = "androidtv"; - # name = "FireTV Stick Android"; - # device_class = "firetv"; - # host = firetv_stick; - # port = 5555; - #} - ]; - }; - } diff --git a/makefu/2configs/home/ham/media/remote_sound_arbeitszimmer.nix b/makefu/2configs/home/ham/media/remote_sound_arbeitszimmer.nix deleted file mode 100644 index cfa1da44e..000000000 --- a/makefu/2configs/home/ham/media/remote_sound_arbeitszimmer.nix +++ /dev/null @@ -1,112 +0,0 @@ -{ lib, ...}: -let - # https://www.radiotheque.de/stream/4744806739035994/ABC-Lounge-Music-Radio/pls/ - # http://listen.radionomy.com/ABC-Lounge - # https://str1.openstream.co/589 - # https://listen.openstream.co/3139/audio - # https://str1.openstream.co/589?aw_0_1st.collectionid%3D3139%26stationId%3D3139%26publisherId%3D613%26k%3D1659381767%26aw_0_azn.pcountry%3D%5B%22FR%22%2C%22IT%22%2C%22DE%22%2C%22ES%22%2C%22GB%22%2C%22CH%22%2C%22CA%22%2C%22AT%22%2C%22US%22%5D%26aw_0_azn.planguage%3D%5B%22en%22%2C%22fr%22%2C%22de%22%5D%26aw_0_azn.pgenre%3D%5B%22Jazz%22%2C%22Easy+Listening%22%2C%22Music%22%5D - statecond = cond: { # cond must be a list - condition = "template"; - value_template = "{{ trigger.to_state.state in ( " + - (lib.concatMapStringsSep "," (x: "'${x}'") cond) + ") }}"; - }; - vol_change = 0.030; - - max_repeat = "30"; # max loops to repeat before bailing out - remote = "sensor.arbeitszimmer_sound1_action"; - player = "media_player.office"; - last_state_sensor_name = "last_rotation_action_arbeitszimmer"; - last_state_sensor = "input_text.${last_state_sensor_name}"; - # - service: media_player.volume_set - # target: - # entity_id: media_player.kitchen - # data: - # volume_level: {{ state_attr('media_player.kitchen', 'volume_level') + 0.02 }} - rotate_stop = "brightness_stop"; - rotate_right = "brightness_move_up"; - rotate_left = "brightness_move_down" ; - - single_click = "toggle"; - double_click = "brightness_step_up"; - triple_click = "brightness_step_down"; -in { - services.home-assistant.config.input_text."${last_state_sensor_name}".name = "Last action of the arbeitszimmer"; - services.home-assistant.config.automation = [ - { - trigger = { - platform = "state"; - entity_id = remote; - to = [ rotate_stop ]; - }; - action = [ - { service = "input_text.set_value"; - target.entity_id = last_state_sensor; - data.value = "stop"; - } - ]; - } - { - alias = "Perform Actions with ${remote}"; - trigger = { - platform = "state"; - entity_id = remote; - to = [ single_click double_click triple_click rotate_left rotate_right ]; - }; - #mode = "queued"; - #max = 5; - mode = "single"; - #max_exceeded = "silent"; - action = [ - { - choose = [ - { - conditions = statecond [ single_click ]; - sequence = [ - { service = "media_player.media_play_pause"; - target.entity_id = player; - } - ]; - } - { - conditions = statecond [ rotate_left rotate_right ]; - sequence = let - vol_up = toString vol_change; - vol_down = toString (-1 * vol_change); - in [ - { - variables.nextvol = ''{% if trigger.to_state.state in ( "${rotate_left}" ) -%} ${vol_down} {% else -%} ${vol_up} {% endif -%}''; - variables.state = ''{% if trigger.to_state.state in ( "${rotate_left}" ) -%} left {% else -%} right {% endif -%}''; - } - { service = "input_text.set_value"; - target.entity_id = last_state_sensor; - data.value = ''{{ state }}''; - } - { - repeat = { - sequence = [ - { service = "media_player.volume_set"; - target.entity_id = player; - data.volume_level = ''{{ state_attr("${player}","volume_level") + (nextvol|float) }}''; - } - { delay.milliseconds = "150"; } - ]; - while = [ - { - condition = "template"; - value_template = ''{{ states("${last_state_sensor}") == state }}''; - } - { - condition = "template"; - value_template = "{{ repeat.index <= ${max_repeat}}}"; - } - ]; - }; - } - ]; - } - ]; - } - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/media/remote_sound_wohnzimmer.nix b/makefu/2configs/home/ham/media/remote_sound_wohnzimmer.nix deleted file mode 100644 index 2091ca946..000000000 --- a/makefu/2configs/home/ham/media/remote_sound_wohnzimmer.nix +++ /dev/null @@ -1,107 +0,0 @@ -{ lib, ...}: -let - statecond = cond: { # cond must be a list - condition = "template"; - value_template = "{{ trigger.to_state.state in ( " + - (lib.concatMapStringsSep "," (x: "'${x}'") cond) + ") }}"; - }; - vol_change = 0.030; - - max_repeat = "30"; # max loops to repeat before bailing out - remote = "sensor.wohnzimmer_sound1_action"; - player = "media_player.living_room"; - last_state_sensor_name = "last_rotation_action"; - last_state_sensor = "input_text.last_rotation_action"; - # - service: media_player.volume_set - # target: - # entity_id: media_player.kitchen - # data: - # volume_level: {{ state_attr('media_player.kitchen', 'volume_level') + 0.02 }} - rotate_stop = "brightness_stop"; - rotate_right = "brightness_move_up"; - rotate_left = "brightness_move_down" ; - - single_click = "toggle"; - double_click = "brightness_step_up"; - triple_click = "brightness_step_down"; -in { - services.home-assistant.config.input_text."${last_state_sensor_name}".name = "Last action of the wohnzimmer"; - services.home-assistant.config.automation = [ - { - trigger = { - platform = "state"; - entity_id = remote; - to = [ rotate_stop ]; - }; - action = [ - { service = "input_text.set_value"; - target.entity_id = last_state_sensor; - data.value = "stop"; - } - ]; - } - { - alias = "Perform Actions with ${remote}"; - trigger = { - platform = "state"; - entity_id = remote; - to = [ single_click double_click triple_click rotate_left rotate_right ]; - }; - #mode = "queued"; - #max = 5; - mode = "single"; - #max_exceeded = "silent"; - action = [ - { - choose = [ - { - conditions = statecond [ single_click ]; - sequence = [ - { service = "media_player.media_play_pause"; - target.entity_id = player; - } - ]; - } - { - conditions = statecond [ rotate_left rotate_right ]; - sequence = let - vol_up = toString vol_change; - vol_down = toString (-1 * vol_change); - in [ - { - variables.nextvol = ''{% if trigger.to_state.state in ( "${rotate_left}" ) -%} ${vol_down} {% else -%} ${vol_up} {% endif -%}''; - variables.state = ''{% if trigger.to_state.state in ( "${rotate_left}" ) -%} left {% else -%} right {% endif -%}''; - } - { service = "input_text.set_value"; - target.entity_id = last_state_sensor; - data.value = ''{{ state }}''; - } - { - repeat = { - sequence = [ - { service = "media_player.volume_set"; - target.entity_id = player; - data.volume_level = ''{{ state_attr("${player}","volume_level") + (nextvol|float) }}''; - } - { delay.milliseconds = "150"; } - ]; - while = [ - { - condition = "template"; - value_template = ''{{ states("${last_state_sensor}") == state }}''; - } - { - condition = "template"; - value_template = "{{ repeat.index <= ${max_repeat}}}"; - } - ]; - }; - } - ]; - } - ]; - } - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/media/schlafzimmer_music_remote.nix b/makefu/2configs/home/ham/media/schlafzimmer_music_remote.nix deleted file mode 100644 index 438ce6bda..000000000 --- a/makefu/2configs/home/ham/media/schlafzimmer_music_remote.nix +++ /dev/null @@ -1,158 +0,0 @@ -{ lib, ... }: -let - remote = "sensor.schlafzimmer_music_remote_action"; - hlib = import ../lib; - step = 0.03; - #room = "bedroom"; - room = "living_room"; - #room = "office"; - - player = "media_player.${room}"; - say = hlib.say."${room}"; - - remote_action = state: actions: { - conditions = ''{{ trigger.to_state.attributes.action == '${state}' }}''; - sequence = actions; - }; - album_list = [ -# Wieso Weshalb Warum Junior -"Doris%20R%c3%bcbel,%20JUMBO%20Neue%20Medien%20%26%20Verlag%20GmbH/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Helfen,%20teilen,%20sich%20vertragen" -"Wieso%3f%20Weshalb%3f%20Warum%3f%20junior/Mein%20Kindergarten" -"Wieso%3f%20Weshalb%3f%20Warum%3f%20junior/Unser%20Werkzeug" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Am%20Meer" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Ampel,%20Stra%c3%9fe%20und%20Verkehr" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Autos%20und%20Laster" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Der%20Bagger" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Der%20Bauernhof" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Der%20Flughafen" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Der%20Pinguin" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Der%20Traktor" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Die%20Baustelle" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Die%20Eisenbahn" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Die%20Feuerwehr" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Die%20Jahreszeiten" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Die%20M%c3%bcllabfuhr" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Die%20Polizei" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Die%20Rettungsfahrzeuge" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Die%20Ritterburg" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Heute,%20morgen,%20jetzt%20und%20gleich" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Im%20Streichelzoo" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20In%20den%20Bergen" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Mama,%20Papa,%20Oma,%20Opa" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Mein%20Hund" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Tanken,%20waschen,%20reparieren" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Tiere%20in%20Afrika" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Unsere%20Tierkinder" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Unterwegs%20mit%20Bus%20und%20Bahn" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Was%20ich%20alles%20kann" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Was%20kriecht%20und%20krabbelt%20da%3f" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Was%20machen%20wir%20an%20Weihnachten%3f" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Was%20machen%20wir%20im%20Fr%c3%bchling%3f" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Was%20machen%20wir%20im%20Herbst%3f" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Was%20machen%20wir%20im%20Sommer%3f" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Was%20machen%20wir%20im%20Winter%3f" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Was%20macht%20der%20Fu%c3%9fballer%3f" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Was%20macht%20der%20Polizist" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Was%20macht%20die%20Prinzessin%3f" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Was%20w%c3%a4chst%20da%3f" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Wenn%20es%20dunkel%20wird" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Wer%20arbeitet%20auf%20der%20Baustelle%3f" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Wir%20feiern%20Geburtstag" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Wir%20gehen%20in%20den%20Zoo" -"Wieso%3f%20Weshalb%3f%20Warum%3f/Wieso%3f%20Weshalb%3f%20Warum%3f%20junior.%20Z%c3%a4hne%20putzen,%20Pipi%20machen" - - ]; - albums = lib.concatMapStringsSep ", " (x: ''"A:ALBUMARTIST/${x}"'') - album_list; -in -{ - services.home-assistant.config.automation = - [ - { alias = "Schlafzimmer music action"; - mode = "queued"; - trigger = [ - { - platform = "state"; - entity_id = remote; - attribute = "action"; - not_to = ""; - } - ]; - action = - [ - { choose = [ - (remote_action "on" - ((say "Starte Essensmusik") ++ [ - { service = "media_player.play_media"; - data = { - media_content_id = "https://listen.openstream.co/4457/audio.mp3"; - media_content_type = "music"; - }; - target.entity_id = player; - } - ])) - (remote_action "off" - [ - { - service = "media_player.media_stop"; - target.entity_id = player; - } - ] - ) - - (remote_action "arrow_right_hold" - ((say "Starte Lass") ++ [ - { service = "media_player.play_media"; - data = { - media_content_id = "http://radio.lassul.us:8000/radio.mp3"; - media_content_type = "music"; - }; - target.entity_id = player; - } - ])) - (remote_action "arrow_left_hold" - ((say "Starte Deep House Music") ++ [ - { service = "media_player.play_media"; - data = { - media_content_id = "http://live.dancemusic.ro:7000/stream.mp3"; - media_content_type = "music"; - }; - target.entity_id = player; - } - ])) - - # TODO: choose random kindermusik? - (remote_action "brightness_move_up" - ((say "Starte Liam Album") ++ [ - { - service = "media_player.play_media"; - target.entity_id = player; - data = { - media_content_id = "{{ [${albums}]|random }}"; - media_content_type = "album"; - }; - } - ]) - ) - #(remote_action "brightness_move_down" - #) - (remote_action "arrow_right_click" { - - service = "media_player.volume_set"; - target.entity_id = player; - data.volume_level = ''{{ state_attr("${player}","volume_level") + (${toString step}|float) }}''; - }) - #(remote_action "brightness_move_down" { - (remote_action "arrow_left_click"{ - service = "media_player.volume_set"; - target.entity_id = player; - data.volume_level = ''{{ state_attr("${player}","volume_level") - (${toString step}|float) }}''; - }) - ]; - #default = { }; - } - ]; - } - ]; - -} diff --git a/makefu/2configs/home/ham/media/sonos.nix b/makefu/2configs/home/ham/media/sonos.nix deleted file mode 100644 index c9cf1a510..000000000 --- a/makefu/2configs/home/ham/media/sonos.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - services.home-assistant.config.sonos.media_player.hosts = [ - "192.168.111.30" - "192.168.111.31" - "192.168.111.32" - ]; -} diff --git a/makefu/2configs/home/ham/mqtt.nix b/makefu/2configs/home/ham/mqtt.nix deleted file mode 100644 index 9c4b4147e..000000000 --- a/makefu/2configs/home/ham/mqtt.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ pkgs, config, ... }: -{ - environment.systemPackages = [ pkgs.mosquitto ]; - # port open via trusted interface - services.mosquitto = { - enable = true; - persistence = false; - settings.max_keepalive = 1060; - listeners = [ - { - port = 1883; - omitPasswordAuth = false; - users.sensor = { - hashedPassword = "$6$2DXU7W1bvqXPqxkF$vtdz5KTd/T09hmoc9LjgEGFjvpwQbQth6vlVcr5hJNLgcBHv4U03YCKC8TKXbmQAa8xiJ76xJIg25kcL+KI3tg=="; - acl = [ "readwrite #" ]; - }; - users.hass = { - hashedPassword = "$6$SHuYGrE5kPSUc/hu$EomZ0KBy+vkxLt/6eJkrSBjYblCCeMjhDfUd2mwqXYJ4XsP8hGmZ59mMlmBCd3AvlFYQxb4DT/j3TYlrqo7cDA=="; - acl = [ "readwrite #" ]; - }; - users.stats = { - hashedPassword = "$6$j4H7KXD/YZgvgNmL$8e9sUKRXowDqJLOVgzCdDrvDE3+4dGgU6AngfAeN/rleGOgaMhee2Mbg2KS5TC1TOW3tYbk9NhjLYtjBgfRkoA=="; - acl = [ "read #" ]; - }; - settings = { - allow_anonymous = false; - }; - } - ]; - }; -} diff --git a/makefu/2configs/home/ham/multi/fliegen-couter.nix b/makefu/2configs/home/ham/multi/fliegen-couter.nix deleted file mode 100644 index 5b8abb2ff..000000000 --- a/makefu/2configs/home/ham/multi/fliegen-couter.nix +++ /dev/null @@ -1,71 +0,0 @@ -# uses: -# sensor.btn1_click -# sensor.btn2_click -let - hlib = import ../lib; - fly_swat = for: btn: method: incr: { - alias = "Increment ${method} for ${for}"; - trigger = { - platform = "state"; - entity_id = "sensor.${btn}_click"; - to = method; - }; - action = builtins.genList (cnt: { - service = "counter.increment"; - data.entity_id = "counter.${for}_fliegen"; - }) incr; - }; -in -{ - services.home-assistant.config = - { - counter = { - felix_fliegen = {}; - misa_fliegen = {}; - }; - automation = [ - (fly_swat "misa" "btn1" "single" 1) - (fly_swat "misa" "btn1" "double" 2) - (fly_swat "misa" "btn1" "triple" 3) - (fly_swat "felix" "btn2" "single" 1) - (fly_swat "felix" "btn2" "double" 2) - (fly_swat "felix" "btn2" "triple" 3) - { - alias = "Send Fly Counter Update"; - trigger = [ - { - platform = "state"; - entity_id = "counter.felix_fliegen"; - } - { - platform = "state"; - entity_id = "counter.misa_fliegen"; - #above = -1; - } - ]; - action = { - service = "mqtt.publish"; - data_template = { # gauge-style - payload = "{{ trigger.to_state.state }}"; - topic = "${hlib.prefix}/flycounter/{{ trigger.to_state.object_id }}"; - }; - }; - } - { - alias = "Reset Fly counters on midnight"; - trigger = { - platform = "time"; - at = "01:00:00"; - }; - action = [ - { service = "counter.reset"; - data.entity_id = "counter.misa_fliegen"; - } - { service = "counter.reset"; - data.entity_id = "counter.felix_fliegen"; - } - ]; - } - ]; - }; -} diff --git a/makefu/2configs/home/ham/multi/flurlicht.nix b/makefu/2configs/home/ham/multi/flurlicht.nix deleted file mode 100644 index 25eb78b7f..000000000 --- a/makefu/2configs/home/ham/multi/flurlicht.nix +++ /dev/null @@ -1,57 +0,0 @@ -# provides: -# light -# automation -# binary_sensor -let - hlib = (import ../lib); - tasmota = hlib.tasmota; -in -{ - binary_sensor = [ - (tasmota.motion { name = "Flur Bewegung"; host = "flurlicht";}) - ]; - light = [ (tasmota.rgb { name = "Flurlicht"; host = "flurlicht";} ) ]; - automation = [ - { alias = "Dunkel bei Sonnenuntergang"; - trigger = { - platform = "sun"; - event = "sunset"; - # offset: "-00:45:00" - }; - action = [ - { - service= "light.turn_on"; - data = { - entity_id= "light.flurlicht"; - # rgb_color = [ 0,0,0 ]; <-- TODO default color - brightness_pct = 15; - }; - } - { - service= "light.turn_off"; - entity_id= "light.flurlicht"; - } - ]; - } - { alias = "Hell bei Sonnenaufgang"; - trigger = { - platform = "sun"; - event = "sunrise"; - # offset: "-00:00:00" - }; - action = [ - { - service= "light.turn_on"; - data = { - entity_id= "light.flurlicht"; - brightness_pct = 85; - }; - } - { - service= "light.turn_off"; - entity_id= "light.flurlicht"; - } - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/multi/heizung.nix b/makefu/2configs/home/ham/multi/heizung.nix deleted file mode 100644 index 73f90dfe0..000000000 --- a/makefu/2configs/home/ham/multi/heizung.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - services.home-assistant.config = - { - # 18 Grad - script.alle_heizungen_aus.sequence = [{ - service = "climate.set_temperature"; - target.entity_id = [ "climate.wohnzimmer_heizung" ]; - data.temperature = "18.0"; - }]; - }; -} diff --git a/makefu/2configs/home/ham/multi/kurzzeitwecker.nix b/makefu/2configs/home/ham/multi/kurzzeitwecker.nix deleted file mode 100644 index 1e6fae90c..000000000 --- a/makefu/2configs/home/ham/multi/kurzzeitwecker.nix +++ /dev/null @@ -1,88 +0,0 @@ -# Provides: -# timer -# automation -# script - -# Needs: -# sensor.zigbee_btn1_click -# notify.signal_home -let - button = "sensor.zigbee_btn2_click"; - notify = "notify.signal_home"; - # für {{ _intent.siteId }} - name of the rhasspy instance: arbeitszimmer -in -{ - services.home-assistant.config = { - automation = []; - timer.kurzzeitwecker = { - name = "Wecker Wohnung"; - }; - timer.wecker_arbeitszimmer = { - name = "Wecker Arbeitszimmer"; - }; - timer.wecker_wohnzimmer = { - name = "Wecker Wohnzimmer"; - }; - intent = {}; - intent_script = { - TimerjobStart = { - speech.text = '' - {% set h = hours|default('0')|string %} - {% set m = minutes|default('0')|string %} - {% if h == "0" %} - Wecker gestellt {{ m }} Minuten - {% elif m == "0" %} - Wecker gestellt {{ h }} Stunden - {% else %} - Wecker gestellt {{ h }} Stunden und {{ m }} Minuten - {% endif %} - ''; - action = [ - { - service = "timer.start"; - - data.entity_id = "timer.kurzzeitwecker"; - data.duration = '' - {% set h = hours|default("0")|int %} - {% set m = minutes|default("0")|int %} - {{ "%02d" | format(h) }}:{{ "%02d" | format(m) }}:00 - ''; - - } - ]; - }; - TimerjobRemaining = { - speech.text = '' - {% set timer = states('timer.kurzzeitwecker') %} - {% if timer == 'idle' %} - Wecker läuft nicht - {% elif timer == 'active' %} - {% set remaining = as_timestamp( state_attr('timer.kurzzeitwecker','finishes_at') )-( as_timestamp(now())) %} - {% set s = ((remaining % 60)) | int %} - {% set m = ((remaining % 3600) / 60) | int %} - {% set h = ((remaining % 86400) / 3600) | int %} - {% if h == 0 %} - Es verbleiben {{ m }} Minuten und {{ s }} Sekunden - {% elif m == 0 %} - Es verbleiben {{ h }} Stunden - {% elif m == 0 and h == 0 %} - Es verbleiben {{ s }} Sekunden - {% else %} - Es verbleiben {{ h }} Stunden {{ m }} Minuten - {% endif %} - {% endif %} - ''; - }; - TimerjobStop = { - speech.text = '' - Wecker gestoppt - ''; - action = [ - { service = "timer.cancel"; - data.entity_id = "timer.kurzzeitwecker"; - } - ]; - }; - }; - }; -} diff --git a/makefu/2configs/home/ham/multi/the_playlist.nix b/makefu/2configs/home/ham/multi/the_playlist.nix deleted file mode 100644 index 0d714ea44..000000000 --- a/makefu/2configs/home/ham/multi/the_playlist.nix +++ /dev/null @@ -1,86 +0,0 @@ -# Inputs: -# binary_sensor.playlist_button_good -# binary_sensor.playlist_button_bad - -# outputs -# rest_command -# automation -# sensor -{ - services.home-assistant.config = - { - rest_command = { - good_song = { - url = "http://prism.r:8001/good"; - method = "POST"; - }; - bad_song = { - url = "http://prism.r:8001/skip"; - method = "POST"; - }; - }; - automation = [ - { - alias = "playlist song publish"; - trigger = { - #platform = "event"; - #event_data.entity_id = "sensor.the_playlist_song"; - platform = "state"; - entity_id = "sensor.the_playlist_song"; - }; - action = { - service = "mqtt.publish"; - data = { - topic = "/ham/the_playlist/song"; - payload_template = "{{ states.sensor.the_playlist_song.state }}"; - }; - }; - } - { - alias = "playlist upvote on button"; - trigger = { - platform = "state"; - entity_id = "binary_sensor.playlist_button_good"; - from = "off"; - to = "on"; - }; - action.service = "rest_command.good_song"; - } - { - alias = "playlist downvote on button"; - trigger = { - platform = "state"; - entity_id = "binary_sensor.playlist_button_bad"; - from = "off"; - to = "on"; - }; - action.service = "rest_command.bad_song"; - } - ]; - sensor = [ - { platform = "rest"; - name = "pl"; - resource = "http://prism.r:8001/current"; - scan_interval = 30; - value_template = "1"; - json_attributes = [ "name" "filename" "youtube" ]; - } - { platform = "template"; - sensors = { - the_playlist_song = { - friendly_name = "Current Song"; - value_template = ''{{ states.sensor.pl.attributes['name'] }}''; - }; - the_playlist_url = { - friendly_name = "Song Youtube URL"; - value_template = ''{{ states.sensor.pl.attributes['youtube'] }}''; - }; - the_playlist_filename = { - friendly_name = "Song Filename"; - value_template = ''{{ states.sensor.pl.attributes['filename'] }}''; - }; - }; - } - ]; - }; -} diff --git a/makefu/2configs/home/ham/nginx.nix b/makefu/2configs/home/ham/nginx.nix deleted file mode 100644 index cd99c0739..000000000 --- a/makefu/2configs/home/ham/nginx.nix +++ /dev/null @@ -1,15 +0,0 @@ -let - internal-ip = "192.168.111.11"; -in { - services.nginx.recommendedProxySettings = true; - services.nginx.virtualHosts."hass" = { - serverAliases = [ "hass.lan" "ha" "ha.lan" ]; - locations."/".proxyPass = "http://localhost:8123"; - locations."/".proxyWebsockets = true; - extraConfig = '' - if ( $server_addr != "${internal-ip}" ) { - return 403; - } - ''; - }; -} diff --git a/makefu/2configs/home/ham/person/default.nix b/makefu/2configs/home/ham/person/default.nix deleted file mode 100644 index a72f610e8..000000000 --- a/makefu/2configs/home/ham/person/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{config, ... }: -{ - services.home-assistant.config.person = [ - { - name = "Felix"; - id = 1; - device_trackers = [ - "device_tracker.felix_phone" - "device_tracker.x" - ]; - } - { - name = "Misa"; - id = 2; - device_trackers = [ - "device_tracker.misa_phone" - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/sensor/dwd.nix b/makefu/2configs/home/ham/sensor/dwd.nix deleted file mode 100644 index 623f099a3..000000000 --- a/makefu/2configs/home/ham/sensor/dwd.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - services.home-assistant.config.sensor = - [ - { platform = "dwd_weather_warnings"; - region_name = "Stadt Stuttgart"; - } - { platform = "nina"; - } - ]; -} diff --git a/makefu/2configs/home/ham/sensor/outside.nix b/makefu/2configs/home/ham/sensor/outside.nix deleted file mode 100644 index 061c4e981..000000000 --- a/makefu/2configs/home/ham/sensor/outside.nix +++ /dev/null @@ -1,55 +0,0 @@ -{lib,...}: - -{ - services.home-assistant.config.sensor = - [ - { platform = "darksky"; - api_key = "!secret darksky"; - language = "de"; - monitored_conditions = [ - "summary" "icon" - "nearest_storm_distance" "precip_probability" - "precip_intensity" - "temperature" # "temperature_high" "temperature_low" - "apparent_temperature" - "hourly_summary" # next 24 hours text - "humidity" - "pressure" - "uv_index" - ]; - units = "si" ; - scan_interval = "00:30:00"; - } - { - platform = "open_meteo"; - } - { - platform = "met"; - } - { - platform = "openweathermap"; - api_key = "!secret openweathermap"; - language = "de"; - mode = "hourly"; - } - { - platform = "tomorrowio"; - api_key = "!secret tomorrowio"; - } - { platform = "octoprint"; } - { platform = "accuweather"; - api_key = "!secret accuweather"; - } - { platform = "scrape"; - resource = "https://www.swr.de/wetter/wetter-liste-swr-100.html"; - name = "SWR Prognose"; - select = "p[data-refresh=\"weather-headline\"]"; - } - { platform = "scrape"; - resource = "https://www.swr.de/wetter/wetter-liste-swr-100.html"; - name = "SWR Prognose Langtext"; - select = "p[data-refresh=\"weather-text\"]"; - } - - ]; -} diff --git a/makefu/2configs/home/ham/sensor/pollen.nix b/makefu/2configs/home/ham/sensor/pollen.nix deleted file mode 100644 index d95c199bf..000000000 --- a/makefu/2configs/home/ham/sensor/pollen.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ pkgs, lib, ... }: -with lib; -let - region = "112"; - types = [ - "Erle" - "Beifuss" - "Ambrosia" - "Birke" - "Esche" - "Hasel" - "Graeser" - "Roggen" - ]; - gen_tomorrow_sensor = type: { - name = "dwd_pollenbelastung_${toLower type}_tomorrow"; - value = { - icon_template = "mdi:grass"; - friendly_name = "${type} Morgen"; - value_template = "{{ state_attr('sensor.dwd_pollenbelastung_${toLower type}', 'tomorrow') }}"; - }; - }; - gen_sensor = type: { - name = "dwd_pollenbelastung_${toLower type}"; - value = { - icon_template = "mdi:tree-outline"; - friendly_name = type; - value_template = '' - {% set dwd_state = state_attr('sensor.dwd_pollenbelastung_stuttgart', '${type}')['today'] %} - {% if dwd_state == "3" %}6{% elif dwd_state == "2-3"%}5{% elif dwd_state == "2"%}4{% elif dwd_state == "1-2"%}3{% elif dwd_state == "1"%}2{% elif dwd_state == "0-1"%}1{% else %}0{% endif %} - ''; - attribute_templates.today = '' - {% set dwd_state = state_attr('sensor.dwd_pollenbelastung_stuttgart', '${type}')['today'] %} - {% if dwd_state == "3" %}6{% elif dwd_state == "2-3"%}5{% elif dwd_state == "2"%}4{% elif dwd_state == "1-2"%}3{% elif dwd_state == "1"%}2{% elif dwd_state == "0-1"%}1{% else %}0{% endif %} - ''; - attribute_templates.tomorrow = '' - {% set dwd_state = state_attr('sensor.dwd_pollenbelastung_stuttgart', '${type}')['tomorrow'] %} - {% if dwd_state == "3" %}6{% elif dwd_state == "2-3"%}5{% elif dwd_state == "2"%}4{% elif dwd_state == "1-2"%}3{% elif dwd_state == "1"%}2{% elif dwd_state == "0-1"%}1{% else %}0{% endif %} - ''; - # -1 == unknown - #attribute_templates.dayafter = '' - # {% set dwd_state = state_attr('sensor.dwd_pollenbelastung', '${type}')['dayafter_to'] %} - # {% if dwd_state == "3" %}6{% elif dwd_state == "2-3"%}5{% elif dwd_state == "2"%}4{% elif dwd_state == "1-2"%}3{% elif dwd_state == "1"%}2{% elif dwd_state == "0-1"%}1{% elif dwd_state == "-1"%}-1{% else %}0{% endif %} - #''; - }; - }; -in - { - services.home-assistant.config.sensor = [ - { - platform = "rest"; - scan_interval = 3600; - name = "DWD Pollenbelastung Stuttgart"; - resource = "https://opendata.dwd.de/climate_environment/health/alerts/s31fg.json"; - json_attributes_path = "$..content[?(@.partregion_id==${region})].Pollen"; - json_attributes = types; - value_template = "{{ value_json.last_update }}"; - } - { - platform = "template"; - sensors = (listToAttrs (map gen_sensor types)) // - (listToAttrs (map gen_tomorrow_sensor types)) ; - } - ]; -} diff --git a/makefu/2configs/home/ham/signal-rest/default.nix b/makefu/2configs/home/ham/signal-rest/default.nix deleted file mode 100644 index 4eac41ba8..000000000 --- a/makefu/2configs/home/ham/signal-rest/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - imports = [ - ./service.nix - ./hass.nix - ]; -} diff --git a/makefu/2configs/home/ham/signal-rest/hass.nix b/makefu/2configs/home/ham/signal-rest/hass.nix deleted file mode 100644 index 284be3320..000000000 --- a/makefu/2configs/home/ham/signal-rest/hass.nix +++ /dev/null @@ -1,20 +0,0 @@ -let - inherit (import <secrets/signal/messenger.nix>) number home felix; -in { - services.home-assistant.config.notify = [ - { - name = "signal_home"; - platform = "signal_messenger"; - url = "http://127.0.0.1:8631"; - inherit number ; - recipients = [ home ]; - } - { - name = "signal_felix"; - platform = "signal_messenger"; - url = "http://127.0.0.1:8631"; - inherit number; - recipients = [ felix ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/signal-rest/pkg.nix b/makefu/2configs/home/ham/signal-rest/pkg.nix deleted file mode 100644 index 165d642af..000000000 --- a/makefu/2configs/home/ham/signal-rest/pkg.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ lib -, buildPythonPackage -, fetchPypi -}: - -buildPythonPackage rec { - pname = "pysignalclirestapi"; - version = "0.3.14"; - - # disabled = ; # requires python version >=2.7 - - src = fetchPypi { - inherit pname version; - sha256 = "6f3626b594a53c4161dfc67ea7a3b23d62c8fe8cb404a909496118aeefa79cd0"; - }; - - doCheck = false; - - meta = with lib; { - description = "Small python library for the Signal Cli REST API"; - homepage = https://github.com/bbernhard/pysignalclirestapi; - #license = licenses.; - # maintainers = [ maintainers. ]; - }; -} diff --git a/makefu/2configs/home/ham/signal-rest/service.nix b/makefu/2configs/home/ham/signal-rest/service.nix deleted file mode 100644 index 1f718efa5..000000000 --- a/makefu/2configs/home/ham/signal-rest/service.nix +++ /dev/null @@ -1,20 +0,0 @@ - -let - port = 8631; - image = "bbernhard/signal-cli-rest-api:latest"; - config = "/var/lib/signal-cli-config"; -in { - systemd.tmpfiles.rules = [ - "d ${config} docker docker - -" - ]; - state = [ config ]; - virtualisation.oci-containers.containers.signal-rest = { - image = image; - ports = [ "127.0.0.1:${toString port}:8080" ]; - volumes = [ - "${config}:/home/.local/share/signal-cli" - ]; - environment.MODE ="json-rpc"; - #environment.MODE ="native"; # only required for reigstration - }; -} diff --git a/makefu/2configs/home/ham/tts/google.nix b/makefu/2configs/home/ham/tts/google.nix deleted file mode 100644 index d2f7a55cc..000000000 --- a/makefu/2configs/home/ham/tts/google.nix +++ /dev/null @@ -1,18 +0,0 @@ - -let -in { - services.home-assistant.config.tts = [ - { platform = "google_translate"; - language = "de"; - time_memory = 57600; - service_name = "google_say"; - } - #{ platform = "google_cloud"; - # key_file = toString <secrets/googlecloud.json>; - # service_name = "cloud_say"; - # language = "de-DE"; - # voice = "de-DE-Wavenet-B"; - # profiles = [ "medium-bluetooth-speaker-class-device" ]; - #} - ]; -} diff --git a/makefu/2configs/home/ham/zigbee2mqtt.nix b/makefu/2configs/home/ham/zigbee2mqtt.nix deleted file mode 100644 index efcbb0d00..000000000 --- a/makefu/2configs/home/ham/zigbee2mqtt.nix +++ /dev/null @@ -1,43 +0,0 @@ -# provides: -# switch -# automation -# binary_sensor -# sensor -# input_select -# timer -let - inherit (import ./lib) zigbee; - prefix = zigbee.prefix; -in -{ - services.home-assistant.config = { - sensor = - - [ - # Sensor for monitoring the bridge state - { - platform = "mqtt"; - name = "Zigbee2mqtt Bridge state"; - state_topic = "${prefix}/bridge/state"; - icon = "mdi:router-wireless"; - } - # Sensor for Showing the Zigbee2mqtt Version - { - platform = "mqtt"; - name = "Zigbee2mqtt Version"; - state_topic = "${prefix}/bridge/config"; - value_template = "{{ value_json.version }}"; - icon = "mdi:zigbee"; - } - # Sensor for Showing the Coordinator Version - { - platform = "mqtt"; - name = "Coordinator Version"; - state_topic = "${prefix}/bridge/config"; - value_template = "{{ value_json.coordinator }}"; - icon = "mdi:chip"; - } - ]; - - }; -} diff --git a/makefu/2configs/home/jellyfin.nix b/makefu/2configs/home/jellyfin.nix deleted file mode 100644 index e613a05fc..000000000 --- a/makefu/2configs/home/jellyfin.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ lib, config, ... }: -let - port = 8096; -in -{ - services.jellyfin.enable = true; - # services.jellyfin.openFirewall = true; - networking.firewall.interfaces.wiregrill = { - allowedTCPPorts = [ 80 port 8920 ]; - allowedUDPPorts = [ 1900 7359 ]; - }; - state = [ "/var/lib/jellyfin" ]; - users.users.${config.services.jellyfin.user}.extraGroups = [ "download" "video" "render" ]; - - systemd.services.jellyfin = { - after = [ "media-cloud.mount" ]; - serviceConfig = rec { - RequiresMountFor = [ "/media/cloud" ]; - SupplementaryGroups = lib.mkForce [ "video" "render" "download" ]; - UMask = lib.mkForce "0077"; - }; - }; - services.nginx.virtualHosts."jelly" = { - serverAliases = [ - "jelly.lan" "movies.lan" - "jelly.makefu.w" "makefu.omo.w" - ]; - - locations."/" = { - proxyPass = "http://localhost:${toString port}"; - proxyWebsockets = true; - }; - }; -} diff --git a/makefu/2configs/home/metube.nix b/makefu/2configs/home/metube.nix deleted file mode 100644 index e6008d475..000000000 --- a/makefu/2configs/home/metube.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ pkgs, lib, ...}: -# docker run -d -p 8081:8081 -v /path/to/downloads:/downloads --user 1001:1001 alexta69/metube -with import <stockholm/lib>; -let - port = "2348"; - dl-dir = "/media/cryptX/youtube/music"; - uid = 20421; - internal-ip = "192.168.111.11"; -in - { - systemd.tmpfiles.rules = [ - "d ${dl-dir} metube nogroup - -" - ]; - virtualisation.oci-containers.backend = "docker"; - - services.nginx.virtualHosts."tube" = { - serverAliases = [ "tube.lan" ]; - locations."/".proxyPass = "http://localhost:${port}"; - }; - - virtualisation.oci-containers.containers.metube = { - image = "alexta69/metube:latest"; - ports = [ "${port}:8081" ]; - volumes = [ - "${dl-dir}:/downloads" - ]; - user = "metube"; - }; - users.users.metube = { - uid = uid; - isSystemUser = true; - }; - - systemd.services.docker-metube.serviceConfig = { - StandardOutput = lib.mkForce "journal"; - StandardError = lib.mkForce "journal"; - }; -} diff --git a/makefu/2configs/home/music.nix b/makefu/2configs/home/music.nix deleted file mode 100644 index b32af6207..000000000 --- a/makefu/2configs/home/music.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ config, ... }: -let - internal-ip = "192.168.111.11"; - port = 4533; -in -{ - services.navidrome.enable = true; - services.navidrome.settings = { - MusicFolder = "/media/cryptX/music/kinder"; - Address = "0.0.0.0"; - }; - systemd.services.navidrome.serviceConfig.RequiresMountFor = [ "/media/cryptX" ]; - - state = [ "/var/lib/navidrome" ]; - # networking.firewall.allowedTCPPorts = [ 4040 ]; - # state = [ config.services.airsonic.home ]; - services.nginx.virtualHosts."navidrome" = { - serverAliases = [ - "navidrome.lan" - "music" "music.lan" - "musik" "musik.lan" - "music.omo.r" - "music.makefu.r" "music.makefu" - ]; - - locations."/".proxyPass = "http://localhost:${toString port}"; - locations."/".proxyWebsockets = true; - }; - networking.firewall.allowedTCPPorts = [ port ]; - # also configure dlna - services.minidlna.enable = true; - services.minidlna.settings = { - inotify = "yes"; - friendly_name = "omo"; - media_dir = [ "A,/media/cryptX/music" ]; - }; -} diff --git a/makefu/2configs/home/photoprism.nix b/makefu/2configs/home/photoprism.nix deleted file mode 100644 index 2f8a86430..000000000 --- a/makefu/2configs/home/photoprism.nix +++ /dev/null @@ -1,150 +0,0 @@ -{ pkgs, lib, ...}: -# Start | docker-compose up -d -# Stop | docker-compose stop -# Update | docker-compose pull -# Logs | docker-compose logs --tail=25 -f -# Terminal | docker-compose exec photoprism bash -# Help | docker-compose exec photoprism photoprism help -# Config | docker-compose exec photoprism photoprism config -# Reset | docker-compose exec photoprism photoprism reset -# Backup | docker-compose exec photoprism photoprism backup -a -i -# Restore | docker-compose exec photoprism photoprism restore -a -i -# Index | docker-compose exec photoprism photoprism index -# Reindex | docker-compose exec photoprism photoprism index -a -# Import | docker-compose exec photoprism photoprism import -# ------------------------------------------------------------------- -let - port = "2347"; - photodir = "/media/cryptX/photos"; - statedir = "/media/cryptX/lib/photoprism/appsrv"; - db-dir = "/media/cryptX/lib/photoprism/mysql"; - internal-ip = "192.168.111.11"; - sec = import <secrets/photoprism.nix>; -in -{ - virtualisation.oci-containers.backend = "docker"; - - services.nginx.virtualHosts."photos" = { - serverAliases = [ - "photos.lan" - "foto" "foto.lan" - "fotos" "fotos.lan" - ]; - - locations."/".proxyPass = "http://localhost:${port}"; - locations."/".proxyWebsockets = true; - extraConfig = '' - if ( $server_addr != "${internal-ip}" ) { - return 403; - } - ''; - }; - - systemd.services.workadventure-network = { - enable = true; - wantedBy = [ "multi-user.target" ]; - script = '' - ${pkgs.docker}/bin/docker network create --driver bridge photoprism ||: - ''; - after = [ "docker.service" ]; - before = [ - "docker-photoprism.service" - "docker-mysql-photoprism.service" - ]; - }; - - - virtualisation.oci-containers.containers.photoprism = { - image = "photoprism/photoprism:preview"; - ports = ["${port}:${port}" ]; - volumes = [ - "${photodir}:/photoprism/originals" - "${statedir}:/photoprism/storage" - ]; - extraOptions = [ - "--security-opt" "seccomp=unconfined" - "--security-opt" "apparmor=unconfined" - "--network=photoprism" - ]; - environment = { - PHOTOPRISM_HTTP_PORT = port; # Built-in Web server port - PHOTOPRISM_HTTP_COMPRESSION = "gzip"; # Improves transfer speed and bandwidth utilization (none or gzip) - PHOTOPRISM_DEBUG = "false"; # Run in debug mode (shows additional log messages) - # PHOTOPRISM_PUBLIC = "true"; # No authentication required (disables password protection) - PHOTOPRISM_READONLY = "false"; # Don't modify originals directory (reduced functionality) - PHOTOPRISM_EXPERIMENTAL = "true"; # Enables experimental features - # PHOTOPRISM_DISABLE_WEBDAV = "false"; # Disables built-in WebDAV server - PHOTOPRISM_DISABLE_SETTINGS = "false"; # Disables Settings in Web UI - PHOTOPRISM_DISABLE_TENSORFLOW = "false"; # Disables using TensorFlow for image classification - PHOTOPRISM_DARKTABLE_PRESETS = "false"; # Enables Darktable presets and disables concurrent RAW conversion - PHOTOPRISM_DETECT_NSFW = "false"; # Flag photos as private that MAY be offensive (requires TensorFlow) - PHOTOPRISM_UPLOAD_NSFW = "true"; # Allow uploads that MAY be offensive - PHOTOPRISM_AUTH_MODE = "password"; - PHOTOPRISM_ADMIN_USER = "admin"; - PHOTOPRISM_ADMIN_PASSWORD = "admin"; - - #PHOTOPRISM_DATABASE_DRIVER = "postgres"; - #PHOTOPRISM_DATABASE_SERVER = "postgres-prism:5432"; - #PHOTOPRISM_DATABASE_NAME = "photoprism"; - #PHOTOPRISM_DATABASE_USER = "photoprism"; - #PHOTOPRISM_DATABASE_PASSWORD = "photoprism"; - - PHOTOPRISM_DATABASE_DRIVER= "mysql"; # Use MariaDB (or MySQL) instead of SQLite for improved performance - PHOTOPRISM_DATABASE_SERVER= "mysql-photoprism:3306" ; # MariaDB database server (hostname:port) - PHOTOPRISM_DATABASE_NAME= "photoprism"; # MariaDB database schema name - PHOTOPRISM_DATABASE_USER= sec.db.username; # MariaDB database user name - PHOTOPRISM_DATABASE_PASSWORD= sec.db.password; # MariaDB database user password - - PHOTOPRISM_SITE_URL = "http://localhost:2342/"; # Public PhotoPrism URL - PHOTOPRISM_SITE_TITLE = "PhotoPrism"; - PHOTOPRISM_SITE_CAPTION = "FeMi Fotos"; - PHOTOPRISM_SITE_DESCRIPTION = "Unsere Fotos"; - PHOTOPRISM_SITE_AUTHOR = "FeMi"; - PHOTOPRISM_SPONSOR = "true"; - - }; - }; - - virtualisation.oci-containers.containers.mysql-photoprism = { - image = "mariadb:10.5"; - extraOptions = [ - "--security-opt" "seccomp=unconfined" - "--security-opt" "apparmor=unconfined" - "--network=photoprism" - ]; - ports = [ "3306:3306" ]; # no need to expose the database - #cmd = [ "mysqld" - # "--transaction-isolation=READ-COMMITTED" - # "--character-set-server=utf8mb4" - # "--collation-server=utf8mb4_unicode_ci" - # "--max-connections=512" - # "--innodb-rollback-on-timeout=OFF" - # "--innodb-lock-wait-timeout=50" - #]; - volumes= [ "${db-dir}:/var/lib/mysql" ]; - environment = { - MYSQL_ROOT_PASSWORD = "dickidibutt"; - MYSQL_DATABASE= "photoprism"; - MYSQL_USER = sec.db.username; - MYSQL_PASSWORD = sec.db.password; - }; - }; - #virtualisation.oci-containers.containers.postgres-prism = { - # image = "postgres:12-alpine"; - # ports = [ "5432" ]; # no need to expose the database - # environment = { - # POSTGRES_DB = "photoprism"; - # POSTGRES_USER = "photoprism"; - # POSTGRES_PASSWORD = "photoprism"; - # }; - #}; - - systemd.services.docker-photoprism.serviceConfig = { - StandardOutput = lib.mkForce "journal"; - StandardError = lib.mkForce "journal"; - }; - systemd.services.docker-mysql-photoprism.serviceConfig = { - StandardOutput = lib.mkForce "journal"; - StandardError = lib.mkForce "journal"; - }; -} diff --git a/makefu/2configs/home/ps4srv.nix b/makefu/2configs/home/ps4srv.nix deleted file mode 100644 index cb1864fae..000000000 --- a/makefu/2configs/home/ps4srv.nix +++ /dev/null @@ -1,17 +0,0 @@ -let - internal-ip = "192.168.111.11"; -in -{ - services.nginx.virtualHosts."ps4srv" = { - serverAliases = [ - "ps4srv.lan" - ]; - - locations."/".root = "/media/cryptX/emu/ps4"; - extraConfig = '' - if ( $server_addr != "${internal-ip}" ) { - return 403; - } - ''; - }; -} diff --git a/makefu/2configs/home/rhasspy/default.nix b/makefu/2configs/home/rhasspy/default.nix deleted file mode 100644 index e3a0bcd28..000000000 --- a/makefu/2configs/home/rhasspy/default.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ lib,config, ... }: -# uses alsa instead of pulseaduio server -let - profiles = "/var/lib/rhasspy"; -in -{ - systemd.services.docker-rhasspy.after = [ "network-online.target" ]; - - virtualisation.oci-containers.containers.rhasspy = { - image = "rhasspy/rhasspy:latest"; - - environment = { - TZ = "Europe/Berlin"; - PULSE_SERVER = "tcp:${ config.krebs.build.host.name }:4713"; - }; - - ports = [ - "12101:12101" - ]; - - volumes = [ - "/etc/localtime:/etc/localtime:ro" - "${profiles}:/profiles" - ]; - - cmd = [ "--user-profiles" "/profiles" "--profile" "de" ]; - extraOptions = [ - "--device=/dev/snd:/dev/snd" - "--group-add=audio" - ]; - }; - systemd.tmpfiles.rules = [ - "d ${profiles} 0770 root root - -" - ]; - - # required to allow rhasspy to connect to pulse server - # hardware.pulseaudio.enable = lib.mkForce false; - networking.firewall.allowedTCPPorts = [ 4713 ]; - -} diff --git a/makefu/2configs/home/rhasspy/led-control.nix b/makefu/2configs/home/rhasspy/led-control.nix deleted file mode 100644 index b4efe028a..000000000 --- a/makefu/2configs/home/rhasspy/led-control.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ pkgs, ... }: -let - cfg = pkgs.writeText "hcl-config.json" (builtins.toJSON { - engine = "rhasspy"; - pathToConfig = "/var/lib/rhasspy/de/profile.json"; - hardware = "respeaker4MicArray"; - pattern = "fake-name"; - enableDoA = false; - }); -in { - systemd.services.HermesLedControl = { - description = "Led Server for ReSpeaker 4-array"; - after = [ "network-online.target" "docker-rhasspy.service" ] ; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - # User = "nobody"; # need a user with permissions to run nix-shell - ExecStart = "${pkgs.HermesLedControl}/bin/HermesLedControl --hermesLedControlConfig=${toString cfg}"; - Restart = "always"; - RestartSec = 10; - PrivateTmp = true; - }; - }; -} diff --git a/makefu/2configs/home/tonie.nix b/makefu/2configs/home/tonie.nix deleted file mode 100644 index bc3633a88..000000000 --- a/makefu/2configs/home/tonie.nix +++ /dev/null @@ -1,68 +0,0 @@ -{ config, pkgs, lib, ... }: -let - backend_port = 30005; - #host = config.networking.hostName; - ident = 998; - user = "${toString ident}:${toString ident}"; - backend_host = "tonie.lan"; - #backend_host = "tonie.omo.r"; - frontend_port = 30006; - homedir = "/var/lib/tonies"; - albumdir = "${homedir}/albumart/"; - vueconfig = pkgs.writeText "vueconfig" '' - module.exports = { - devServer: { - disableHostCheck: true - }, - } - ''; - audiobookdir = "/media/cryptX/music/kinder_hoerspiele"; - # TONIE_AUDIO_MATCH_USER = username; - # TONIE_AUDIO_MATCH_PASS = password; - tonie-env = toString <secrets/tonie.env>; -in - { - systemd.tmpfiles.rules = [ - "d ${albumdir} 1750 toniebox toniebox -" - ]; - networking.firewall.allowedTCPPorts = [ frontend_port backend_port ]; - virtualisation.oci-containers.containers.toniebox-front = { - image = "makefoo/toniebox-audio-match_front:1.0.1"; - inherit user; - environment = { - VUE_APP_BACKEND_IS_LOCAL = "true"; - }; - ports = [ "${toString frontend_port}:8080" ]; - volumes = [ - "${albumdir}:/frontend/public/assets/covers" - "${vueconfig}:/frontend/vue.config.js" - ]; - }; - - users.users.toniebox = { - isSystemUser = true; - uid = ident; - home = homedir; - createHome = true; - group = "toniebox"; - }; - users.groups.toniebox.gid = ident; - - virtualisation.oci-containers.containers.toniebox-back = { - image = "makefoo/toniebox-audio-match_back:1.0.0"; - inherit user; - environmentFiles = [ tonie-env ]; - ports = [ "${toString backend_port}:5000" ]; - volumes = [ - "${albumdir}:/backend/assets/covers" - "${audiobookdir}:/backend/assets/audiobooks" - ]; - }; - services.nginx.virtualHosts."tonie" = { - serverAliases = [ "tonie.lan" "tonie.omo.r" backend_host ]; - locations."/".proxyPass = "http://localhost:${toString frontend_port}"; - locations."/upload".proxyPass = "http://localhost:${toString backend_port}"; - locations."/creativetonies".proxyPass = "http://localhost:${toString backend_port}"; - locations."/audiobooks".proxyPass = "http://localhost:${toString backend_port}"; - }; -} diff --git a/makefu/2configs/home/zigbee2mqtt/default.nix b/makefu/2configs/home/zigbee2mqtt/default.nix deleted file mode 100644 index 8bb8a929b..000000000 --- a/makefu/2configs/home/zigbee2mqtt/default.nix +++ /dev/null @@ -1,94 +0,0 @@ -{config, pkgs, lib, ...}: - -let - dataDir = "/var/lib/zigbee2mqtt"; - sec = import <secrets/zigbee2mqtt.nix>; - internal-ip = "192.168.111.11"; - webport = 8521; -in - { - # symlink the zigbee controller - #services.udev.extraRules = '' - # SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dialout" - #''; - - # /dev/serial/by-id/usb-Silicon_Labs_slae.sh_cc2652rb_stick_-_slaesh_s_iot_stuff_00_12_4B_00_21_CC_45_BD-if00-port0 - services.udev.extraRules = '' - SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="cc2531", MODE="0660", GROUP="dialout" - ''; - - services.zigbee2mqtt = { - enable = true; - inherit dataDir; - settings = { - permit_join = true; - serial.port = "/dev/cc2531"; - homeassistant = true; - mqtt = { - server = "mqtt://omo.lan:1883"; - base_topic = "/ham/zigbee"; - user = sec.mqtt.username; - password = sec.mqtt.password; - include_device_information = true; - client_id = "zigbee2mqtt"; - }; - availability = { - active.timeout = 10; - passive.timeout = 1500; - }; - frontend = { - port = webport; - }; - advanced = { - log_level = "debug"; - log_output = [ "console" ]; - last_seen = "ISO_8601"; - elapsed = true; - pan_id = 6755; - inherit (sec.zigbee) network_key; - }; - map_options.graphviz.colors = { - fill = { - enddevice = "#fff8ce" ; - coordinator = "#e04e5d"; - router = "#4ea3e0"; - }; - font = { - coordinator= "#ffffff"; - router = "#ffffff"; - enddevice = "#000000"; - }; - line = { - active = "#009900"; - inactive = "#994444"; - }; - }; - }; - }; - - services.nginx.recommendedProxySettings = true; - services.nginx.virtualHosts."zigbee" = { - serverAliases = [ "zigbee.lan" ]; - locations."/".proxyPass = "http://localhost:${toString webport}"; - locations."/api".proxyPass = "http://localhost:${toString webport}"; - locations."/api".proxyWebsockets = true; - extraConfig = '' - if ( $server_addr != "${internal-ip}" ) { - return 403; - } - ''; - }; - - state = [ "${dataDir}/devices.yaml" "${dataDir}/state.json" ]; - - systemd.services.zigbee2mqtt = { - # override automatic configuration.yaml deployment - environment.ZIGBEE2MQTT_DATA = dataDir; - #serviceConfig.ExecStartPre = lib.mkForce "${pkgs.coreutils}/bin/true"; - after = [ - "home-assistant.service" - "mosquitto.service" - "network-online.target" - ]; - }; -} diff --git a/makefu/2configs/home/zigbee2mqtt/osram.nix b/makefu/2configs/home/zigbee2mqtt/osram.nix deleted file mode 100644 index d1bf2b296..000000000 --- a/makefu/2configs/home/zigbee2mqtt/osram.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - - -availability_topic: /ham/zigbee/bridge/state -command_topic: /ham/zigbee/flur_arbeitszimmer_osram2/set - - - platform: "mqtt" - state_topic: "zigbee2mqtt/<FRIENDLY_NAME>" - availability_topic: "zigbee2mqtt/bridge/state" - payload_on: true - payload_off: false - value_template: "{{ value_json.battery_low}}" - device_class: "battery" -} |