From 060a8f28fa1fc648bdf66afb31a5d1efac868837 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 28 Jul 2023 22:24:15 +0200 Subject: makefu: move out to own repo, add vacation-note --- .../2configs/home/ham/automation/buttonboard.nix | 4 - makefu/2configs/home/ham/automation/bye.txt.j2 | 2 - makefu/2configs/home/ham/automation/check-in.nix | 133 --------- .../home/ham/automation/daily_speedtext.nix | 17 -- .../2configs/home/ham/automation/fenster_auf.nix | 138 ---------- makefu/2configs/home/ham/automation/find_phone.nix | 32 --- .../home/ham/automation/firetv_restart.nix | 37 --- makefu/2configs/home/ham/automation/flurlicht.nix | 63 ----- makefu/2configs/home/ham/automation/giesskanne.nix | 99 ------- .../home/ham/automation/ladestecker_timer.nix | 24 -- .../home/ham/automation/lichter_dimmen.nix | 135 ---------- .../2configs/home/ham/automation/light_buttons.nix | 69 ----- makefu/2configs/home/ham/automation/moodlight.nix | 46 ---- .../ham/automation/pflanzen_giessen_erinnerung.nix | 43 --- .../home/ham/automation/project_tracker.nix | 68 ----- .../home/ham/automation/shutdown_button.nix | 56 ---- makefu/2configs/home/ham/automation/urlaub.nix | 51 ---- makefu/2configs/home/ham/automation/welcome.txt.j2 | 45 ---- .../ham/automation/wohnzimmer_rf_fernbedienung.nix | 151 ----------- makefu/2configs/home/ham/calendar/nextcloud.nix | 41 --- makefu/2configs/home/ham/default.nix | 205 -------------- makefu/2configs/home/ham/deps/dwdwfsapi.nix | 38 --- makefu/2configs/home/ham/deps/pykodi.nix | 37 --- .../2configs/home/ham/device_tracker/openwrt.nix | 13 - makefu/2configs/home/ham/device_tracker/tile.nix | 10 - makefu/2configs/home/ham/docker.nix | 30 --- makefu/2configs/home/ham/intents/default.nix | 35 --- .../2configs/home/ham/intents/music_chooser.txt.j2 | 13 - .../2configs/home/ham/intents/statusbericht.txt.j2 | 37 --- makefu/2configs/home/ham/lib/cheat-sheet.nix | 42 --- makefu/2configs/home/ham/lib/default.nix | 134 --------- makefu/2configs/home/ham/light/arbeitszimmer.nix | 33 --- makefu/2configs/home/ham/light/schlafzimmer.nix | 14 - .../2configs/home/ham/light/tint_arbeitszimmer.nix | 281 ------------------- makefu/2configs/home/ham/light/tint_wohnzimmer.nix | 300 --------------------- makefu/2configs/home/ham/light/wohnzimmer.nix | 56 ---- .../home/ham/media/arbeitszimmer_matrix.nix | 110 -------- makefu/2configs/home/ham/media/firetv.nix | 27 -- .../home/ham/media/remote_sound_arbeitszimmer.nix | 112 -------- .../home/ham/media/remote_sound_wohnzimmer.nix | 107 -------- .../home/ham/media/schlafzimmer_music_remote.nix | 158 ----------- makefu/2configs/home/ham/media/sonos.nix | 7 - makefu/2configs/home/ham/mqtt.nix | 31 --- makefu/2configs/home/ham/multi/fliegen-couter.nix | 71 ----- makefu/2configs/home/ham/multi/flurlicht.nix | 57 ---- makefu/2configs/home/ham/multi/heizung.nix | 11 - makefu/2configs/home/ham/multi/kurzzeitwecker.nix | 88 ------ makefu/2configs/home/ham/multi/the_playlist.nix | 86 ------ makefu/2configs/home/ham/nginx.nix | 15 -- makefu/2configs/home/ham/person/default.nix | 20 -- makefu/2configs/home/ham/sensor/dwd.nix | 10 - makefu/2configs/home/ham/sensor/outside.nix | 55 ---- makefu/2configs/home/ham/sensor/pollen.nix | 65 ----- makefu/2configs/home/ham/signal-rest/default.nix | 6 - makefu/2configs/home/ham/signal-rest/hass.nix | 20 -- makefu/2configs/home/ham/signal-rest/pkg.nix | 25 -- makefu/2configs/home/ham/signal-rest/service.nix | 20 -- makefu/2configs/home/ham/tts/google.nix | 18 -- makefu/2configs/home/ham/zigbee2mqtt.nix | 43 --- 59 files changed, 3694 deletions(-) delete mode 100644 makefu/2configs/home/ham/automation/buttonboard.nix delete mode 100644 makefu/2configs/home/ham/automation/bye.txt.j2 delete mode 100644 makefu/2configs/home/ham/automation/check-in.nix delete mode 100644 makefu/2configs/home/ham/automation/daily_speedtext.nix delete mode 100644 makefu/2configs/home/ham/automation/fenster_auf.nix delete mode 100644 makefu/2configs/home/ham/automation/find_phone.nix delete mode 100644 makefu/2configs/home/ham/automation/firetv_restart.nix delete mode 100644 makefu/2configs/home/ham/automation/flurlicht.nix delete mode 100644 makefu/2configs/home/ham/automation/giesskanne.nix delete mode 100644 makefu/2configs/home/ham/automation/ladestecker_timer.nix delete mode 100644 makefu/2configs/home/ham/automation/lichter_dimmen.nix delete mode 100644 makefu/2configs/home/ham/automation/light_buttons.nix delete mode 100644 makefu/2configs/home/ham/automation/moodlight.nix delete mode 100644 makefu/2configs/home/ham/automation/pflanzen_giessen_erinnerung.nix delete mode 100644 makefu/2configs/home/ham/automation/project_tracker.nix delete mode 100644 makefu/2configs/home/ham/automation/shutdown_button.nix delete mode 100644 makefu/2configs/home/ham/automation/urlaub.nix delete mode 100644 makefu/2configs/home/ham/automation/welcome.txt.j2 delete mode 100644 makefu/2configs/home/ham/automation/wohnzimmer_rf_fernbedienung.nix delete mode 100644 makefu/2configs/home/ham/calendar/nextcloud.nix delete mode 100644 makefu/2configs/home/ham/default.nix delete mode 100644 makefu/2configs/home/ham/deps/dwdwfsapi.nix delete mode 100644 makefu/2configs/home/ham/deps/pykodi.nix delete mode 100644 makefu/2configs/home/ham/device_tracker/openwrt.nix delete mode 100644 makefu/2configs/home/ham/device_tracker/tile.nix delete mode 100644 makefu/2configs/home/ham/docker.nix delete mode 100644 makefu/2configs/home/ham/intents/default.nix delete mode 100644 makefu/2configs/home/ham/intents/music_chooser.txt.j2 delete mode 100644 makefu/2configs/home/ham/intents/statusbericht.txt.j2 delete mode 100644 makefu/2configs/home/ham/lib/cheat-sheet.nix delete mode 100644 makefu/2configs/home/ham/lib/default.nix delete mode 100644 makefu/2configs/home/ham/light/arbeitszimmer.nix delete mode 100644 makefu/2configs/home/ham/light/schlafzimmer.nix delete mode 100644 makefu/2configs/home/ham/light/tint_arbeitszimmer.nix delete mode 100644 makefu/2configs/home/ham/light/tint_wohnzimmer.nix delete mode 100644 makefu/2configs/home/ham/light/wohnzimmer.nix delete mode 100644 makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix delete mode 100644 makefu/2configs/home/ham/media/firetv.nix delete mode 100644 makefu/2configs/home/ham/media/remote_sound_arbeitszimmer.nix delete mode 100644 makefu/2configs/home/ham/media/remote_sound_wohnzimmer.nix delete mode 100644 makefu/2configs/home/ham/media/schlafzimmer_music_remote.nix delete mode 100644 makefu/2configs/home/ham/media/sonos.nix delete mode 100644 makefu/2configs/home/ham/mqtt.nix delete mode 100644 makefu/2configs/home/ham/multi/fliegen-couter.nix delete mode 100644 makefu/2configs/home/ham/multi/flurlicht.nix delete mode 100644 makefu/2configs/home/ham/multi/heizung.nix delete mode 100644 makefu/2configs/home/ham/multi/kurzzeitwecker.nix delete mode 100644 makefu/2configs/home/ham/multi/the_playlist.nix delete mode 100644 makefu/2configs/home/ham/nginx.nix delete mode 100644 makefu/2configs/home/ham/person/default.nix delete mode 100644 makefu/2configs/home/ham/sensor/dwd.nix delete mode 100644 makefu/2configs/home/ham/sensor/outside.nix delete mode 100644 makefu/2configs/home/ham/sensor/pollen.nix delete mode 100644 makefu/2configs/home/ham/signal-rest/default.nix delete mode 100644 makefu/2configs/home/ham/signal-rest/hass.nix delete mode 100644 makefu/2configs/home/ham/signal-rest/pkg.nix delete mode 100644 makefu/2configs/home/ham/signal-rest/service.nix delete mode 100644 makefu/2configs/home/ham/tts/google.nix delete mode 100644 makefu/2configs/home/ham/zigbee2mqtt.nix (limited to 'makefu/2configs/home/ham') 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 ; -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/getUpdates - # # } - # (builtins.fromJSON - # (builtins.readFile )) - #]; - notify = [ - #{ - # platform = "telegram"; - # name = "telegrambot"; - # chat_id = builtins.elemAt - # (builtins.fromJSON (builtins.readFile - # )).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 ); - 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 + "/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/...//" - # 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/...//" - # 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 ; - 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 ) 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 = ""; -