Logitech Harmony Integration with @iandday's component

HI Jer78,
Thank you for responding…

I am waiting for 15 mins now. Deleted the database. A new Database was created when HA starts loading, but it never finishes loading… Actually I think it dies… my top command does not show HA running… …

Are you on the latest version of HA? 0.45? Does one still need to do any manual installation? I wonder if my “manual” install of pyharmony was also un-nesseseary and screwing things up?

I am running in virtualdev env, btw.

Im running 0.45.1. You shouldn’t have to manually install it. I am running python 3.5 and wondering if that’s your problem.

Ok! found what my problem was.
The IP of the harmony hub was mis-typed. So it seems it will die if you point it at a non-existing IP.
Now it all works.

Awesome! Glad you got it working.

Does this anybody use this component with vlan? I have my in my IoT-vlan and my hass-setup hass access to this vlan. The port 5222 is open when I do port scan. But home-assistant doesn’t register the device. Tried to remove the .conf file but it doesn’t create a new one.

I did use it before without vlan, and it was working great. Since logitech has their ugly cloud-solution that you can’t turn off I’m placing it in the IoT-garbage-vlan.

Edit: Solved it by reinstalling the component. Works great with vlan as long as you have correct rules in iptables.

Thank you very much for this guide! it looks great.
I’m relatively new to HASS and am having some difficulties with this setup.

The installation has been succesfull ( I think) and the scripts work. However there is something wrong with the automation. I get the follwing error: “homeassistant.config] Invalid config for [automation]: [service] is an invalid option for [automation]”. I guess this has something to do with the components files from github. As I run Hassbian I placed the 3 files (harmony.py enz) in the main folder: home/homeassistant/.homeassistant.

Is this the right path? Or could there anything else that causes the error?

Thanks in advance

According to that error, the issue is in one of your automations, not the component setup.

Feel free to post your automation yaml here and we can help troubleshoot. Just make sure you use the code formatting </> in the tool bar

Thank you for your replies but I solved the problem by using the shortened code form @iandday

Just got an ultimate and whilst discovered on 58.1 it doesn’t show anything other than a living room on off switch. I have activities configured. Do I need to add credentials in configuration.yaml still before I see those activities? I can see the conf file has populated.

Not clear what you’ve actually done but it’s not magic, you need to set it all up in HA.

1 Like

Ok cool. The doco implies it will do things by discovery so I saw stuff populating and wasn’t sure.

Hello Bahnburner,

I am trying to configure harmony the way you suggested but something is not right with my automation. Input select menu is fine, and I also can get the current harmony status fine with sensor, but the automation does not work. I am getting the following errors:

ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: expected a dictionary for dictionary value @ data[‘action’][0][‘data_template’]. Got None
extra keys not allowed @ data[‘action’][0][‘activity’]. Got None. (See /config/configuration.yaml, line 131). Please check the docs at https://home-assistant.io/components/automation/

Failed config
automation:
- action: [source /config/automation/remote/harmony.yaml:7]
- activity: {% if is_state(“input_select.harmony”, “Watch TV”) %}
28476264
{% elif is_state(“input_select.harmony”, “Watch Apple TV”) %}
10294440
{% elif is_state(“input_select.harmony”, “Watch DVD”) %}
10294462
{% elif is_state(“input_select.harmony”, “Listen to Music”) %}
10294480
{% else %} {% endif %}

data_template: None
entity_id: remote.csizas_harmony_hub
service: remote.turn_on
- data_template: [source /config/automation/remote/harmony.yaml:24]
option: Select Input
entity_id: input_select.harmony
service: input_select.select_option
alias: Set Harmony
hide_entity: True
trigger: [source /config/automation/remote/harmony.yaml:3]
platform: state
entity_id: input_select.harmony
from: Select Input
- action: [source /config/automation/remote/harmony.yaml:33]
- entity_id: remote.living_room
service: remote.turn_off
- data_template: [source /config/automation/remote/harmony.yaml:38]
option: Select Input
entity_id: input_select.harmony
service: input_select.select_option
alias: Harmony Off
hide_entity: True
trigger: [source /config/automation/remote/harmony.yaml:29]
platform: state
entity_id: input_select.harmony
to: PowerOff
- action: [source /config/automation/remote/harmony.yaml:46]
data_template: [source /config/automation/remote/harmony.yaml:48]
entity_id: input_select.harmony
option: {{ states.remote.csizas_harmony_hub.attributes.current_activity }}

service: input_select.select_option
alias: Harmony Update
hide_entity: True
trigger: [source /config/automation/remote/harmony.yaml:43]
platform: state
entity_id: remote.csizas_harmony_hub

And here is my configs:

input_select.yaml

harmony:
  name: Harmony Control
  options:
    - Select Input
    - Watch TV
    - Watch DVD
    - Watch Apple TV    
    - Listen to Music
    - PowerOff
icon: mdi:monitor

harmony.yaml

- alias: "Set Harmony"
  hide_entity: True
  trigger:
    platform: state
    entity_id: input_select.harmony
    from: 'Select Input'
  action:
    - service: remote.turn_on
      entity_id: remote.csizas_harmony_hub
      data_template:
      activity: >
        {% if is_state("input_select.harmony", "Watch TV") %}
          28476264
        {% elif is_state("input_select.harmony", "Watch Apple TV") %}
          10294440
        {% elif is_state("input_select.harmony", "Watch DVD") %}
          10294462
        {% elif is_state("input_select.harmony", "Listen to Music") %}
          10294480
        {% else %}
        {% endif %}
    - service: input_select.select_option
      entity_id: input_select.harmony
      data_template:
        option: "Select Input"
        
- alias: "Harmony Off"
  hide_entity: True
  trigger:
    platform: state
    entity_id: input_select.harmony
    to: 'PowerOff'
  action:
    - service: remote.turn_off
      entity_id: remote.living_room
    - service: input_select.select_option
      entity_id: input_select.harmony
      data_template:
        option: "Select Input"

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

configuration.yaml (line 131 is the group definition)

group: !include groups.yaml 
automation: !include_dir_merge_list automation
script: !include scripts.yaml

I would appreciate any help.

Thanks

@Csiza Please format your code using the </> button in the editor. It’s almost impossible to help otherwise. Second, if you’re using the automation editor it always messes up the code. Best to use the automation old section for code from the forums.

Thanks Jer78,

Not really familiar with formatting here, but I did something.
Let me know if this is ok now.

From what I can see right away, the issue is the indentation after the data_template. Your next line -activity (and the lines after in the template) should be indented by 2 spaces.

Also in your input_select, the line “icon” should line up with options.

You are awesome… :slight_smile: Configuration Validation now does not give me error, however it still does not doing anything. When I change to something in input_select it does not doing anything?

Any suggestion?

@Csiza

Are the activity numbers from your Harmony config file? If not, make sure you replace them with yours. Your harmony config file is automatically created in the same directory as your configuration.yaml file.

Also, I wondering if this method would work properly just because you are changing to an activity but right away changing back to “Select Input”. I leave my input select on the actual activity.

Finally!! It works perfectly. The numbers was fine, but they had an extra indentation. Removed them and started to work just fine.

Thanks a lot for the help…

1 Like

Sorry for the delay, I was out of town for the holidays.

The harmony update automation is going to give you issues. My original scripting was written with the intent that it would always refert the input select back to “Select Input” after running. The “harmony update” automation you added is trying to continuously change the input select to the current activity, which triggers the “set harmony” automation, which tries to change the activity to the current activity again, and then change the input select back to “select input.” This is going to continue ad infinium and cause undue load on both home assistant and the harmony hub. If you’d like a version that keeps the input select synced with the current activity, the original that @BTallack posted to start this thread should work, but there can be unintended feedback loops if things get out of sync or take longer than normal to update. That was my rationale for posting my version that always reverts to “Select Input” after triggering.