{ services.home-assistant.extraComponents = [ "squeezebox" ]; services.home-assistant.config = { "automation toilet music" = { alias = "toilet music"; trigger = { platform = "state"; entity_id = "light.toilet_switch"; }; action = [ { service = "media_player.volume_mute"; target = { entity_id = "media_player.music_toilet_snapcast_client"; }; data = { 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"; }; }; }; }; }