Emulated Roku

This blueprint allows you to easily trigger actions for all of the keypresses that the Emulated Roku integration supports. This is commonly used when integrating with smart remotes (like the Logitech Harmony line).

blueprint:
  name: Emulated Roku
  description: Create Automations for Emulated Roku Keypresses
  domain: automation

  input:
    emulated_roku_name:
      name: Emulated Roku Name
      description: The name of the Emulated Roku
      selector:
        text:
          multiline: false
    up_action:
      name: >
        "Up" Button
      description: >
        Action to run, when the "Up" button is pressed
      default: []
      selector:
        action: {}
    right_action:
      name: >
        "Right" Button
      description: >
        Action to run, when the "Right" button is pressed
      default: []
      selector:
        action: {}
    down_action:
      name: >
        "Down" Button
      description: >
        Action to run, when the "Down" button is pressed
      default: []
      selector:
        action: {}
    left_action:
      name: >
        "Left" Button
      description: >
        Action to run, when the "Left" button is pressed
      default: []
      selector:
        action: {}
    home_action:
      name: >
        "Home" Button
      description: >
        Action to run, when the "Home" button is pressed
      default: []
      selector:
        action: {}
    search_action:
      name: >
        "Search" Button
      description: >
        Action to run, when the "Search" button is pressed
      default: []
      selector:
        action: {}
    rewind_action:
      name: >
        "Rewind" Button
      description: >
        Action to run, when the "Rewind" button is pressed
      default: []
      selector:
        action: {}
    forward_action:
      name: >
        "Forward" Button
      description: >
        Action to run when the "Forward" button is pressed
      default: []
      selector:
        action: {}
    play_action:
      name: >
        "Play" Button
      description: >
        Action to run when the "Play" button is pressed
      default: []
      selector:
        action: {}
    select_action:
      name: >
        "Select" Button
      description: >
        Action to run when the "Select" button is pressed
      default: []
      selector:
        action: {}
    back_action:
      name: >
        "Back" Button
      description: >
        Action to run when the "Back" button is pressed
      default: []
      selector:
        action: {}
    instant_replay_action:
      name: >
        "InstantReplay" Button
      description: >
        Action to run when the "InstantReplay" button is pressed
      default: []
      selector:
        action: {}
    info_action:
      name: >
        "Info" Button
      description: >
        Action to run when the "Info" button is pressed
      default: []
      selector:
        action: {}
    back_space_action:
      name: >
        "BackSpace" Button
      description: >
        Action to run when the "BackSpace" button is pressed
      default: []
      selector:
        action: {}
    enter_action:
      name: >
        "Enter" Button
      description: >
        Action to run when the "Enter" button is pressed
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/emulated-roku/325451

mode: single
max_exceeded: silent

variables:
  emulated_roku_name: !input emulated_roku_name

trigger:
  - platform: event
    event_type: roku_command
condition:
  - condition: template
    value_template: '{{ trigger.event.data.source_name == emulated_roku_name }}'
  - condition: template
    value_template: '{{ trigger.event.data.type == "keypress" }}'
action:
  - variables:
      key_id: '{{ trigger.event.data.key }}'
  - choose:
    - conditions: '{{ key_id == "Up" }}'
      sequence: !input up_action
    - conditions: '{{ key_id ==  "Right" }}'
      sequence: !input right_action
    - conditions: '{{ key_id ==  "Down" }}'
      sequence: !input down_action
    - conditions: '{{ key_id ==  "Left" }}'
      sequence: !input left_action
    - conditions: '{{ key_id ==  "Home" }}'
      sequence: !input home_action
    - conditions: '{{ key_id ==  "Search" }}'
      sequence: !input search_action
    - conditions: '{{ key_id ==  "Rev" }}'
      sequence: !input rewind_action
    - conditions: '{{ key_id ==  "Fwd" }}'
      sequence: !input forward_action
    - conditions: '{{ key_id ==  "Play" }}'
      sequence: !input play_action
    - conditions: '{{ key_id ==  "Select" }}'
      sequence: !input select_action
    - conditions: '{{ key_id ==  "Back" }}'
      sequence: !input back_action
    - conditions: '{{ key_id ==  "InstantReplay" }}'
      sequence: !input instant_replay_action
    - conditions: '{{ key_id ==  "Info" }}'
      sequence: !input info_action
    - conditions: '{{ key_id ==  "BackSpace" }}'
      sequence: !input back_space_action
    - conditions: '{{ key_id ==  "Enter" }}'
      sequence: !input enter_action

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Hey

Thanks for this. I am trying to re-jig this template to also be able to capture and assign the app launch function of the emulated roku (for my new sofabaton). I’ve copied it and changed the bits that I think need changing, but I can’t quite get it to work. Would you be able to look over this and see what I might be doing wrong?

blueprint:
  name: Emulated Roku Apps
  description: Create Automations for Emulated Roku Apps
  domain: automation
  input:
    emulated_roku_name:
      name: Emulated Roku Name
      description: The name of the Emulated Roku
      selector:
        text:
          multiline: false
          multiple: false
    app_id_1:
      name: '"App ID 1" Button'
      description: 'Action to run, when the "App ID 1" button is pressed'
      default: []
      selector:
        action: {}
    app_id_2:
      name: '"App ID 2" Button'
      description: 'Action to run, when the "App ID 2" button is pressed'
      default: []
      selector:
        action: {}
    app_id_3:
      name: '"App ID 3" Button'
      description: 'Action to run, when the "App ID 3" button is pressed'
      default: []
      selector:
        action: {}
    app_id_4:
      name: '"App ID 4" Button'
      description: 'Action to run, when the "App ID 4" button is pressed'
      default: []
      selector:
        action: {}
    app_id_5:
      name: '"App ID 5" Button'
      description: 'Action to run, when the "App ID 5" button is pressed'
      default: []
      selector:
        action: {}
    app_id_6:
      name: '"App ID 6" Button'
      description: 'Action to run, when the "App ID 6" button is pressed'
      default: []
      selector:
        action: {}
    app_id_7:
      name: '"App ID 7" Button'
      description: 'Action to run, when the "App ID 7" button is pressed'
      default: []
      selector:
        action: {}
    app_id_8:
      name: '"App ID 8" Button'
      description: 'Action to run, when the "App ID 8" button is pressed'
      default: []
      selector:
        action: {}
    app_id_9:
      name: '"App ID 9" Button'
      description: 'Action to run, when the "App ID 9" button is pressed'
      default: []
      selector:
        action: {}
    app_id_10:
      name: '"App ID 10" Button'
      description: 'Action to run, when the "App ID 10" button is pressed'
      default: []
      selector:
        action: {}
    app_id_11:
      name: '"App ID 11" Button'
      description: 'Action to run, when the "App ID 11" button is pressed'
      default: []
      selector:
        action: {}
    app_id_12:
      name: '"App ID 12" Button'
      description: 'Action to run, when the "App ID 12" button is pressed'
      default: []
      selector:
        action: {}
    app_id_13:
      name: '"App ID 13" Button'
      description: 'Action to run, when the "App ID 13" button is pressed'
      default: []
      selector:
        action: {}
    app_id_14:
      name: '"App ID 14" Button'
      description: 'Action to run, when the "App ID 14" button is pressed'
      default: []
      selector:
        action: {}
    app_id_15:
      name: '"App ID 15" Button'
      description: 'Action to run, when the "App ID 15" button is pressed'
      default: []
      selector:
        action: {}
    app_id_16:
      name: '"App ID 16" Button'
      description: 'Action to run, when the "App ID 16" button is pressed'
      default: []
      selector:
        action: {}
    app_id_17:
      name: '"App ID 17" Button'
      description: 'Action to run, when the "App ID 17" button is pressed'
      default: []
      selector:
        action: {}
    app_id_18:
      name: '"App ID 18" Button'
      description: 'Action to run, when the "App ID 18" button is pressed'
      default: []
      selector:
        action: {}
    app_id_19:
      name: '"App ID 19" Button'
      description: 'Action to run, when the "App ID 19" button is pressed'
      default: []
      selector:
        action: {}
    app_id_20:
      name: '"App ID 20" Button'
      description: 'Action to run, when the "App ID 20" button is pressed'
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/emulated-roku/325451
mode: single
max_exceeded: silent
variables:
  emulated_roku_name: !input emulated_roku_name
trigger:
  - platform: event
    event_type: roku_command
condition:
  - condition: template
    value_template: "{{ trigger.event.data.source_name == emulated_roku_name }}"
  - condition: template
    value_template: '{{ trigger.event.data.type == "launch" }}'
action:
  - variables:
      key_id: "{{ trigger.event.data.app_id }}"
  - choose:
      - conditions: '{{ key_id == "1" }}'
        sequence: !input app_id_1
      - conditions: '{{ key_id ==  "2" }}'
        sequence: !input app_id_2
      - conditions: '{{ key_id ==  "3" }}'
        sequence: !input app_id_3
      - conditions: '{{ key_id ==  "4" }}'
        sequence: !input app_id_4
      - conditions: '{{ key_id ==  "5" }}'
        sequence: !input app_id_5
      - conditions: '{{ key_id ==  "6" }}'
        sequence: !input app_id_6
      - conditions: '{{ key_id ==  "7" }}'
        sequence: !input app_id_7
      - conditions: '{{ key_id ==  "8" }}'
        sequence: !input app_id_8
      - conditions: '{{ key_id ==  "9" }}'
        sequence: !input app_id_9
      - conditions: '{{ key_id ==  "10" }}'
        sequence: !input app_id_10
      - conditions: '{{ key_id ==  "11" }}'
        sequence: !input app_id_11
      - conditions: '{{ key_id ==  "12" }}'
        sequence: !input app_id_12
      - conditions: '{{ key_id ==  "13" }}'
        sequence: !input app_id_13
      - conditions: '{{ key_id ==  "14" }}'
        sequence: !input app_id_14
      - conditions: '{{ key_id ==  "15" }}'
        sequence: !input app_id_15
      - conditions: '{{ key_id ==  "16" }}'
        sequence: !input app_id_16
      - conditions: '{{ key_id ==  "17" }}'
        sequence: !input app_id_17
      - conditions: '{{ key_id ==  "18" }}'
        sequence: !input app_id_18
      - conditions: '{{ key_id ==  "19" }}'
        sequence: !input app_id_19
      - conditions: '{{ key_id ==  "20" }}'
        sequence: !input app_id_20

I have used info in this topic to manually edit the launch app_ids for scripts and scenes around my home. I can do it all manually with an automation and using triggers but that is much harder to maintain and update etc than using a blueprint as I am up to 18 app_ids.

I think one of the problems is the app_id’s that get passed from the roku_command events are presented within quotations, where-as the key presses are not. eg.

event_type: roku_command
data:
  source_name: Home Assistant
  type: launch
  app_id: "8"
origin: LOCAL
time_fired: "2024-06-02T12:08:42.436069+00:00"
context:
  id: XXX
  parent_id: null
  user_id: null

event_type: roku_command
data:
  source_name: Home Assistant
  type: keypress
  key: Info
origin: LOCAL
time_fired: "2024-06-02T12:08:50.355953+00:00"
context:
  id: XXX
  parent_id: null
  user_id: null

Can’t figure out how to get that passed along this blueprint so it calls the correct action.

I am not using an blueprint at all for this.

Here is my automation which covers all key presses from my two sofabaton’s (X1 and X1S) in different rooms:

alias: SofaBaton Emulated Roku (Living Room & bed room)
description: Receives Emulated Roku commands from SofaBaton
trigger:
  - platform: event
    event_type: roku_command
    event_data:
      source_name: Home Assistant
condition: []
action:
  - alias: Check Roku Command Type
    choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.type == 'keypress'}}"
            alias: Command Type keypress?
        sequence:
          - alias: select between different keypress key's
            choose:
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.key == 'VolumeUp'}}"
                    alias: Volume up
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.key == 'VolumeDown'}}"
                    alias: Volume down
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.key == 'VolumeMute'}}"
                    alias: VolumeMute
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.key == 'Select'}}"
                    alias: Select
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.key == 'Up'}}"
                    alias: Up
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.key == 'Down'}}"
                    alias: Down
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.key == 'Left'}}"
                    alias: Left
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.key == 'Right'}}"
                    alias: Right
                sequence: []
        alias: Command Type keypress
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.type == 'launch'}}"
            alias: Command Type launch (app)?
        sequence:
          - alias: select between different app key's
            choose:
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '1'}}"
                    alias: Ambilight On?
                sequence:
                  - service: light.turn_on
                    target:
                      entity_id:
                        - light.schlafzimmer
                    data: {}
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '2'}}"
                    alias: Ambilight Off?
                sequence:
                  - service: light.turn_off
                    metadata: {}
                    data: {}
                    target:
                      entity_id: light.schlafzimmer
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '3'}}"
                    alias: Lights On?
                sequence:
                  - service: light.turn_on
                    metadata: {}
                    data: {}
                    target:
                      entity_id: light.schlafzimmer
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '4'}}"
                    alias: Lights Off?
                sequence:
                  - service: light.turn_off
                    metadata: {}
                    data: {}
                    target:
                      entity_id: light.schlafzimmer
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '5'}}"
                    alias: Lights Brighter?
                sequence:
                  - service: script.schlafzimmer_adjust_brightness_if_on
                    data:
                      brightness_step_pct: 20
                      transition: 1
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '6'}}"
                    alias: Lights Dimmer?
                sequence:
                  - service: script.schlafzimmer_adjust_brightness_if_on
                    data:
                      brightness_step_pct: -20
                      transition: 1
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '7'}}"
                    alias: Covers down?
                sequence:
                  - service: script.schlafzimmer_rollo_runter_if_window_closed
                    data: {}
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '8'}}"
                    alias: Covers up?
                sequence:
                  - service: cover.open_cover
                    data: {}
                    target:
                      entity_id:
                        - cover.schlafzimmer_rollo
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '9'}}"
                    alias: Covers W. down?
                sequence:
                  - service: script.schlafzimmer_rollo_runter_if_window_closed
                    data: {}
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '10'}}"
                    alias: Covers W. up?
                sequence:
                  - service: cover.open_cover
                    data: {}
                    target:
                      entity_id:
                        - cover.schlafzimmer_rollo
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '11'}}"
                    alias: Covers D. down?
                sequence:
                  - service: script.schlafzimmer_rollo_runter_if_window_closed
                    data: {}
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '12'}}"
                    alias: Covers D. up?
                sequence:
                  - service: cover.open_cover
                    data: {}
                    target:
                      entity_id:
                        - cover.schlafzimmer_rollo
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '13'}}"
                    alias: Scene Next?
                sequence:
                  - service: script.schlafzimmer_scene_toggle
                    data: {}
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '14'}}"
                    alias: Scene Bright?
                sequence:
                  - service: scene.turn_on
                    metadata: {}
                    target:
                      entity_id: scene.schlafzimmer_hell
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '15'}}"
                    alias: Scene Reading?
                sequence:
                  - service: scene.turn_on
                    metadata: {}
                    target:
                      entity_id: scene.schlafzimmer_lesen
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '16'}}"
                    alias: Scene Nightlight?
                sequence:
                  - service: scene.turn_on
                    metadata: {}
                    target:
                      entity_id: scene.schlafzimmer_nachtlicht
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '17'}}"
                    alias: Scene TV-Lights?
                sequence:
                  - service: light.turn_off
                    metadata: {}
                    target:
                      entity_id: light.schlafzimmer
                    data: {}
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '18'}}"
                    alias: Emulated App 1?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '19'}}"
                    alias: Emulated App 2?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '20'}}"
                    alias: Emulated App 3?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '21'}}"
                    alias: Emulated App 4?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '22'}}"
                    alias: Emulated App 5?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '23'}}"
                    alias: Emulated App 6?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '24'}}"
                    alias: Emulated App 7?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '25'}}"
                    alias: Emulated App 8?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '26'}}"
                    alias: Emulated App 9?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '27'}}"
                    alias: Emulated App 10?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '51'}}"
                    alias: Ambilight On?
                sequence:
                  - service: switch.turn_on
                    target:
                      entity_id:
                        - switch.wohnzimmer_tv_ambilight
                    data: {}
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '52'}}"
                    alias: Ambilight Off?
                sequence:
                  - service: switch.turn_off
                    metadata: {}
                    data: {}
                    target:
                      entity_id: switch.wohnzimmer_tv_ambilight
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '53'}}"
                    alias: Lights On?
                sequence:
                  - service: light.turn_on
                    metadata: {}
                    data: {}
                    target:
                      entity_id: light.wohnzimmer
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '54'}}"
                    alias: Lights Off?
                sequence:
                  - service: light.turn_off
                    metadata: {}
                    data: {}
                    target:
                      entity_id: light.wohnzimmer
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '55'}}"
                    alias: Lights Brighter?
                sequence:
                  - service: script.wohnzimmer_adjust_brightness_if_on
                    data:
                      brightness_step_pct: 20
                      transition: 1
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '56'}}"
                    alias: Lights Dimmer?
                sequence:
                  - service: script.wohnzimmer_adjust_brightness_if_on
                    data:
                      brightness_step_pct: -20
                      transition: 1
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '57'}}"
                    alias: Covers down?
                sequence:
                  - service: cover.close_cover
                    data: {}
                    target:
                      entity_id:
                        - cover.wohnzimmer_rollo_fenster_gross
                  - service: script.wohnzimmer_rollo_klein_runter_if_closed
                    data: {}
                  - service: script.wohnzimmer_rollo_tur_runter_if_door_closed
                    data: {}
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '58'}}"
                    alias: Covers up?
                sequence:
                  - service: cover.open_cover
                    data: {}
                    target:
                      entity_id:
                        - cover.wohnzimmer_rollo_fenster_gross
                        - cover.wohnzimmer_rollo_fenster_klein
                        - cover.wohnzimmer_rollo_tur
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '59'}}"
                    alias: Covers W. down?
                sequence:
                  - service: cover.close_cover
                    data: {}
                    target:
                      entity_id:
                        - cover.wohnzimmer_rollo_fenster_gross
                  - service: script.wohnzimmer_rollo_klein_runter_if_closed
                    data: {}
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '60'}}"
                    alias: Covers W. down?
                sequence:
                  - service: cover.open_cover
                    data: {}
                    target:
                      entity_id:
                        - cover.wohnzimmer_rollo_fenster_gross
                        - cover.wohnzimmer_rollo_fenster_klein
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '61'}}"
                    alias: Covers D. down?
                sequence:
                  - service: script.wohnzimmer_rollo_tur_runter_if_door_closed
                    data: {}
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '62'}}"
                    alias: Covers D. up?
                sequence:
                  - service: cover.open_cover
                    data: {}
                    target:
                      entity_id:
                        - cover.wohnzimmer_rollo_tur
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '63'}}"
                    alias: Scene Next?
                sequence:
                  - service: script.wohnzimmer_scene_toggle
                    data: {}
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '64'}}"
                    alias: Szene Bright?
                sequence:
                  - service: scene.turn_on
                    metadata: {}
                    target:
                      entity_id: scene.wohnzimmer_hell
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '65'}}"
                    alias: Scene Reading?
                sequence:
                  - service: scene.turn_on
                    metadata: {}
                    target:
                      entity_id: scene.wohnzimmer_lesen
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '66'}}"
                    alias: Scene Nightlight?
                sequence:
                  - service: scene.turn_on
                    metadata: {}
                    target:
                      entity_id: scene.wohnzimmer_nachtlicht
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '67'}}"
                    alias: Scene TV-Lights?
                sequence:
                  - service: scene.turn_on
                    metadata: {}
                    target:
                      entity_id: scene.wohnzimmer_fernsehlicht
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '68'}}"
                    alias: Emulated App 1?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '69'}}"
                    alias: Emulated App 2?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '70'}}"
                    alias: Emulated App 3?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '71'}}"
                    alias: Emulated App 4?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '72'}}"
                    alias: Emulated App 5?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '73'}}"
                    alias: Emulated App 6?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '74'}}"
                    alias: Emulated App 7?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '75'}}"
                    alias: Emulated App 8?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '76'}}"
                    alias: Emulated App 9?
                sequence: []
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.app_id == '77'}}"
                    alias: Emulated App 10?
                sequence: []
        alias: Command Type launch (app)
mode: single

Hope this helps
pOpY

Hi Rohan, have been using you blueprint for quite a while with Harmony remote. Now I’ve switched to Sofabaton XS1 and had the need for more buttons. I guess the number of buttons supported in emulated Roku has been extended over the last couple of years. So I’ve created an Emulated Roku Extended blueprint with the additional buttons:

  1. emulated_app_1
  2. emulated_app_2
  3. emulated_app_3
  4. emulated_app_4
  5. emulated_app_5
  6. emulated_app_6
  7. emulated_app_7
  8. emulated_app_8
  9. emulated_app_9
  10. inputạv1
  11. inputhdmi1
  12. inputhdmi2
  13. inputhdmi3
  14. inputhdmi4
  15. inputtuner
  16. ok
  17. poweron
  18. poweroff
  19. volumedown
  20. volumemute
  21. volumeup

I will provide the full code in a second comment. Would you be willing to include this in the original blueprint? Of shall I create a new one for this?

By the way, the extended blueprint can be saved in \config\blueprints\automation\ as yaml file (emulated_roku_extended.yaml for instance) and then an existing automation based on the blueprint can be upgraded. Best way is to open the blueprint based automation in yaml edit mode and update the location and name of the blueprint to the name and location used for the extended script.

blueprint:
  name: Emulated Roku Extended
  description: Create Automations for Emulated Roku Keypresses
  domain: automation
  input:
    emulated_roku_name:
      name: Emulated Roku Name
      description: The name of the Emulated Roku
      selector:
        text:
          multiline: false
          multiple: false
    up_action:
      name: '"Up" Button

        '
      description: 'Action to run, when the "Up" button is pressed

        '
      default: []
      selector:
        action: {}
    right_action:
      name: '"Right" Button

        '
      description: 'Action to run, when the "Right" button is pressed

        '
      default: []
      selector:
        action: {}
    down_action:
      name: '"Down" Button

        '
      description: 'Action to run, when the "Down" button is pressed

        '
      default: []
      selector:
        action: {}
    left_action:
      name: '"Left" Button

        '
      description: 'Action to run, when the "Left" button is pressed

        '
      default: []
      selector:
        action: {}
    home_action:
      name: '"Home" Button

        '
      description: 'Action to run, when the "Home" button is pressed

        '
      default: []
      selector:
        action: {}
    search_action:
      name: '"Search" Button

        '
      description: 'Action to run, when the "Search" button is pressed

        '
      default: []
      selector:
        action: {}
    rev_action:
      name: '"Rev" Button

        '
      description: 'Action to run, when the "Rev" button is pressed

        '
      default: []
      selector:
        action: {}
    fwd_action:
      name: '"Fwd" Button

        '
      description: 'Action to run, when the "Fwd" button is pressed

        '
      default: []
      selector:
        action: {}
    play_action:
      name: '"Play" Button

        '
      description: 'Action to run, when the "Play" button is pressed

        '
      default: []
      selector:
        action: {}
    select_action:
      name: '"Select" Button

        '
      description: 'Action to run, when the "Select" button is pressed

        '
      default: []
      selector:
        action: {}
    back_action:
      name: '"Back" Button

        '
      description: 'Action to run, when the "Back" button is pressed

        '
      default: []
      selector:
        action: {}
    instantreplay_action:
      name: '"InstantReplay" Button

        '
      description: 'Action to run, when the "InstantReplay" button is pressed

        '
      default: []
      selector:
        action: {}
    info_action:
      name: '"Info" Button

        '
      description: 'Action to run, when the "Info" button is pressed

        '
      default: []
      selector:
        action: {}
    backspace_action:
      name: '"BackSpace" Button

        '
      description: 'Action to run, when the "BackSpace" button is pressed

        '
      default: []
      selector:
        action: {}
    enter_action:
      name: '"Enter" Button

        '
      description: 'Action to run, when the "Enter" button is pressed

        '
      default: []
      selector:
        action: {}
    emulated_app_1_action:
      name: '"Emulated App 1" Button

        '
      description: 'Action to run, when the "Emulated App 1" button is pressed

        '
      default: []
      selector:
        action: {}
    emulated_app_2_action:
      name: '"Emulated App 2" Button

        '
      description: 'Action to run, when the "Emulated App 2" button is pressed

        '
      default: []
      selector:
        action: {}
    emulated_app_3_action:
      name: '"Emulated App 3" Button

        '
      description: 'Action to run, when the "Emulated App 3" button is pressed

        '
      default: []
      selector:
        action: {}
    emulated_app_4_action:
      name: '"Emulated App 4" Button

        '
      description: 'Action to run, when the "Emulated App 4" button is pressed

        '
      default: []
      selector:
        action: {}
    emulated_app_5_action:
      name: '"Emulated App 5" Button

        '
      description: 'Action to run, when the "Emulated App 5" button is pressed

        '
      default: []
      selector:
        action: {}
    emulated_app_6_action:
      name: '"Emulated App 6" Button

        '
      description: 'Action to run, when the "Emulated App 6" button is pressed

        '
      default: []
      selector:
        action: {}
    emulated_app_7_action:
      name: '"Emulated App 7" Button

        '
      description: 'Action to run, when the "Emulated App 7" button is pressed

        '
      default: []
      selector:
        action: {}
    emulated_app_8_action:
      name: '"Emulated App 8" Button

        '
      description: 'Action to run, when the "Emulated App 8" button is pressed

        '
      default: []
      selector:
        action: {}
    emulated_app_9_action:
      name: '"Emulated App 9" Button

        '
      description: 'Action to run, when the "Emulated App 9" button is pressed

        '
      default: []
      selector:
        action: {}
    inputạv1_action:
      name: '"InputẠV1" Button

        '
      description: 'Action to run, when the "InputẠV1" button is pressed

        '
      default: []
      selector:
        action: {}
    inputhdmi1_action:
      name: '"InputHDMI1" Button

        '
      description: 'Action to run, when the "InputHDMI1" button is pressed

        '
      default: []
      selector:
        action: {}
    inputhdmi2_action:
      name: '"InputHDMI2" Button

        '
      description: 'Action to run, when the "InputHDMI2" button is pressed

        '
      default: []
      selector:
        action: {}
    inputhdmi3_action:
      name: '"InputHDMI3" Button

        '
      description: 'Action to run, when the "InputHDMI3" button is pressed

        '
      default: []
      selector:
        action: {}
    inputhdmi4_action:
      name: '"InputHDMI4" Button

        '
      description: 'Action to run, when the "InputHDMI4" button is pressed

        '
      default: []
      selector:
        action: {}
    inputtuner_action:
      name: '"InputTuner" Button

        '
      description: 'Action to run, when the "InputTuner" button is pressed

        '
      default: []
      selector:
        action: {}
    ok_action:
      name: '"Ok" Button

        '
      description: 'Action to run, when the "Ok" button is pressed

        '
      default: []
      selector:
        action: {}
    poweron_action:
      name: '"PowerOn" Button

        '
      description: 'Action to run, when the "PowerOn" button is pressed

        '
      default: []
      selector:
        action: {}
    poweroff_action:
      name: '"PowerOff" Button

        '
      description: 'Action to run, when the "PowerOff" button is pressed

        '
      default: []
      selector:
        action: {}
    volumedown_action:
      name: '"VolumeDown" Button

        '
      description: 'Action to run, when the "VolumeDown" button is pressed

        '
      default: []
      selector:
        action: {}
    volumemute_action:
      name: '"VolumeMute" Button

        '
      description: 'Action to run, when the "VolumeMute" button is pressed

        '
      default: []
      selector:
        action: {}
    volumeup_action:
      name: '"VolumeUp" Button

        '
      description: 'Action to run, when the "VolumeUp" button is pressed

        '
      default: []
      selector:
        action: {}

  source_url: https://community.home-assistant.io/t/emulated-roku/325451
mode: single
max_exceeded: silent
variables:
  emulated_roku_name: !input emulated_roku_name
trigger:
- platform: event
  event_type: roku_command
condition:
- condition: template
  value_template: '{{ trigger.event.data.source_name == emulated_roku_name }}'
- condition: template
  value_template: '{{ trigger.event.data.type == "keypress" }}'
action:
- variables:
    key_id: '{{ trigger.event.data.key }}'
- choose:
  - conditions: '{{ key_id == "Up" }}'
    sequence: !input up_action
  - conditions: '{{ key_id == "Right" }}'
    sequence: !input right_action
  - conditions: '{{ key_id == "Down" }}'
    sequence: !input down_action
  - conditions: '{{ key_id == "Left" }}'
    sequence: !input left_action
  - conditions: '{{ key_id == "Home" }}'
    sequence: !input home_action
  - conditions: '{{ key_id == "Search" }}'
    sequence: !input search_action
  - conditions: '{{ key_id == "Rev" }}'
    sequence: !input rev_action
  - conditions: '{{ key_id == "Fwd" }}'
    sequence: !input fwd_action
  - conditions: '{{ key_id == "Play" }}'
    sequence: !input play_action
  - conditions: '{{ key_id == "Select" }}'
    sequence: !input select_action
  - conditions: '{{ key_id == "Back" }}'
    sequence: !input back_action
  - conditions: '{{ key_id == "InstantReplay" }}'
    sequence: !input instantreplay_action
  - conditions: '{{ key_id == "Info" }}'
    sequence: !input info_action
  - conditions: '{{ key_id == "BackSpace" }}'
    sequence: !input backspace_action
  - conditions: '{{ key_id == "Enter" }}'
    sequence: !input enter_action
  - conditions: '{{ key_id == "Emulated App 1" }}'
    sequence: !input emulated_app_1_action
  - conditions: '{{ key_id == "Emulated App 2" }}'
    sequence: !input emulated_app_2_action
  - conditions: '{{ key_id == "Emulated App 3" }}'
    sequence: !input emulated_app_3_action
  - conditions: '{{ key_id == "Emulated App 4" }}'
    sequence: !input emulated_app_4_action
  - conditions: '{{ key_id == "Emulated App 5" }}'
    sequence: !input emulated_app_5_action
  - conditions: '{{ key_id == "Emulated App 6" }}'
    sequence: !input emulated_app_6_action
  - conditions: '{{ key_id == "Emulated App 7" }}'
    sequence: !input emulated_app_7_action
  - conditions: '{{ key_id == "Emulated App 8" }}'
    sequence: !input emulated_app_8_action
  - conditions: '{{ key_id == "Emulated App 9" }}'
    sequence: !input emulated_app_9_action
  - conditions: '{{ key_id == "InputẠV1" }}'
    sequence: !input inputạv1_action
  - conditions: '{{ key_id == "InputHDMI1" }}'
    sequence: !input inputhdmi1_action
  - conditions: '{{ key_id == "InputHDMI2" }}'
    sequence: !input inputhdmi2_action
  - conditions: '{{ key_id == "InputHDMI3" }}'
    sequence: !input inputhdmi3_action
  - conditions: '{{ key_id == "InputHDMI4" }}'
    sequence: !input inputhdmi4_action
  - conditions: '{{ key_id == "InputTuner" }}'
    sequence: !input inputtuner_action
  - conditions: '{{ key_id == "Ok" }}'
    sequence: !input ok_action
  - conditions: '{{ key_id == "PowerOn" }}'
    sequence: !input poweron_action
  - conditions: '{{ key_id == "PowerOff" }}'
    sequence: !input poweroff_action
  - conditions: '{{ key_id == "VolumeDown" }}'
    sequence: !input volumedown_action
  - conditions: '{{ key_id == "VolumeMute" }}'
    sequence: !input volumemute_action
  - conditions: '{{ key_id == "VolumeUp" }}'
    sequence: !input volumeup_action

Hi, I guess we had the same challenge. See my post with the extended blueprint that I’ve created. I hope Rohan can integrate it into the original one.

Regards,

Niels

Thanks Niels!