YAML for simple popup remote using browser mod

Adding this to help others who need a simple popup remote control solution. In order to use this you’ll need to install:

HACS and the following custom repositories via HACS
Browser Mod (for the custom popup cards)
Button Card (to manage all the buttons)
Layout Card (for the layout of the remote buttons)
Apple TV Beta (if you have an Apple TV)

It’s a simple solution, but getting the popup working and the layout correct was a bit of a pain. There are probably a handful of ways to do this better, but they’re all beyond me. Hopefully someone can copy/paste this down the road and save some time. It uses a grid function via the custom layout card to help keep the buttons neat. The custom grid was used to get control over column width. You could use a regular Lovelace grid, but your remote will end up looking pretty large. That may be desirable, I suppose. With the custom grid and custom column widths you’ll need to manage the margins so the button layout is centered on the popup card. Excuse the terrible TV content on the media entities.

type: custom:button-card
show_name: true
show_icon: true
color: grey
name: Apple TV Remote
icon: mdi:remote-tv
tap_action:
  action: fire-dom-event
  browser_mod:
    command: popup
    title: Den Apple TV
    card:
      type: custom:layout-card
      layout_type: grid
      layout:
        grid-template-rows: auto
        grid-template-columns: 30% 30% 30%
        margin: 100px 0px 0px 35px
      cards:
        - type: custom:button-card
          color: maroon
          icon: mdi:power
          name: TV Power
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command:
                - home_hold
                - select
              entity_id: remote.den
        - type: custom:button-card
          icon: mdi:home
          name: Home
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: home
              entity_id: remote.den
        - type: custom:button-card
          icon: mdi:backburger
          name: Home
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: menu
              entity_id: remote.den
        - type: custom:gap-card
        - type: custom:button-card
          aspect_ratio: 1/1
          size: 75px
          icon: mdi:chevron-up
          name: Up
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: up
              entity_id: remote.den
        - type: custom:gap-card
        - type: custom:button-card
          aspect_ratio: 1/1
          size: 75px
          icon: mdi:chevron-left
          name: Left
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: left
              entity_id: remote.den
        - type: custom:button-card
          aspect_ratio: 1/1
          size: 75px
          icon: mdi:circle
          name: Select
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: select
              entity_id: remote.den
        - type: custom:button-card
          aspect_ratio: 1/1
          size: 75px
          icon: mdi:chevron-right
          name: Right
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: right
              entity_id: remote.den
        - type: custom:gap-card
        - type: custom:button-card
          aspect_ratio: 1/1
          size: 75px
          icon: mdi:chevron-down
          name: Down
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: down
              entity_id: remote.den
        - type: custom:gap-card
        - type: custom:button-card
          icon: mdi:play-pause
          name: Down
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: play_pause
              entity_id: remote.den
        - type: custom:button-card
          icon: mdi:skip-backward
          name: Down
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: skip_backward
              entity_id: remote.den
        - type: custom:button-card
          icon: mdi:volume-plus
          name: Volume Up
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: VolumeUp
              device: '68973473'
              entity_id: remote.harmony_hub
        - type: custom:button-card
          icon: mdi:volume-mute
          name: Mute
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: volumemute
              device: '68973473'
              entity_id: remote.harmony_hub
        - type: custom:button-card
          icon: mdi:skip-forward
          name: Down
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: skip_forward
              entity_id: remote.den
        - type: custom:button-card
          icon: mdi:volume-minus
          name: Volume Down
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: VolumeDown
              device: '68973473'
              entity_id: remote.harmony_hub
        - type: custom:button-card
          icon: mdi:brightness-5
          name: PictureMode
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: picturemode
              device: '68813604'
              entity_id: remote.harmony_hub
        - type: custom:gap-card
        - type: custom:button-card
          icon: mdi:information
          name: Info
          show_icon: true
          show_name: false
          tap_action:
            action: call-service
            service: remote.send_command
            service_data:
              command: info
              device: '68813604'
              entity_id: remote.harmony_hub

2 Likes

Hi. This no longer works with the latest version of Browser_Mod. I’ll get around to editing the YAML to make it work, soon.

Updated YAML. This works with Browser_mod 2+. There are minor style differences since the original post, above, but it will work the same.

type: custom:button-card
show_name: true
show_icon: true
color: steelblue
name: Apple TV
icon: mdi:remote-tv
tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.popup
    data:
      title: Theater Apple TV
      content:
        type: custom:layout-card
        layout_type: grid
        layout:
          grid-template-rows: auto
          grid-template-columns: 30% 30% 30%
          margin: 35px 0px 35px 38px
        cards:
          - type: custom:button-card
            color: maroon
            icon: mdi:power
            name: TV Power
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command:
                  - home_hold
                  - select
                entity_id: remote.theater
          - type: custom:button-card
            color: steelblue
            icon: mdi:home
            name: Home
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: home
                entity_id: remote.theater
          - type: custom:button-card
            color: steelblue
            icon: mdi:backburger
            name: Menu
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: menu
                entity_id: remote.theater
          - type: custom:gap-card
          - type: custom:button-card
            color: steelblue
            aspect_ratio: 1/1
            size: 75px
            icon: mdi:chevron-up
            name: Up
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: up
                entity_id: remote.theater
          - type: custom:gap-card
          - type: custom:button-card
            color: steelblue
            aspect_ratio: 1/1
            size: 75px
            icon: mdi:chevron-left
            name: Left
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: left
                entity_id: remote.theater
          - type: custom:button-card
            color: steelblue
            aspect_ratio: 1/1
            size: 75px
            icon: mdi:circle
            name: Select
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: select
                entity_id: remote.theater
          - type: custom:button-card
            color: steelblue
            aspect_ratio: 1/1
            size: 75px
            icon: mdi:chevron-right
            name: Right
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: right
                entity_id: remote.theater
          - type: custom:gap-card
          - type: custom:button-card
            color: steelblue
            aspect_ratio: 1/1
            size: 75px
            icon: mdi:chevron-down
            name: Down
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: down
                entity_id: remote.theater
          - type: custom:gap-card
          - type: custom:button-card
            color: steelblue
            icon: mdi:play-pause
            name: Down
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: play_pause
                entity_id: remote.theater
          - type: custom:button-card
            color: steelblue
            icon: mdi:skip-backward
            name: Down
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: skip_backward
                entity_id: remote.theater
          - type: custom:button-card
            color: steelblue
            icon: mdi:volume-plus
            name: Volume Up
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: volumeup
                device: '78423400'
                entity_id: remote.harmony_hub
          - type: custom:button-card
            color: steelblue
            icon: mdi:volume-mute
            name: Mute
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: mute
                device: '78423400'
                entity_id: remote.harmony_hub
          - type: custom:button-card
            color: steelblue
            icon: mdi:skip-forward
            name: Down
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: skip_forward
                entity_id: remote.theater
          - type: custom:button-card
            color: steelblue
            icon: mdi:volume-minus
            name: Volume Down
            show_icon: true
            show_name: false
            tap_action:
              action: call-service
              service: remote.send_command
              service_data:
                command: volumedown
                device: '78423400'
                entity_id: remote.harmony_hub
3 Likes

Happy to share my version too. It is not as polished but tips and tricks always welcomed

type: custom:mushroom-template-card
primary: ''
secondary: ''
icon: mdi:remote
layout: vertical
icon_color: blue
size: fullscreen
tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.popup
    data:
      title: Bedroom TV
      content:
        type: vertical-stack
        cards:
          - square: true
            columns: 3
            type: grid
            cards:
              - show_name: false
                show_icon: true
                type: custom:button-card
                tap_action:
                  action: toggle
                hold_action:
                  action: none
                entity: scene.tv_power
                name: TV Power
                icon: mdi:power
              - type: custom:button-card
                icon: mdi:arrow-up-bold
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: DPAD_UP
                    entity_id: remote.living_room_tv
                hold_action:
                  action: none
              - show_name: false
                show_icon: true
                type: custom:button-card
                tap_action:
                  action: none
                hold_action:
                  action: none
                entity: remote.living_room_tv
                show_state: false
              - type: custom:button-card
                icon: mdi:arrow-left-bold
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: DPAD_LEFT
                    entity_id: remote.living_room_tv
                hold_action:
                  action: none
              - type: custom:button-card
                icon: mdi:circle
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: DPAD_CENTER
                    entity_id: remote.living_room_tv
                hold_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: DPAD_CENTER
                    hold_secs: 0.5
                    entity_id: remote.living_room_tv
              - type: custom:button-card
                icon: mdi:arrow-right-bold
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: DPAD_RIGHT
                    entity_id: remote.living_room_tv
                hold_action:
                  action: none
              - type: custom:button-card
                icon: mdi:arrow-left
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: BACK
                    entity_id: remote.living_room_tv
                hold_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: BACK
                    hold_secs: 0.5
                    entity_id: remote.living_room_tv
              - type: custom:button-card
                icon: mdi:arrow-down-bold
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: DPAD_DOWN
                    entity_id: remote.living_room_tv
                hold_action:
                  action: none
              - type: custom:button-card
                icon: mdi:home-outline
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: HOME
                    entity_id: remote.living_room_tv
                hold_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: HOME
                    hold_secs: 0.5
                    entity_id: remote.living_room_tv
          - square: false
            columns: 3
            type: grid
            cards:
              - type: custom:button-card
                icon: mdi:skip-previous
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: MEDIA_PREVIOUS
                    entity_id: remote.living_room_tv
                hold_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: MEDIA_REWIND
                    entity_id: remote.living_room_tv
              - type: custom:button-card
                icon: mdi:play-pause
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: MEDIA_PLAY_PAUSE
                    entity_id: remote.living_room_tv
                hold_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: MEDIA_STOP
                    entity_id: remote.living_room_tv
              - type: custom:button-card
                icon: mdi:skip-next
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: MEDIA_NEXT
                    entity_id: remote.living_room_tv
                hold_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: MEDIA_FAST_FORWARD
                    entity_id: remote.living_room_tv
              - type: custom:button-card
                icon: mdi:volume-off
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: MUTE
                    entity_id: remote.living_room_tv
                hold_action:
                  action: none
              - type: custom:button-card
                icon: mdi:volume-medium
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: VOLUME_DOWN
                    entity_id: remote.living_room_tv
                hold_action:
                  action: none
              - type: custom:button-card
                icon: mdi:volume-high
                tap_action:
                  action: call-service
                  service: remote.send_command
                  service_data:
                    command: VOLUME_UP
                    entity_id: remote.living_room_tv
                hold_action:
                  action: none
          - square: false
            columns: 4
            type: grid
            cards:
              - type: custom:button-card
                icon: mdi:youtube
                tap_action:
                  action: call-service
                  service: remote.turn_on
                  service_data:
                    activity: https://www.youtube.com
                    entity_id: remote.living_room_tv
                hold_action:
                  action: none
              - type: custom:button-card
                icon: mdi:netflix
                tap_action:
                  action: call-service
                  service: remote.turn_on
                  service_data:
                    activity: netflix://
                    entity_id: remote.living_room_tv
                hold_action:
                  action: none
              - type: custom:button-card
                icon: mdi:jellyfish
                tap_action:
                  action: call-service
                  service: remote.turn_on
                  service_data:
                    activity: org.jellyfin.mobile.player.audio.MediaService://
                    entity_id: remote.living_room_tv
                hold_action:
                  action: none
              - type: custom:button-card
                icon: mdi:movie
                tap_action:
                  action: call-service
                  service: remote.turn_on
                  service_data:
                    activity: cinemahd://
                    entity_id: remote.living_room_tv
                hold_action:
                  action: none

2 Likes