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,10 +1,11 @@
{
services.home-assistant.extraComponents = [ "squeezebox" ];
services.home-assistant.config = {
"automation toilet music" = {
alias = "toilet music";
trigger = {
platform = "state";
entity_id = "light.toilett_lights";
entity_id = "light.toilet_switch";
};
action = [
{
@@ -13,10 +14,52 @@
entity_id = "media_player.music_toilet_snapcast_client";
};
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";
};
};
};
};
}