통합 볼륨은 기기가 9개 연결 돼 있어 기기 전체 볼륨이 올라가 침실 기기만 사용될 때는 침실 스피커 볼륨만 컨트롤 되도록 자동화. 침실 TV는 볼륨보다 채널 업다운으로 설정.
보통 소리 관련 기기는 여러기기를 동시에 사용하는 경우가 없어 조건만 적당히 걸면 하나의 노브로 여러개를 관리할 수 있어 유용함.
automations.yaml:
- id: 버튼-E1744-2
alias: 버튼-E1744-2
trigger:
- entity_id: sensor.be_volume_remote_action
platform: state
to:
- "rotate_right"
- "rotate_left"
- "rotate_stop"
- "play_pause"
- "skip_forward"
- "skip_backward"
action:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state == ''rotate_right'' }}'
sequence:
- entity_id: #통합 볼륨업
- input_number.speaker_volume
service_template: "{{ is_state('media_player.homemoving', 'playing')|
iif('input_number.increment', 'script.nop') }}"
- entity_id: #크롬캐스트 볼륨업
- input_number.speaker_cast_volume
service_template: "{{ (is_state('media_player.castsound', 'playing') or
is_state('media_player.castbedroom', 'playing') and
is_state('media_player.homemoving', 'off')) |
iif('input_number.increment', 'script.nop') }}"
- data: #TV 채널업
entity_id: remote.rm4c_mini_remote
device: television
command: channel_up
service_template: "{{ ((states('sensor.be_tv_outlet_power')|float > 50) and
is_state('media_player.castbedroom', 'off')) |
iif('remote.send_command', 'script.nop') }}"
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state == ''rotate_left'' }}'
sequence:
- entity_id: #통합 볼륨다운
- input_number.speaker_volume
service_template: "{{ is_state('media_player.homemoving', 'playing')|
iif('input_number.decrement', 'script.nop') }}"
- entity_id: #크롬캐스트 볼륨다운
- input_number.speaker_cast_volume
service_template: "{{ (is_state('media_player.castsound', 'playing') or
is_state('media_player.castbedroom', 'playing') and
is_state('media_player.homemoving', 'off')) |
iif('input_number.decrement', 'script.nop') }}"
- data: #TV 채널다운
entity_id: remote.rm4c_mini_remote
device: television
command: channel_down
service_template: "{{ ((states('sensor.be_tv_outlet_power')|float > 50)
and is_state('media_player.castbedroom', 'off')) |
iif('remote.send_command', 'script.nop') }}"
- conditions: #YTMusic ON/OFF
- condition: template
value_template: '{{ trigger.to_state.state == ''play_pause'' }}'
sequence:
- entity_id: switch.ytmusic
service: switch.toggle
- conditions: #YTMusic Next Track
- condition: template
value_template: '{{ trigger.to_state.state == ''skip_forward'' }}'
sequence:
- entity_id: media_player.ytube_music_player
service: media_player.media_next_track
- conditions: #YTMusic Next Playlist
- condition: template
value_template: '{{ trigger.to_state.state == ''skip_backward'' }}'
sequence:
- service: input_select.select_next
entity_id: input_select.ytube_music_player_playlist
mode: single
- id: 미디어-볼륨_변경-기본
alias: 미디어-볼륨 변경-기본
initial_state: 'on'
trigger:
- platform: state
entity_id:
- input_number.speaker_volume
id: "0"
- platform: state
entity_id:
- input_number.speaker_home_volume
id: "1"
- platform: state
entity_id:
- input_number.speaker_cast_volume
id: "2"
- platform: state
entity_id:
- input_number.speaker_hub_volume
id: "3"
action:
- choose:
- conditions:
- condition: trigger
id: "0"
sequence:
- service: script.speaker_volume
- conditions:
- condition: trigger
id: "1"
sequence:
- service: script.speaker_home_volume
- conditions:
- condition: trigger
id: "2"
sequence:
- service: script.speaker_cast_volume
- conditions:
- condition: trigger
id: "3"
sequence:
- service: script.speaker_hub_volume
mode: single
scripts.yaml:
speaker_volume:
sequence:
- service: media_player.volume_set
entity_id:
- media_player.homelivingroom
- media_player.homemoving
# - media_player.homenotify
- media_player.castsound
- media_player.castbedroom
# - media_player.castaudio
- media_player.hubbedroom
- media_player.hubkitchen
# - media_player.hubatelier
data_template:
volume_level: '{{ states.input_number.speaker_volume.state }}'
speaker_cast_volume:
sequence:
- service: media_player.volume_set
entity_id:
- media_player.castsound
- media_player.castbedroom
data_template:
volume_level: '{{ states.input_number.speaker_cast_volume.state }}'
input_number.yaml:
speaker_volume:
name: 통합볼륨
icon: mdi:volume-medium
initial: 0.4
min: 0.0
max: 1.0
step: 0.05
speaker_home_volume:
name: 구글홈볼륨
icon: mdi:volume-medium
initial: 0.4
min: 0.0
max: 1.0
step: 0.05
speaker_cast_volume:
name: 캐스트볼륨
icon: mdi:volume-medium
initial: 0.5
min: 0.0
max: 1.0
step: 0.05
speaker_hub_volume:
name: 허브볼륨
icon: mdi:volume-medium
initial: 0.6
min: 0.0
max: 1.0
step: 0.05
**쉼포니스크 볼륨리모컨1