From 9c75e6b2784f76d9f6761e233daa48382ca75257 Mon Sep 17 00:00:00 2001 From: "J.P. Krauss" Date: Sun, 10 Jul 2022 17:06:30 -0700 Subject: [PATCH] Add HVAC Volume Adjustment to Media Package --- packages/media/media.yaml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/packages/media/media.yaml b/packages/media/media.yaml index 983096a..f9b68a3 100644 --- a/packages/media/media.yaml +++ b/packages/media/media.yaml @@ -15,6 +15,12 @@ input_select: - Unknown initial: Idle +# ----------------------------------------------------------------------------- +# Media Player Configuration Switches +input_boolean: + ht_adjust_volume_hvac: + name: Home Theater Adjust Volume for HVAC + # ----------------------------------------------------------------------------- # Media Player Scripts script: @@ -113,3 +119,35 @@ automation: entity_id: media_player.living_room_roku action: - service: script.ht_player_state_update + + - alias: Turn Up Volume when HVAC Fan Starts + trigger: + - platform: template + value_template: > + {{ iif('Running' in state_attr('climate.thermostat', 'fan_state'), 'true', 'false') }} + condition: + - condition: "{{ is_state('input_boolean.ht_adjust_volume_hvac', 'on') }}" + - condition: "{{ is_state('media_player.living_room_receiver', 'on') }}" + action: + - repeat: + count: 6 + sequence: + - service: media_player.volume_up + target: + entity_id: media_player.living_room_receiver + + - alias: Turn Down Volume when HVAC Fan Stops + trigger: + - platform: template + value_template: > + {{ iif('Running' in state_attr('climate.thermostat', 'fan_state'), 'false', 'true') }} + condition: + - condition: "{{ is_state('input_boolean.ht_adjust_volume_hvac', 'on') }}" + - condition: "{{ is_state('media_player.living_room_receiver', 'on') }}" + action: + - repeat: + count: 6 + sequence: + - service: media_player.volume_down + target: + entity_id: media_player.living_room_receiver