From cc45b7a670931c077514ca8f4daeb87d62f659d9 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Thu, 6 Jun 2024 06:32:58 +0400 Subject: Sound volume control: change volume of both media player and Sven speakers (via IR bridge) - a bit unreliable, might require reverting --- .../lights/knob-sound-multi-bulb-control.yaml | 44 +++++++++++++++++----- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/blueprints/automation/lights/knob-sound-multi-bulb-control.yaml b/blueprints/automation/lights/knob-sound-multi-bulb-control.yaml index 843b25e..7be33cf 100644 --- a/blueprints/automation/lights/knob-sound-multi-bulb-control.yaml +++ b/blueprints/automation/lights/knob-sound-multi-bulb-control.yaml @@ -64,6 +64,13 @@ blueprint: min: 1 max: 10 + sven_volume: + name: Sven Volume Control + description: Control also volume of Sven speakers (if used directly, not via media-player) + default: false + selector: + boolean: + trigger: - platform: state id: knob @@ -92,6 +99,7 @@ variables: hue_delay: !input hue_delay volume_steps: !input volume_steps + sven_volume: !input sven_volume # We can't use 'queued/restart' if we need to tackle 'double-click' #mode: queued @@ -123,24 +131,40 @@ action: - condition: template value_template: '{{ current_num < 0 }}' sequence: - - repeat: - count: '{{ volume_steps }}' - sequence: - - service: media_player.volume_up + - parallel: + - if: + - condition: template + value_template: '{{ sven_volume == true }}' + then: + - service: scene.turn_on target: - entity_id: !input media_player + entity_id: scene.sven_volume_up + - repeat: + count: '{{ volume_steps }}' + sequence: + - service: media_player.volume_up + target: + entity_id: !input media_player - conditions: - condition: template value_template: '{{ trigger.to_state.state == "brightness_step_down" }}' - condition: template value_template: '{{ current_num < 0 }}' sequence: - - repeat: - count: '{{ volume_steps }}' - sequence: - - service: media_player.volume_down + - parallel: + - if: + - condition: template + value_template: '{{ sven_volume == true }}' + then: + - service: scene.turn_on target: - entity_id: !input media_player + entity_id: scene.sven_volume_down + - repeat: + count: '{{ volume_steps }}' + sequence: + - service: media_player.volume_down + target: + entity_id: !input media_player - conditions: - condition: template value_template: '{{ trigger.to_state.state == "color_temperature_step_up" }}' -- cgit v1.2.3