Emulated Roku Automation Handler Blueprint

This blueprint allows you to choose actions for every emulated harmony command.
I map buttons from my logitech harmony remote to emulated roku, this blueprint then allows them each to be assigned to actions.
Now i can control my lights and chromecast (and anything) from my harmony remote.

Currently you have to type the name of your emulated roku, i couldnt get the selector working. If anyone has any info on how i can do this please let me know.

blueprint:
  name: Emulated Roku Automation Chooser
  description: 'Control anything using emulated roku and a harmony remote"'
  domain: automation
  input:
    emulated_roku:
      name: Emulated Roku
      description: Type the name of your emulated roku (can be found by going to Configuration, Integrations, Emulated Roku)
#      selector:
#        device:
#          integration: 
#          manufacturer: 
#          model: 
    Home:
      name: Home
      description: Action to run on press Home
      default: []
      selector:
        action: {}
    Rev:
      name: Rev
      description: Action to run on press Rev
      default: []
      selector:
        action: {}
    Fwd:
      name: Fwd
      description: Action to run on press Fwd
      default: []
      selector:
        action: {}
    Play:
      name: Play
      description: Action to run on press play
      default: []
      selector:
        action: {}
    Select:
      name: Select
      description: Action to run on press select
      default: []
      selector:
        action: {}
    Left:
      name: Left
      description: Action to run on press left
      default: []
      selector:
        action: {}
    Right:
      name: Right
      description: Action to run on press Right
      default: []
      selector:
        action: {}
    Down:
      name: Down
      description: Action to run on press down
      default: []
      selector:
        action: {}
    Up:
      name: Up
      description: Action to run on press Up
      default: []
      selector:
        action: {}
    Back:
      name: Back
      description: Action to run on press back
      default: []
      selector:
        action: {}
    InstantReplay:
      name: InstantReplay
      description: Action to run on press instant replay
      default: []
      selector:
        action: {}
    Info:
      name: Info
      description: Action to run on press info
      default: []
      selector:
        action: {}
    BackSpace:
      name: BackSpace
      description: Action to run on press backspace
      default: []
      selector:
        action: {}
    Search:
      name: Search
      description: Action to run on press search
      default: []
      selector:
        action: {}
    Enter:
      name: Enter
      description: Action to run on press enter
      default: []
      selector:
        action: {}        
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: roku_command
  event_data:
    source_name: !input 'emulated_roku'
action:
- variables:
    event: '{{ trigger.event.data.key }}'
- choose:
  - conditions:
    - '{{ event == "Home" }}'
    sequence: !input 'Home'
  - conditions:
    - '{{ event == "Rev" }}'
    sequence: !input 'Rev'
  - conditions:
    - '{{ event == "Fwd" }}'
    sequence: !input 'Fwd'
  - conditions:
    - '{{ event == "Play" }}'
    sequence: !input 'Play'
  - conditions:
    - '{{ event == "Select" }}'
    sequence: !input 'Select'
  - conditions:
    - '{{ event == "Left" }}'
    sequence: !input 'Left'
  - conditions:
    - '{{ event == "Right" }}'
    sequence: !input 'Right'
  - conditions:
    - '{{ event == "Down" }}'
    sequence: !input 'Down'
  - conditions:
    - '{{ event == "Up" }}'
    sequence: !input 'Up'
  - conditions:
    - '{{ event == "Back" }}'
    sequence: !input 'Back'
  - conditions:
    - '{{ event == "InstantReplay" }}'
    sequence: !input 'InstantReplay'
  - conditions:
    - '{{ event == "Info" }}'
    sequence: !input 'Info'
  - conditions:
    - '{{ event == "BackSpace" }}'
    sequence: !input 'BackSpace'
  - conditions:
    - '{{ event == "Search" }}'
    sequence: !input 'Search'
  - conditions:
    - '{{ event == "Enter" }}'
    sequence: !input 'Enter'

3 Likes

thank you for sharing your blueprint :slight_smile:

2 little remarks :

  • Backspace should be renamed to BackSpace to trigger
  • you can add the undocumented button PowerOff which is available on Harmony remotes.

I donā€™t know if you are also using this with Harmony, but I couldnā€™t find how to map the button ā€œEnterā€ using the Harmony mobile app on my 950 remote, did you ?

PS: I couldnā€™t find a way to activate the Roku selector either

Thanks, Iā€™ve corrected BackSpace.
I wasnā€™t aware of power off, Iā€™ll look into that.
I have a harmony hub and remote, I seem to remember using the web app to select a button and assign any Roku command to it

@samnewman86 Still new so thank you very much for this blueprint, lighting control via Harmony was my primary goal. Question for you when setting the commands, is there a way to include conditions where these commands are only triggered for specific activities and not others? I have a flat screen that is my daily driver then a screen that comes down in front for movie time and I would like to set it up so that only those projector driven activities control the light. I have taken a shot at that and have so far been unsuccessful, any help is appreciated.

and just after typing this I decided to give it one more shot and I think I have it working. To help anyone else (and verify I did indeed do this right) that got to this topic with a similar use case please see the screenshot for what mine looks like and seems to be working.

You could also select a choose action. This enables you to set conditions and subsequent actions determined by those conditions.

So brand new to home assistant so please be gentle. Have home assistant running as a vm on my unraid nas. wanted to incorporate my tp-link wifi lights into my logitech harmony hub based remote and saw your blueprint.

I was able to upload the blueprint and get to the create automation page, I put my emulated roku down, and have ā€œsearchā€ mapped on my harmony remote. When i select my bedroom lights toggle from the drop down menu and hit save, nothing seems to happen.

When i look at my automations tab, nothing is listed. When i try to use the search button in logitech, it doesnā€™t toggle the lights. How do i get the automation created from this blueprint to show up in the UI?
Where did i go wrong?

Edit:. Sorted it out. Must have inadvertently messed w configuration.yaml. Restored old backup and itā€™s working now.

Can this ā€œkey mappingā€ work for the smart home buttons? Like the light bulb and outlet buttons on my Harmony Elite remote?

I just found this post and I donā€™t know how to make an ā€œemulated rokuā€. Iā€™ll search for that and hopefully find it. Or if you can tell me how to find it, would appreciate it greatly.

Thanks in advance. This looks like just exactly what I want because I have an Insteon Hub that was working with the remote until Insteon bailed.

ā€¦ moments passed ā€¦

Ah, I see the emulated roku is just another integration. Iā€™ll see if I can spot the smart home buttons in that.

ā€¦ time passes ā€¦

Rats. I read this in the document:

Home control buttons cannot be assigned to emulated Roku on the 
Harmony Hub Companion remote as they are limited to 
Hue (and possibly other APIs) within Harmony.

Running this I get an error. Trace shows
Error:UndefinedError: ā€˜dict objectā€™ has no attribute ā€˜eventā€™

Canā€™t figure out if this is stopping the automation working but I canā€™t get it to run. Iā€™m trying to run it with harmony hub and I have got the emulated Roku in Harmony and made a sequence to a button I want but nothing working as this above error happens.

Any help?

Any way to get the integrate button on this post?

Had this irritating error in my logs for long but cant figure out whatā€™s wrong. Automations seems to work fine.

Blueprint Emulated Roku Automation Chooser generated invalid automation with inputs OrderedDict([('emulated_roku', 'Home Assistant'), ('Play', [OrderedDict([('service', 'media_player.media_play'), ('data', OrderedDict()), ('target', OrderedDict([('device_id', '8fca9058c6509e0da6708d45e5670b97')]))])]), ('Pause', [OrderedDict([('service', 'media_player.media_play_pause'), ('data', OrderedDict()), ('target', OrderedDict([('device_id', '8fca9058c6509e0da6708d45e5670b97')]))])]), ('Fwd', [OrderedDict([('service', 'media_player.media_seek'), ('data', OrderedDict([('seek_position', " {{ ( as_timestamp(now()) - as_timestamp(state_attr(entity, ''media_position_updated_at'')) + state_attr(entity, ''media_position'') ) | float + interval }} ")])), ('target', OrderedDict([('device_id', '8fca9058c6509e0da6708d45e5670b97')]))])]), ('Search', [OrderedDict([('service', 'media_player.media_pause'), ('data', OrderedDict()), ('target', OrderedDict([('device_id', '8fca9058c6509e0da6708d45e5670b97')]))])])]): template value should be a string for dictionary value @ data['action'][1]['choose'][2]['sequence'][0]['data']. Got None

Anyone got an idea?