summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2023-07-28 22:24:15 +0200
committermakefu <github@syntax-fehler.de>2023-07-28 22:24:15 +0200
commit060a8f28fa1fc648bdf66afb31a5d1efac868837 (patch)
tree2b354eacc7897365ee45244fe7a51720e0d0333f /makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix
parentcbfcc890e3b76d942b927809bf981a5fa7289e6a (diff)
makefu: move out to own repo, add vacation-note
Diffstat (limited to 'makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix')
-rw-r--r--makefu/2configs/home/ham/media/arbeitszimmer_matrix.nix110
1 files changed, 0 insertions, 110 deletions
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 11d13886..00000000
--- 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 = { };
- }
- ];
- }
- ];
-
-}