I don't understand the Harmony docs

Highlight it and click the </> icon above the type window, simples :slight_smile:

- alias: Set Harmony activity using input_select
hide_entity: True
trigger:
  platform: state
  entity_id: input_select.harmony
action:
  service: remote.turn_on
  entity_id: remote.harmony_hub_bedroom
  data_template:
    activity: >
      {% if is_state("input_select.harmony", "Watch TV") %}
        28373986
      {% elif is_state("input_select.harmony", "Cable TV") %}
        28374747
      {% elif is_state("input_select.harmony", "Listen to Music") %}
        28374908
      {% elif is_state("input_select.harmony", "Xbox 360") %}
        28893920
      {% elif is_state("input_select.harmony", "Watch Nexus Player") %}
        28375338
      {% elif is_state("input_select.harmony", "Desk Lamp") %}
        28375184
      {% elif is_state("input_select.harmony", "H1") %}
        28374600
      {% elif is_state("input_select.harmony", "H2") %}
        28374636
      {% else %}
        -1
      {% endif %}

This next automation is to update the input_select when the Harmony’s

activity was changed from somewhere else, e.g. using its physical remote.

  • alias: Update Harmony input_select
    hide_entity: True
    trigger:
    platform: state
    entity_id: remote.harmony_hub_bedroom
    action:
    service: input_select.select_option
    data_template:
    entity_id: input_select.harmony
    option: “{{ states.remote.harmony_hub_bedroom.attributes.current_activity }}”

I had trouble with this, needed to remove the extra indent from the activity code number and then it started working perfectly, like this…

{% if is_state("input_select.harmony", "Watch TV") %}
28373986

Is there a way to let every Harmony Hub activity show up as a separate switch and then as an emulated hue light entity? I would love to use my harmony activities inside Alexa routines.

Yep, but you don’t do it via HA/emulated_hue anymore.

You want to use the blue Harmony Alexa Smart Skill, they’ll all be automatically imported into the Alexa app when you first set it up.

I wish this was available in my country (Germany). We still do not have the better Harmony Skill. Only the one where you have to say “…with harmony” after every end. Alexa didn’t pick up any devices as a switch through that original skill so I was looking into doing my own switches through HA.

Bummer, thought it was bad enough how long we had to wait to get it in the UK.

You can do what you want though, that was what I did before the blue skill came out. Just write a script for each one and then expose them with emulated_hue. Be careful with the names though, if you use the harmony default ”watch…” or ”play…” activity names Alexa will often get confused with media requests.

Thanks, I appreciate the advice! :slight_smile: I hope I can get this to run with the info in this thread, still new to all related HASS.

Not easiest component to integrate as one of your first but if you get stuck post what you’ve got so far and we’ll point you on the right direction.

1 Like

@NicolasG you need to use the switch template platform and create your own switches that turn on an activity and power off the remote as needed. I am using the below, you can use this and just plug in your own values:

 - platform: template
   switches:
     fire_tv:
       value_template: "{{ states.remote.harmony_hub_bed.attributes.current_activity == 'Watch Fire TV' }}"
       turn_on:
         service: remote.turn_on
         entity_id: remote.harmony_hub_bed
         data:
           activity: '19492437'
       turn_off:
         service: remote.turn_off
         entity_id: remote.harmony_hub_bed
2 Likes

@dshokouhi Just tested it with my harmony_hub.conf and Alexa. This worked like a charm!! Thank you so so much for providing this easy to understand code! :slight_smile:

1 Like

If you used the exact names of the activities in your select (you can get these from the harmony_name.conf-file) , the “translation” to the activity-id is not needed. You can just use the select state as data:

alias: Harmony is updated by select
hide_entity: True
trigger:
  platform: state
  entity_id: input_select.harmony
action:
  service: remote.turn_on
  entity_id: remote.harmony
  data_template:
    activity: '{{ states.input_select.harmony.state }}'

Makes it easier to maintain later on.

Thanks for this. I’m having a bit of trouble getting the input select to reflect the current activity though. I have the code below:

- alias: Update Harmony input_select
    hide_entity: True
    trigger:
      platform: state
      entity_id: remote.poaka_lounge
    action:
      service: input_select.select_option
      data_template:
        entity_id: input_select.harmony
        option: "{{ states.remote.poaka_lounge.attributes.current_activity }}"

If I use the template editor to test "{{ states.remote.poaka_lounge.attributes.current_activity }}", it correctly shows my wife is watching Magic TV but the input select says PowerOff. Code looks straight forward enough but have I made a typo somewhere?

@RiseUp
Disregard! I forgot to include the activity for “Watch Magic TV” in my input select list so it wasn’t able to display that! All sorted now. Package coming.

Anyone here that knows hot to make it so that if PowerOff then select another value from imput select then poweroff. or acvtivity -1. for example “select activity”

i have is and when poweroff is selected i dont have that as im swedish and dont use that value.

- alias: 'Setup after startup'
  hide_entity: true
  initial_state: on
  trigger:
    - platform: homeassistant
      event: start
  action:
    - service: input_select.select_option
      entity_id: input_select.living_room_tv
      data_template:
        option: "{{ state_attr('remote.vardagsrum','current_activity') }}"