Emulated Roku for Harmony

Hello, can you please tell me how did you get the Harmony app to finally discover the emulated roku?
I’am stuck on this part and it’s really frustarting.
Thanks

You go to add new device and then scan for WiFi devices

Thank you for your kind response.

For everyone knowledge, it was a real pain to get the emulated roku to be discovered by my synology nas.

I solved it disconecting every wifi devices in my home, hue, ipad, phone, tv etc… and rebooting my home assistant on docker. After many reboots it finaly works.

Thanks for the work this emulated roku is DOPE !

Just wanted to send a big thank you for the work.
This works perfect so far and fixed the annoying issue of being able to pause chromecast from the remote.

Using Hassio

I am getting following error, windows 10. Any help appreciated!

2018-02-02 07:39:45 ERROR (MainThread) [homeassistant.core] 
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "c:\program files\python36\lib\asyncio\tasks.py", line 180, in _step
result = coro.send(None)
  File "C:\Users\Tom\AppData\Roaming\.homeassistant\custom_components\emulated_roku.py", line 127, in start_emulated_roku
discovery_server, _ = yield from discovery_endpoint
  File "c:\program files\python36\lib\asyncio\base_events.py", line 939, in create_datagram_endpoint
sock, protocol, r_addr, waiter)
  File "c:\program files\python36\lib\asyncio\base_events.py", line 323, in _make_datagram_transport
raise NotImplementedError
NotImplementedError

My config.yaml:

emulated_roku:
  host_ip: 192.168.1.19
  upnp_bind_multicast: True
  listen_ports: 
    - 8060

I also changed to upnp_bind_multicast: False and similar error.

It looks like Home Assistant uses ProactorEventLoop on Windows which does not support UDP sockets. (same issue as in the LIFX component)
Updated the README noting that Windows is not supported, sorry.

You can run emulated_roku as a standalone python cli app with the default python event loop, though you’ll need to do some coding to forward key presses to Home Assistant.

Thanks for the update.

Hi!

Any progress here with regards to getting it accepted as an integrated component?

1 Like

No, the component required Python 3.5.4 on windows because of some UDP connection parameters, and HASS’s python version didn’t have it.
Though now that it doesn’t work at all on Windows like the LIFX component I guess we can ignore that.
Didn’t have time to work on the docs either, but that shouldn’t take long…

1 Like

I just tried to install emulated roku on 0.64.2 and received the following error,

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.5/asyncio/tasks.py”, line 241, in _step
result = coro.throw(exc)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py”, line 57, in async_setup_component
return (yield from task)
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/asyncio/tasks.py”, line 239, in _step
result = coro.send(None)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py”, line 104, in _async_setup_component
component = loader.get_component(domain)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py”, line 142, in get_component
module = importlib.import_module(path)
File “/usr/lib/python3.5/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 986, in _gcd_import
File “”, line 969, in _find_and_load
File “”, line 958, in _find_and_load_unlocked
File “”, line 673, in _load_unlocked
File “”, line 669, in exec_module
File “”, line 775, in get_code
File “”, line 735, in source_to_code
File “”, line 222, in _call_with_frames_removed
File “/home/homeassistant/.homeassistant/custom_components/emulated_roku.py”, line 1

^
SyntaxError: invalid syntax

If anyone could help me, that would be amazing, this is high on the WAF score!!

Post your config and someone could probably work out what’s wrong.

Here is what I have in my config:

emulated_roku:
host_ip: 192.168.86.28
listen_ports:
- 8060

I have a manual install with a virtual environment. I tried to access at port 8060, but it didn’t connect. All I did was place the emulated_roku.py in my custom_component file

Edit: I have discovery enabled and I included roku in my media platform section. Is there any order of operations to getting the component to work? Does harmony need to discover it first before hass? very confused with this one. I am on Stretch btw

It looks like python can’t even load the file. Are you sure the contents are correct?

By contents, do you mean the emulated_roku.py? I downloaded it directly from the github, but I could try downloading the whole package and extracting the py file?

Was just coming on to suggest trying that, I’ve seen people caught before with Github, right clicking on the file name and thinking they’ve downloaded the file but in reality have downloaded an html file of the webpage it links to.

Yep, that’s what I did (stupidly). I re-download from github and it seems to be working now, as I am able to connect at myip:8060, and my Harmony was able to discover it. So I should be able to use roku_command as a trigger type now?

1 Like

You create automations for whatever you want to control as per the examples above and all should now work a treat :+1:

Awesome! Thanks so much for all the help!

Don’t know if it’s relevant to what you’re trying to do but one thing to bear in mind, unlike with emulated_hue, Harmony won’t know whether a light is on or off so you’ll need to set the automation to toggle or have a separate on and off one which you can then add to the short and long presses on your remote to create the same effect.

I also have a dim and bright scene in HA for the lounge lights I use most and these are set to the up and down brightness buttons on the remote, to do this with two sets of lights you could set different scenes to the long press for those buttons too.

Good to know! Was actually just working on the automations. I am trying to control the volume for my Yamaha Amp, which isn’t line of sight to my Harmony, so I need to use the wifi control.