Emulated Roku for Harmony


Seems a bit daft though given hass.io is already 3.6, looks like were heading towards more hass.io only functions than the other way around given that’s where most new things seem to be happening now.


Well these are the guidelines so far. Feel free to take this discussion with balloob :slight_smile: I am not a deciding party in this


I just got this, not sure what it means but I though I should post it here.
I’m on hass.io (0.59.2)

2017-12-15 00:22:11 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/tasks.py", line 179, in _step
    result = coro.send(None)
  File "/usr/lib/python3.6/asyncio/coroutines.py", line 210, in coro
    res = func(*args, **kw)
  File "/config/custom_components/emulated_roku.py", line 138, in stop_emulated_roku
AttributeError: 'tuple' object has no attribute 'close'


I’m using hass.io so all up to date, it only affects those still going old school so I’ll leave it to them :slight_smile:


Multiple return values are not unpacked when creating the server because I changed it to fix a warning. Guess the warning was wrong. Should only happen when shutting down home assistant I think.


How annoying Roku uses Play for both play and pause :anguished:


@mindigmarton Fantastic job on this component!! Wow, seriously. This brings Harmony to the next level. Truly a must have for any Harmony user. Can’t wait for it to be merged upstream! You have created the functionality for HA users to turn their Harmony remotes into full blown HA controllers. This is even better than using emulated_hue since Harmony places the arbitrary restriction on controlling Hue devices to “home control” buttons (available only on their more expensive models, of course).

Something I found useful when setting this up that I would suggest including in the documentation:

tail -f home-assistant.log -n 0 | grep roku_command

Once the Roku is set up in Harmony app, you can trace the button presses through the Home Assistant log using the above command (this also exposes the Roku USN which is helpful for initial automations). Of course this requires setting the HA log level to INFO (include logger: in your configuration.yaml). Of most value here is the key value for each keypress.

Is there some URL that can be visited once the emulated Roku is running through HA to confirm it is running correctly? Something similar to the emulated_hue troubleshooting section.



Yeah, I wrote this because emulated_hue limited me to 4 buttons…

Updated the README with more instructions. You can also get the serial from Harmony (it’s case sensitive) or the Roku API reachable at the ports specified.

Pushed a new version with fixes for the errors when shutting down HASS.


I can confirm your fix for the shutdown errors worked perfectly :slight_smile:

I’m currently not home so I can’t test anything, but I still fiddling with some HA config… How would I go about to configure an action (Harmony Elite control) to trigger an automation in HA?

Also, can I use the color buttons on the remote? I didn’t find them in the list over compatible buttons.

Btw, before some update I saw “emulated_roku” under states, but that is gone now, why?


You configure an automation to trigger on the event that the emulated roku fires when the button is pressed on your Harmony remote. This button can be any of the buttons exposed to Roku (and is in the list of buttons from the component README). To assign the button on your remote you do that from the Harmony app or software and map it to the button on the emulated roku that you configured your automation to listen to.

HASS, Harmony Hub / remote and Broadlink RM Pro

Unfortunately you cannot use the “Home Control” buttons as they are reserved for smart device integrations such as Hue.
For that, you can use emulated_hue.

You probably saw the roku because you had autodiscovery on or the Roku component configured and HASS discovered the emulated_roku :slight_smile:


You can, make sure they’re unassigned in the home control section and then they become available as normal buttons, I control a standalone IR dimmer with one of mine.


Can someone explain what the app_id is and how to use it?


It’s the same things as normal keys basically, you shouldn’t need it unless you have a remote that can launch apps.
That said, Harmony can’t launch apps on Roku over WiFi. I think it uses IR for that.

The Home Control buttons are not available for me in the Activity Control Buttons menu with the Hub’s Companion remote. Can only use them when I add Hue…

Hacking the Harmony Home Control buttons
Emulated_hue vs Home Assistant Cloud

This is how it looks for me.


I’ve got the 950 like @ZyberSE so I guess it may just be a limitation of the Companion.


Well I still get an error that the component could not be setup. What am I doing wrong

  upnp_bind_multicast: True
    - 8060

Unable to find component emulated_roku


Host ip should be just the IP without the http:// part.
Have you copied the emulated_roku.py file to the custom_components folder?


Thx that did the trick… I now dont get any errors on the log, but when i visit i get nothing and the roku is not discoverable in the hamony app. I cant seem to find any roku device in the entities list in HA


The roku component should only exist if you have configured media_player.roku in HASS.
Do you see “Initializing emulated roku” and “Intializing emulated roku” in the logs?