Need help for settings an automaton for my Bravia TV

Hi,

I want to know how to change a source in YAML for my sony bravia 55x950g in HA. i want to create a scrolling menu with the sources a want to configure for an easy switching with my phone or watch. i’ve already make the OFF one with this code :

- id: '1641154773043'
  alias: 'TV Off '
  description: Menu deroulant "TV"
  trigger:
  - platform: state
    entity_id: input_select.tv
    to: 'Off'
  condition: []
  action:
  - type: turn_off
    device_id: bfcf59f870ab575a6bb47ec2b3fb2705
    entity_id: remote.sony_bravia_tv
    domain: remote
  mode: single

thanks a lot for your help,

Use a choose to determine which option was selected and then perform the appropriate action.

- id: '1641154773043'
  alias: 'TV Off '
  description: Menu deroulant "TV"
  trigger:
  - platform: state
    entity_id: input_select.tv
  condition: []
  action:
  - choose:
    - conditions: "{{ trigger.to_state.state == 'Off' }}"
      sequence:
      - type: turn_off
        device_id: bfcf59f870ab575a6bb47ec2b3fb2705
        entity_id: remote.sony_bravia_tv
        domain: remote
    - conditions: "{{ trigger.to_state.state == 'On' }}"
      sequence:
      - type: turn_on
        device_id: bfcf59f870ab575a6bb47ec2b3fb2705
        entity_id: remote.sony_bravia_tv
        domain: remote
    - conditions: "{{ trigger.to_state.state == 'Autre Chose' }}"
      sequence:
      ... etc ...
  mode: single
1 Like

ok ok thanks but how can i make the sequence, for exemple, to choose HDMI 2 as a sources for my TV ?

I don’t have a Sony Bravia TV but I imagine it’s represented as a media_player entity so the service call would look something like this:

    - service: media_player.select_source
      target:
        entity_id: media_player.your_sony_bravia_tv
      data:
        source: HDMI 2
1 Like

Great thanks a lot for your help it works now :slight_smile: here the code for the off and the switch for my PS5 :

- id: '1641154773043'
  alias: TV Switching
  description: Menu deroulant "TV"
  trigger:
  - platform: state
    entity_id: input_select.tv
  condition: []
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ trigger.to_state.state == ''Off'' }}'
      sequence:
      - type: turn_off
        device_id: bfcf59f870ab575a6bb47ec2b3fb2705
        entity_id: remote.sony_bravia_tv
        domain: remote
    - conditions:
      - condition: template
        value_template: '{{ trigger.to_state.state == ''Playstation'' }}'
      sequence:
      - type: turn_on
        device_id: bfcf59f870ab575a6bb47ec2b3fb2705
        entity_id: remote.sony_bravia_tv
        domain: remote
      - delay:
          hours: 0
          minutes: 0
          seconds: 0
          milliseconds: 300
      - service: media_player.select_source
        target:
          entity_id: media_player.sony_bravia_tv
        data:
          source: PlayStation 5

Thanks again :slight_smile:

1 Like

You’re welcome! Glad to hear it solved the problem.

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.

1 Like