feat: changes to home-assistant

This commit is contained in:
2025-05-24 10:10:51 +02:00
parent a078503a89
commit 348d8e1d03
4 changed files with 58 additions and 32 deletions

View File

@@ -1,4 +1,9 @@
{ let
devices = [
"device_tracker.dominiks_iphone"
"device_tracker.dominiks_mp01"
];
in {
services.home-assistant.extraComponents = [ services.home-assistant.extraComponents = [
"nuki" "nuki"
]; ];
@@ -9,9 +14,7 @@
mode = "restart"; mode = "restart";
trigger = { trigger = {
platform = "state"; platform = "state";
entity_id = [ entity_id = devices;
"device_tracker.dominiks_iphone"
];
from = "not_home"; from = "not_home";
to = "home"; to = "home";
}; };

View File

@@ -494,6 +494,12 @@
entity_id = "script.turn_on_tv"; entity_id = "script.turn_on_tv";
}; };
} }
{
service = "media_player.turn_off";
target = {
entity_id = "media_player.marantz_sr6015";
};
}
]; ];
} }
]; ];

View File

@@ -1,10 +1,11 @@
{ {
services.home-assistant.extraComponents = [ "squeezebox" ];
services.home-assistant.config = { services.home-assistant.config = {
"automation toilet music" = { "automation toilet music" = {
alias = "toilet music"; alias = "toilet music";
trigger = { trigger = {
platform = "state"; platform = "state";
entity_id = "light.toilett_lights"; entity_id = "light.toilet_switch";
}; };
action = [ action = [
{ {
@@ -13,10 +14,52 @@
entity_id = "media_player.music_toilet_snapcast_client"; entity_id = "media_player.music_toilet_snapcast_client";
}; };
data = { data = {
is_volume_muted = "{{ trigger.to_state.state == 'off' }}"; is_volume_muted = "{{ trigger.to_state.state != 'on' }}";
}; };
} }
]; ];
}; };
"automation bathroom music" = {
alias = "bathroom music";
trigger = {
platform = "state";
entity_id = "light.bathroom_switch";
};
action = [
{
service = "media_player.volume_mute";
target = {
entity_id = "media_player.music_bathroom_snapcast_client";
};
data = {
is_volume_muted = "{{ trigger.to_state.state != 'on' }}";
};
}
];
};
"automation piano" = {
alias = "piano";
trigger = {
platform = "state";
entity_id = "media_player.music_piano_snapcast_client";
attribute = "is_volume_muted";
};
condition = [
{
condition = "template";
value_template = "{{ trigger.from_state.state != 'unavailable' }}";
}
{
condition = "template";
value_template = "{{ state_attr('media_player.music_piano_snapcast_client', 'is_volume_muted') == true or state_attr('media_player.music_piano_snapcast_client', 'is_volume_muted') == false }}";
}
];
action = {
service = "switch.turn_on";
target = {
entity_id = "switch.piano_switch_power";
};
};
};
}; };
} }

View File

@@ -1,31 +1,5 @@
{ {
services.home-assistant = { services.home-assistant = {
extraComponents = [ "snapcast" ]; extraComponents = [ "snapcast" ];
config = {
"automation piano" = {
alias = "piano";
trigger = {
platform = "state";
entity_id = "media_player.music_piano_snapcast_client";
attribute = "is_volume_muted";
};
condition = [
{
condition = "template";
value_template = "{{ trigger.from_state.state != 'unavailable' }}";
}
{
condition = "template";
value_template = "{{ state_attr('media_player.music_piano_snapcast_client', 'is_volume_muted') == true or state_attr('media_player.music_piano_snapcast_client', 'is_volume_muted') == false }}";
}
];
action = {
service = "switch.turn_on";
target = {
entity_id = "switch.piano_switch_power";
};
};
};
};
}; };
} }