Harmony response is very slow in script

I have a script that turns off everything when I go to bed.
The very first line on the script is :

  • service: remote.turn_off
    entity_id: remote.lrharmony

The script then proceeds to turn off various lights etc.

The problem is that it can take up to a couple of minutes for the TV to actually turn off.
I know the script is proceeding, because the lights that are listed after do turn off, and the script completes normally.

But, if I send a command to the harmony remote from the services developer tool, it response almost instantaneously.

One more piece of information, I call the script from an Alexa intent. I don’t think that would make any difference though.

Has anybody seen behavior like this?

Any luck speeding up Harmony actions in scripts? I’m running into the same annoyance.

No, I’ve learned to just ignore it. It does eventually turn off.

Mine isn’t instantaneous doing it that way but we’re only talking a couple of second pause and you can then see each device turn off one by one.

For other reasons, I now have Harmony itself send the off command to each emulated_hue device and there is just a split second pause and the lot go off together.

My workaround: I put each command I wanted to send in its own Script, then used a Scene to trigger every Script at the same time. Not sure if it’s the best option, but I no longer see a delay.

My Harmoney remote actions are pretty fast after rebooting HASS but after a few days it will take up to a minute or so for any Harmony command to be executed. I feel something is either hogging up on the HASS side or on the Harmony side. I can also tell from the main log that updating the state takes longer than the scheduled update interval. It doesn’t matter if I put the update frequency to 30 seconds or 60. Does anyone know if there any more detailed logs I can check to see where it is slow?

for example:
17-03-30 22:41:11 WARNING (MainThread) [homeassistant.components.remote] Updating harmony remote took longer than the scheduled update interval 0:00:30

I am not sure that it solves your particular problem but feel free to test out PR #10218.

Create a subdirectory in your configuration directory: custom_components/remote and copy this file and this file into it. Then restart Home Assistant.

1 Like

Sounds like a great solution. Will give it a try tonight!

I’ve tried your custom_component, but I cannot get it to update or trigger my harmony hub.
It updates the activity when I restart HA, but after that, no more news from component in the log.

I installed manually pyharmony .17 just to try, but no luck

Thanks for testing. Can you give a little more detail on what you are doing?

Ive been using default harmony since now.
I downloaded both files (.py and .yaml) to the custom_components/remote folder and restarted HA.
It tried to install (per requirements) pyharmony .17, but got no luck, so I installed manually and restarted HA again.
Then it started, connected to my hub and updated current activity (was OFF), but when I tried to change/start activity, nothing. Nothing in the logs, no errors but no activity.
I have HA installed on an Ubuntu machine, but no virtualenv.
Later will try install in a virtualenv to see if there’s something wrong with dependencies.

It is still not clear to me: are you trying to change activity with the Logitech remote, with Home Assistant, or both?

Both. I have an input select to trigger an activity change, and a sensor to get current activity (to trigger automations).
They both works with current component, but not with yours

I’ve tried with a virtualenv and now I get this:

2017-11-07 15:37:42 ERROR (MainThread) [homeassistant.components.remote] Error while setting up platform harmony
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 170, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 392, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/dani/hass/custom_components/remote/harmony.py", line 97, in setup_platform
    name, address, port, activity, harmony_conf_file, delay_secs)
  File "/home/dani/hass/custom_components/remote/harmony.py", line 150, in __init__
    self._client.register_activity_callback(self.new_activity)
AttributeError: 'HarmonyClient' object has no attribute 'register_activity_callback'

This one is because pyharmony is not 1.0.17.

I installed manually .17, and seems that my remote not gets configured/discovered, although its configured on my .yaml from previous versions. It doesn’t appear on my < > page.

UPDATE: I did a fresh install on a virtualenv, with another new user, and seems that it gets configured, and it gets current activity when HA starts, but gets no change when I choose another activity from Harmony app on iPhone.

@amelchio, I’m getting the following error on boot:

2017-11-07 20:13:07 ERROR (MainThread) [homeassistant.components.remote] Error while setting up platform harmony
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 170, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 352, in wait_for
return fut.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/remote/harmony.py", line 97, in setup_platform
name, address, port, activity, harmony_conf_file, delay_secs)
  File "/config/custom_components/remote/harmony.py", line 150, in __init__
self._client.register_activity_callback(self.new_activity)
AttributeError: 'HarmonyClient' object has no attribute 'register_activity_callback'

What is this about needing 1.0.17? I’m on Hassio and I’m not sure how to do it if it needs to be installed separately.

If you haven’t already, can you try a static configuration?

discovery:
  ignore:
    - harmony

remote:
  - platform: harmony
    name: My Remote
    host: 10.0.2.31

I do not normally use discovery myself so I forgot that it does not work with custom_components (AFAIK).

I do not use discovery on my config, and already have a static config for remote: name, host

@danichispa okay, can you share the HA config for sending a command that is not working for you? I would like to test something similar out. Also, let’s check that we have the same hub – mine is model number O-R0004 (printed on bottom).

@Dingle it seems that something is flaky with requirements management; sorry that I don’t know how to help with that.