Sony Google TV & switch to HDMI input

Hi all,
I’m using the awesome GitHub - kalkih/mini-media-player: Minimalistic media card for Home Assistant Lovelace UI custom card to control my brand new Sony Bravia Google TV. I manage it with Android TV integration and I added to the card the shortcuts to open several apps (I found the name basically looking at the Sources list). I’m looking at how to open a specific HDMI input.

Pros:

  • control with ADB
  • state with current App name

Cons:

  • (it seems) no way to switch to HDMI input
  • no info on current DTV channel you are seeing

I tried the same with Sony TV integration

Pros:

  • state with current DTV channel
  • switch to HDMI input source

Cons:

  • no control with ADB
  • no state with current App name (just a generic Smart TV)

Do you have any suggestion on how to “merge” the pros of the 2 integrations into the same Card?
I was thinking about a Template with commands to act on one or other entity and the same for the state (taking it from one of them based on input type)… do you see other options pls?

I was able to solve the issue I had and I’m sharing it here if it could be useful for someone with same needs…

The important part is that with mini-media-player shortcuts you can send commands to other services and Sony TV integration offers a Remote integration so combining them together I had what I was looking for:

TV OFF:
image

TV ON:

Let’s say I have two entities:

  • media_player.sony_tv
  • media_player.android_tv

Using built-in resources I created a Vertical stack card in which I put

  • Mini-media-player controlling the Android TV with shortcuts to used applications (shortcuts visible only when TV is turned on)
  • Conditional card (TV turned on) with Markdown showing currently viewed channel (TV channel taken from media_player.sony_tv or Android Application taken from media_player.android_tv
  • Conditional card (TV turned on) with Buttons acting as remote
type: vertical-stack
cards:
  - type: custom:mini-media-player
    name: Sony Bravia Google TV
    icon: mdi:television-play
    entity: media_player.sony_tv
    volume_stateless: true
    source: icon
    group: false
    hide:
      next: false
      prev: false
      play_pause: false
      power: false
      source: false
    artwork: Default
    sound_mode: full
    scale: '1'
    info: short
    shortcuts:
      columns: 4
      column_height: 50
      hide_when_off: true
      align_text: center
      buttons:
        - label: TV
          icon: mdi:television-classic
          type: source
          id: TV
        - label: Netflix
          icon: mdi:netflix
          type: source
          id: Netflix
        - label: DAZN
          icon: facustom:dazn
          type: source
          id: DAZN
        - label: Amazon Prime Video
          icon: fab:amazon
          type: source
          id: Prime Video
        - label: RaiPlay
          icon: facustom:rai-play
          type: source
          id: RaiPlay
        - label: Mediaset Infinity
          icon: facustom:mediaset-infinity
          type: source
          id: Mediaset Infinity TV
        - label: YouTube
          icon: mdi:youtube
          type: source
          id: YouTube
        - label: Disney+
          icon: phu:disney-plus
          type: source
          id: Disney+
        - label: Spotify
          icon: mdi:spotify
          type: source
          id: Spotify
        - label: PlayStore
          icon: mdi:google-play
          type: source
          id: Play Store
        - label: NBA
          icon: facustom:nba
          type: source
          id: NBA
        - label: TimVision
          icon: facustom:timvision
          type: source
          id: TIMVISION APP
        - label: HDMI 1
          icon: mdi:numeric-1-box-multiple
          type: service
          id: remote.send_command
          data:
            command: Hdmi1
            entity_id: remote.sony_tv
          target:
            entity_id: remote.sony_tv
        - label: HDMI 2
          icon: mdi:numeric-2-box-multiple
          type: service
          id: remote.send_command
          data:
            command: Hdmi2
            entity_id: remote.sony_tv
          target:
            entity_id: remote.sony_tv
        - label: HDMI 3
          icon: mdi:numeric-3-box-multiple
          type: service
          id: remote.send_command
          data:
            command: Hdmi3
            entity_id: remote.sony_tv
          target:
            entity_id: remote.sony_tv
        - label: PS4
          icon: mdi:sony-playstation
          type: service
          id: remote.send_command
          data:
            command: Hdmi4
            entity_id: remote.sony_tv
          target:
            entity_id: remote.sony_tv
    toggle_power: true
  - type: conditional
    conditions:
      - entity: media_player.sony_tv
        state_not: 'off'
    card:
      type: vertical-stack
      title: Playing
      cards:
        - type: markdown
          content: >
            {% if state_attr('media_player.android_tv', 'source')
            == "TV" %} {{ state_attr('media_player.sony_tv', 'source') }}
            {% else %} {{ state_attr('media_player.android_tv',
            'source') }} {% endif %}
  - type: conditional
    conditions:
      - entity: media_player.sony_tv
        state_not: 'off'
    card:
      type: vertical-stack
      title: Remote
      cards:
        - type: horizontal-stack
          cards:
            - show_name: false
              show_icon: true
              type: button
              icon: mdi:arrow-down-bold-outline
              theme: Fluent Blue
              tap_action:
                action: call-service
                service: remote.send_command
                data:
                  command: ChannelDown
                target:
                  entity_id: remote.sony_tv
            - type: button
              show_name: false
              show_icon: true
              icon: mdi:home
              theme: Metro Blue
              tap_action:
                action: call-service
                service: remote.send_command
                data:
                  command: Home
                target:
                  entity_id: remote.sony_tv
            - type: button
              show_name: false
              show_icon: true
              icon: mdi:arrow-up-bold-outline
              theme: Fluent Blue
              tap_action:
                action: call-service
                service: remote.send_command
                data:
                  command: ChannelUp
                target:
                  entity_id: remote.sony_tv
        - type: horizontal-stack
          cards:
            - type: button
              icon: mdi:view-list
              show_name: false
              show_icon: true
              tap_action:
                action: call-service
                service: remote.send_command
                data:
                  command: GGuide
                target:
                  entity_id: remote.sony_tv
            - type: button
              icon: mdi:arrow-up-bold
              show_name: false
              show_icon: true
              theme: Fluent Blue
              tap_action:
                action: call-service
                service: remote.send_command
                data:
                  command: Up
                target:
                  entity_id: remote.sony_tv
            - type: button
              icon: mdi:information-outline
              show_name: false
              show_icon: true
              tap_action:
                action: call-service
                service: remote.send_command
                data:
                  command: Display
                target:
                  entity_id: remote.sony_tv
        - type: horizontal-stack
          cards:
            - type: button
              icon: mdi:arrow-left-bold
              show_name: false
              show_icon: true
              theme: Fluent Blue
              tap_action:
                action: call-service
                service: remote.send_command
                data:
                  command: Left
                target:
                  entity_id: remote.sony_tv
            - show_name: false
              show_icon: true
              type: button
              icon: far:dot-circle
              theme: Fluent Blue
              tap_action:
                action: call-service
                service: remote.send_command
                data:
                  command: Confirm
                target:
                  entity_id: remote.sony_tv
            - type: button
              icon: mdi:arrow-right-bold
              show_name: false
              show_icon: true
              theme: Fluent Blue
              tap_action:
                action: call-service
                service: remote.send_command
                data:
                  command: Right
                target:
                  entity_id: remote.sony_tv
        - type: horizontal-stack
          cards:
            - type: button
              icon: mdi:keyboard-return
              show_name: false
              show_icon: true
              tap_action:
                action: call-service
                service: remote.send_command
                data:
                  command: Return
                target:
                  entity_id: remote.sony_tv
            - type: button
              icon: mdi:arrow-down-bold
              show_name: false
              show_icon: true
              theme: Fluent Blue
              tap_action:
                action: call-service
                service: remote.send_command
                data:
                  command: Down
                target:
                  entity_id: remote.sony_tv
            - type: button
              icon: mdi:tools
              show_name: false
              show_icon: true
              tap_action:
                action: call-service
                service: remote.send_command
                data:
                  command: ActionMenu
                target:
                  entity_id: remote.sony_tv
1 Like