Emulated Roku for Harmony

Maybe. A lot of it depends on the timing of when HA sees that and how quickly it starts the processor. In an ideal world, I’d start the TV, then processor, wait until it’s up and running, then turn on the rest. I’ll see about testing and how the equipment behaves. HDMI can be finicky about startup order sometimes.

I just got the Emulated Roku integration with Harmony working in my theater. Has anyone found a solution for triggering an automation on Pause? It seems like Roku uses Play for both Play and Pause?

There are 15 available key codes. These can be mapped to any of the physical keys on your remote. If you need more than 15 keys, you can create a second emulated roku.
Available key codes:
Home
Rev
Fwd
Play
Select
Left
Right
Down
Up
Back
InstantReplay
Info
BackSpace
Search
Enter

@ Hackashaq666 thanks for this tip, just used this to map out some more keys for my TV box.

Does anyone know if there is any way to send number keys to HomeAssistant? i.e. I have my favourite channels like 101 for BBC, but Emulated Roku doesn’t recognise those.

Thanks, how do you get Harmony to send the command to both your actual device and mirror it to the emulated Roku?

Add a Roku device to Harmony and make a “Watch Roku” routine.

Map the buttons on your harmony to the Roku commands first on the Harmony app or on your PC connected via USB to the remote.

Install LG Horizon to get your tv box registered in HA

Install Emulated Roku to HA and find your new fake Roku device

Use the blueprint below to remap the Roku buttons to send LG Horizon commands to your tv box entity

Not sure what you mean by actual device.
Emulated Roku is generally used to enable the harmony remote to control automations in homeassistant. Once the emulated Roku is included in an actvity in the harmony remote, any remote button in that activity can be mapped to one of the 15 roku keys. The roku keys are detected in homeassistant and can be used to trigger automations.

Thanks, I understand that. But I’m looking to trigger automations when I press pause and play. Meaning that those commands need to be sent to the real device (blu ray player, shield, set top box, etc.) and also to HA, which I thought was what Emulated Roku was for. Looking around the Harmony app, it seems like I can only have a command sent to one device at a time? Or am misunderstanding something? How is everyone triggering pause automations?

One way to do this:
Set the pause button to send the emulated roku key.
Include the pause command in the homeassistant automation using the Logitech Harmony Hub Integration.

I do this with mine. I set the play and pause buttons as Roku keys, then in HA set this to play/pause the Harmony device ID. Then write an automation that when each button is pressed the action runs (in my instance, pause = lamp turns on, play = lamp turns off).

That makes sense, thanks guys. I will give it a try. A bit unfortunate to have HA in the middle of Harmony’s playback operation (if HA goes down then Harmony can’t play or pause), but it seems like that’s the easiest option…

Yep agreed, if HA goes down t breaks.
What I have qs a backup option is each button set the long press as the direct Harmony function…

2 Likes

Harmony also offers Sequences, where one button in an activity can send out more than one command (not simultaneously, but sequentially as the feature name implies). Might work ok for some use-cases. And I believe these would continue to work even if HA wasn’t available (I’d thoroughly test this though to be sure…if it only times out after some length of time, and prevents using the remote during the timeout period, that could get frustrating).

2 Likes

Good point, completely forgot about sequences

1 Like

Yes! I just discovered sequences when poking around in the Harmony app and that’s exactly what I was looking for. Tested it out where play/pause is sent to the device and then also to HA and it works perfectly!

I’m trying to get Emulated Roku setup, but when I add the integration, no matter what port I configure it to use, I get an error “Address already in use” and I’m unable to view the Emulated Roku at ip:8060 (or whatever port I’ve setup the integration to use). And when I scan for devices in the MyHarmony app, it doesn’t find the Emulated Roku.

Here is the trace:

2023-01-10 19:23:54.893 ERROR (MainThread) [homeassistant.components.emulated_roku] Failed to start Emulated Roku RokuHA on 192.168.0.109:8068
Traceback (most recent call last):
  File "/Users/eengert/homeassistant/lib/python3.10/site-packages/homeassistant/components/emulated_roku/binding.py", line 142, in emulated_roku_start
    await self._api_server.start()
  File "/Users/eengert/homeassistant/lib/python3.10/site-packages/emulated_roku/__init__.py", line 419, in start
    self.sock.bind(("", MULTICAST_PORT))
OSError: [Errno 48] Address already in use

EDIT: I’ve since tried setting up HA and Emulated Roku on a different Mac and I get the exact same issues. No matter what ports I try, Emulated Roku gets an “Address already in use” error when trying to start.

So I am running HASS in a docker container with network as bridge. Is there a way to make this work? It works when I set network to host but that is not a great idea.

A long time ago I added a Roku device to MyHarmony :

image

I have mapped buttons on the Harmony remote to Roku keys, wich fire events in Home Assistant…works great !

But…only the Roku keys listed here are working. The problem is that not all listed keys are available in the Harmony Software.

F.e. “channel_down” is not available :

image

Which Roku device should I chose to get the most of the working keys ?

click buttons in the roku device and see what event’s appear. Chances are it’s the page up / page down buttons.

Nope :unamused:

But…is there a way to get the name of the key ?

This is fired :

  - platform: event
    event_type: roku_command
    event_data:
      source_name: Home Assistant
      type: keypress
    id: general

Now, how can I get the name of the key ?

      - conditions:
          - condition: trigger
            id:
              - general
        sequence: