Harmony Hub: trigger on remote button press

Can Harmony Hub trigger an automation rule based on a button being pressed on the remote. Ie volume up?

I thought I’d seen an example config somewhere but I can’t find any reference in the docs.

Not directly I don’t think as it only monitors activities, but you could do it using the emulated_roku component and adding the volume and the command you want as a sequence rather than just volume on its own…

Thanks @Bobby_Nobble.

What I’m trying to achieve, is to be able to use my Harmony remote to play/pause Chromecast streams. The automation would detect when the Harmony remote is in the ‘Chromecast Activity’ and then send the correct command to my Chromecast TV via the media_player service.

Looks like that might work. through emulated_roku

Doesn’t it do it already, fairly sure mine does though I haven’t used it in ages since getting a FireTV stick to be fair.

AFAIK the only way to control any streams on Chromecast are through a corresponding app on a mobile / desktop. :frowning_face:

Just checked and your quite right, hopefully better luck with my first suggestion :slight_smile:

I am trying to solve a similar problem as well. I want to have button press events triggered in HA whenever I press play/pause/stop/fastforward/rewind. I dont see any callback events that get fired using the current harmony component. I was attempting to solve this with a separate LIRC receiver that could send an event back to HASS but this works unreliably depending on the code being received (which active device is being used). Someone did something similar with eventghost here: MQTT with Eventghost - half way there but it is a bit different as they weren’t changing the underlying transmitted IR codes.

emulated_roku is want you want, piece of cake to set up and nothing extra needed.

1 Like

The Chromecast supports HDMI-CEC control for play, pause, stop and maybe more (but not next, prev it seems)
I have these buttons on my harmony mapped to control the receiver, which then forwards the command to the Chromecast (if it is the active input).
This might work for you also even if it bypasses hass

1 Like

Of course that’s why i thought it worked natively, I set one up on my main TV which worked fine and then moved it to another which didn’t so gave up on it.

@Michel Thanks for the tip. It might be time to upgrade to a TV with HDMI-CEC support. :smiley:

Is there any more info on how to setup the emulated_roku component? All I can find is this link.

I’m a bit confused the documentation in the git README is saying to set host_ip: to the IP of HomeAssistant server. Should it not be the HarmonyHub’s IP instead?

Nope, there’s no communication from HA to the Hub. This is just HA pretending to be a wifi controlled Roku which the Hub then picks up as such.

Really simple, not much more info needed other than it would be helpful to new users to say you can get the Roku usn from either the Harmony app when setting it up or from HA states if you use discovery: and a list of usable commands which I made here…

1 Like

I’m struggling to understand and setup emulated Roku.

Through automation rules, I’m trying to get my Harmonay remote to be able to play/pause streams on my Chromecast TV. Can someone explain why it’s not working…

automations.yaml - excerpt.

- alias: "Harmony remote commands work for Chromecast TV"
  trigger:
    - platform: event
      event_type: roku_command #trigger when a key press is made on the harmony remote
      event_data:
        type: keypress
        key: Play
  condition:
    - condition: template
      value_template: "{{ is_state_attr('remote.livingroom', 'current_activity', 'Watch Chromecast') }}" #if urrent activity switches to 'Watch TV'
  action:
    - service: media_player.media_play_pause #adjus depending on if media is currently playing or not
      entity_id: media_player.living_room_tv

configuration.yaml - excerpt.

emulated_roku:
  host_ip: 192.168.XXX.XXX # should be set to Home Assistant's address
  listen_ports:
    - 8060

Just to start with, compare what you’ve done with the example from the component github page…

- id: amp_volume_up
  alias: Increase amplifier volume
  trigger:
  - platform: event
    event_type: roku_command
    event_data:
      roku_usn: 5sEE3ioBPJU2m3ZR2QBHDb
      type: keypress
      key: Fwd
  action:
  - service: media_player.volume_up
    entity_id: media_player.amplifier

…you’re missing a somewhat vital line :slight_smile:

If it’s more than that start simple, have you tried the Chromecast command on its own to be sure that works? If it does, just try that without the condition, when that’s OK put it back in again.

i am attempting to try this as i am looking to try something similar. but just adding to the configuration file i get an error:

Blockquote
emulated_roku:
host_ip: 192.168.x.yyy # should be set to Home Assistant’s address
listen_ports:
- 8060
- 8061:8000

the error is showing as:
image

any ideas?

Have you added the emulated_roku component into your custom_components/ folder?