Testers Needed - Harmony Hub Support Implemented in Python

Where would I find the new settings to get the new authToken?

you should be able to remove pyharmony 1.0.10, replace it with 1.0.11 and have it functioning. That’s how I got my dev environment to work again.

Seems you are correct. Looks like my logs just didn’t update after restarting HASS. My logs showed:

16-11-18 19:55:20 pyharmony.auth: Malformed JSON (GetUserAuthTokenResult): {'GetUserAuthTokenResult': None}
16-11-18 19:55:20 homeassistant.components.remote.harmony: Logitech login failed for remote: Living Room TV

I just didn’t look at the date stamp. After about a minute it’s working properly again. I also updated my remote folder just to be sure.

Excellent work as always @iandday!

great to hear :grinning:

For what it’s worth I still have the problem of hass not being able to auto install pyharmony:

(homeassistant_venv) homeassistant@homepi:~ $ hass --script check_config
Testing configuration at /home/homeassistant/.homeassistant
16-11-20 17:44:44 ERROR (MainThread) [homeassistant.loader] Error loading homeassistant.components.remote.harmony. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/loader.py", line 139, in get_component
    module = importlib.import_module(path)
  File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/remote/harmony.py", line 17, in <module>
    import pyharmony
ImportError: No module named 'pyharmony'
16-11-20 17:44:44 ERROR (MainThread) [homeassistant.loader] Unable to find component remote.harmony
16-11-20 17:44:44 ERROR (MainThread) [homeassistant.bootstrap] Unable to find platform remote.harmony
Failed config
  General Errors:
    - Platform not found: remote.harmony

Successful config (partial)

SEEMS to be working fine after a manual install but I haven’t had much experience with it working so I’ll confirm later after I’ve figured it out a bit… Is there any way to have the current_activity in the Remote tile? I haven’t figured that out yet and I just have it separate with both the default Remote tile and:

sensors:
  - platform: template
    sensors:
      family_room:
        value_template: '{{ states.remote.family_room.attributes.current_activity }}'
        friendly_name: 'Family Room'

Still finding the configuration of hass challenging and I wish there was an editor with a real-time preview :stuck_out_tongue:

After having this great component working for two wonderful days, I can’t seem to apply the fix for 1.0.11.

logs:

16-11-20 13:01:25 homeassistant.loader: Loaded remote.harmony from homeassistant.components.remote.harmony
16-11-20 13:01:26 homeassistant.components.remote.harmony: Loading Harmony platform: Harmony Hub
16-11-20 13:01:27 pyharmony.auth: Malformed JSON (GetUserAuthTokenResult): {‘GetUserAuthTokenResult’: None}
16-11-20 13:01:27 homeassistant.components.remote.harmony: Logitech login failed for remote: Harmony Hub

i’ve installed pyharmony 1.0.11, however ‘python3 pyharmony’ returns

python3: can’t open file ‘pyharmony’: [Errno 2] No such file or directory

I’ve also updated the ‘components’ to reflect the new authToken.

are there any specific methods for uninstalling/reinstalling/updating this? i’ve been using the guide at the top of the following post:

tia

If you’re using the Home Assistant virtual environment then make sure you install pyharmony within that environment.

thanks mihalski

i’m in
(hass_venv) hass@raspberrypi:/tmp$
when i
pip install master.zip
and get
Successfully installed pyharmony-1.0.11
upon completion
however still get:
pi@raspberrypi:~ $ python3 pyharmony
python3: can’t open file ‘pyharmony’: [Errno 2] No such file or directory
or
(hass_venv) hass@raspberrypi:/home/pi$ python3 pyharmony
python3: can’t open file ‘pyharmony’: [Errno 2] No such file or directory

and a hass restart still shows the JSON failure in the log :frowning:

EDIT: success! fyi…
close/stop hass
uninstall pyharmony
delete old harmony_conf
apt-get update/upgrade
reboot
hass now automatically downloads pyharmony 1.0.11, makes the new conf file etc, and the component works again!

big thanks @iandday @mihalski @BTallack @Bahnburner !!!

Thank you Iandday for this fantastic component!
I have it connecting with 2 harmony hubs and will be configuring homeassistant to trigger activities.

I also have an older version of the hub, called Harmony Link.
I see that the readme for some versions of pyharmony refer to support for Link/Hub,

Is there any chance support can be added for the link? (I know it’s asking a lot, but maybe it is not too different than hub)
I will be happy to help if I can. The Link is easy to find for less than $20, so it is a cheap alternative with very similar function to hub.

Thank you!

I cant for the life of me figure out how to install this on a all in one installation.
Is anyone so kind to post which commands i have to run in order to install this?

Hi @mefistofelis

i installed on the HASS AiO, and this process got me there (compiled from posts by @datamonkey @BTallack):

sudo apt-get install subversion
sudo su -s /bin/bash hass
source /srv/hass/hass_venv/bin/activate
cd /tmp
svn export https://github.com/iandday/home-assistant/trunk/homeassistant/components/remote

then copy the ‘remote’ folder manually from:
/srv/hass/hass_venv/tmp
to:
/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components

add the component to your configuration.yaml:

remote:

  • platform: harmony
    name: Harmony
    username: YOURHARMONYUSERNAME
    password: YOURHARMONYPASSWORD
    host: YOURHUBIP
    port: 5222

a swift reboot, and HASS will install pyharmony, and should create a new file in your main config dir - harmony_yourharmonyhubname.conf

from there you should be good to go!

1 Like

have you tried setting up the link as a third device? I only have the hubs so I dont know if it would work or not.

Well i did all that and i still cant boot HA.
Is it possible that because my password for harmony contains special charachters such as ! or @ it fails somewhere?

Edit: that was it the whole time i used " " and it worked

Something has changed… 6 minutes stuck at:

16-11-21 07:08:02 INFO (Thread-5) [homeassistant.components.remote.harmony] Loading Harmony component: Family Room

Could it be something to do with the work on the async core? Weird thing is yesterday it started fine a few times even with the latest hass.

can you set logging to debug for the remote component?

@iandday Would you be able to clarify the proper formatting on sending a device command for me?

Activities are pretty straight forward. I’m able to trigger an activity with:

   - service: remote.turn_on
      entity_id: remote.living_room_tv
      data:
        activity: "15508274" 

However I’m not sure how I’d trigger a Volume down command. According to the conf file, the receiver is ’ 30557844 - Onkyo AV Receiver’ and the command is ‘VolumeDown’ but I do now know how I’d format this data.

1 Like

I just used the below data to Mute my sound bar

{“entity_id”:“remote.family_room”,“device”:“35128149”,“command”:“Mute”}

So for your case it should be

   - service: remote.send_command
      entity_id: remote.living_room_tv
      data:
        device: "30557844"
        command: "VolumeDown"
1 Like

That did the trick. Thanks @iandday!

Now if only I could find a way to make it look a little cleaner than:

You could set a input select component to hold the actions you want, then a script “call action”.

The script would lookup what select option is currently selected, then send that to the Remote Component.

That’s the only suggestion I could think off the top of my head.

See https://home-assistant.io/cookbook/perform_actions_based_on_input_select/

That’s what I did for the Activity select and it worked well. I’m just looking for something to control the volume more cleanly now.