TV외부입력 자동화

input_select:
  hdmi_change:
    name: hdmi_change
    initial: idle
    options:
      - idle
      - hdmi2
      - hdmi3
      - hdmi4

automation:
- alias: opple-hdmi234
  trigger:
  - entity_id: sensor.6button_action
    platform: state
    to: button_4_single
  action:
  - entity_id: input_select.hdmi_change
    service: input_select.select_next
  - delay: 00:00:5
  - entity_id: input_select.hdmi_change
    service: input_select.select_first
  mode: restart

- alias: 입력-hdmi_change
  trigger:
  - entity_id: input_select.hdmi_change
    platform: state
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ trigger.to_state.state == ''hdmi2'' }}'
      sequence:
      - data:
          entity_id: remote.rm_mini3_remote
          device: television
          command: tv_hdmi2
        service: remote.send_command
    - conditions:
      - condition: template
        value_template: '{{ trigger.to_state.state == ''hdmi3'' }}'
      sequence:
      - data:
          entity_id: remote.rm_mini3_remote
          device: television
          command: tv_hdmi3
        service: remote.send_command
    - conditions:
      - condition: template
        value_template: '{{ trigger.to_state.state == ''hdmi4'' }}'
      sequence:
      - data:
          entity_id: remote.rm_mini3_remote
          device: television
          command: tv_hdmi4
        service: remote.send_command
  mode: single