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 --- .../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 - 6 files changed, 521 deletions(-) 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 (limited to 'makefu/2configs/home/ham/media') 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" - ]; -} -- cgit v1.2.3