Testers Needed - Harmony Hub Support Implemented in Python

Yup. That did it.

great! I just want to make sure that the text file containing your hub’s configuration includes the activity ID numbers along with the name.

@datamonkey
you can install pyharmony using pip, but HASS should take care of it for you once you start it up after enabling it in your config file. you need to copy the ‘remote’ directory from my fork and the three files inside to a directory named ‘custom_components’ in your HASS configuration directory. After you have the files copied you can modify your configuration file following my example.

thanks @iandday
I have no experience in python but have been coding in other languages before. Not a complete newbie.
I copied the files from your git to the remote directory (wget RawURL).
I am running HASS 0.30.1 on a plain All in One installation.
A config_check gives these errors, I must have missed something …

(hass_venv) hass@raspberrypi:~/.homeassistant/custom_components$ hass --script check_config
Testing configuration at /home/hass/.homeassistant
16-10-10 22:19:22 ERROR (Thread-1) [homeassistant.loader] Error loading custom_components.remote.harmony. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/loader.py", line 128, in get_component
    module = importlib.import_module(path)
  File "/srv/hass/hass_venv/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 "/home/hass/.homeassistant/custom_components/remote/harmony.py", line 84, in <module>
    import homeassistant.components.remote as remote
ImportError: No module named 'homeassistant.components.remote'
16-10-10 22:19:22 ERROR (Thread-1) [homeassistant.loader] Unable to find component remote.harmony
16-10-10 22:19:22 ERROR (Thread-1) [homeassistant.bootstrap] Unable to find platform remote.harmony
Failed config
  General Errors:
    - Platform not found: remote.harmony

Successful config (partial)

Make sure all dependencies are installed
Are there any dependencies needed?
Any pointers would be welcome …

It does. I was apparently referencing the older harmonyConf instead of the new harmony_conf

I tried to install this, get similar issue to @datamonkey - log for ref:

16-10-10 16:17:05 homeassistant.loader: Error loading custom_components.remote.harmony. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/loader.py", line 128, 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 "/home/rmtpiadm-cr/.homeassistant/custom_components/remote/harmony.py", line 84, in <module>
    import homeassistant.components.remote as remote
ImportError: No module named 'homeassistant.components.remote'
16-10-10 16:17:05 homeassistant.loader: Unable to find component remote.harmony
16-10-10 16:17:05 homeassistant.bootstrap: Unable to find platform remote.harmony

I placed the harmony.py, __init__.py and services.yaml into my homeassistant/components/remote folder rather than .homeassistant/custom_components/. See if that changes the situation at all.

@trp
@datamonkey

I copied the remote directory similar to what @Bahnburner did, in my case it was to ‘/usr/local/lib/python3.4/dist-packages/homeassistant/components/’

@trp
@datamonkey

If you’re using the AIO or Hassbian, you’ll need to use

/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/remote

or

/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/remote

depending on your virtual environment location.

Thanks, I moved the files and downloaded again from github.
Seems like I moved one line further. Now it is missing pyharmony
ImportError: No module named 'pyharmony’

Testing configuration at /home/hass/.homeassistant
16-10-11 19:26:24 ERROR (Thread-1) [homeassistant.loader] Error loading homeassi                                                                                      stant.components.remote.harmony. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/loader.py"                                                                                      , line 128, in get_component
    module = importlib.import_module(path)
  File "/srv/hass/hass_venv/lib/python3.4/importlib/__init__.py", line 109, in i                                                                                      mport_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/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components                                                                                      /remote/harmony.py", line 85, in <module>
    import pyharmony
ImportError: No module named 'pyharmony'
16-10-11 19:26:24 ERROR (Thread-1) [homeassistant.loader] Unable to find compone                                                                                      nt remote.harmony
16-10-11 19:26:24 ERROR (Thread-1) [homeassistant.bootstrap] Unable to find plat                                                                                      form remote.harmony
Failed config
  General Errors:
    - Platform not found: remote.harmony

I havent done anything about pyharmony as @iandday explained HASS would take care of it.

Much like @datamonkey moving the files didn’t work.
I used the pip3 install method, no AIO or Hassbian. Files now located: .homeassistant/components/remote/

I have also not installed pyharmony at this time.

New error:

16-10-11 10:44:54 homeassistant.loader: Unable to find component remote

@datamonkey

I had to manually install pyharmony. You can get it from pypi and install using

pip install pyharmony-1.0.7.tar.gz

@Bahnburner @datamonkey

Installing pyharmony didn’t help for me… is there a way I can test the pyharmony install?

I don’t want to be a pain, but rather than installing components manually I want to rely on the code to do that for me. It is part of testing the dependency handling as well.

If you think it is not ready for that and we can test dependencies later, then I am happy to do that too.

python3 pyharmony

should return

usage: pyharmony [-h] --email EMAIL --password PASSWORD --harmony_ip
                 HARMONY_IP --harmony_port HARMONY_PORT
                 [--loglevel {INFO,DEBUG,ERROR,WARNING,CRITICAL}]
                 {show_config,show_current_activity,start_activity,power_off,sync,send_command}
                 ...
pyharmony: error: the following arguments are required: --email, --password, --harmony_ip, --    harmony_port

@datamonkey: I’ll leave it up to @iandday to determine the root cause of the missing pyharmony dependancy. I can only tell you what steps I took to eliminate the issue and get the component working.

the remote directory should not be copied to your .homeassistant configuration directory, it should be copied to the components directory located in the directory the HASS package is installed to. I used pip to install HASS on my machine and the install path is ‘/usr/local/lib/python3.4/dist-packages/homeassistant’

I have followed the development instructions by specifying the REQUIREMENTS variable on line 91 of harmony.py.

REQUIREMENTS = [‘pyharmony>=1.0.7’]

Since my commit I ran the gen_requirements_all.py which created a requirements_all.txt file at the root of my home assistant development directory. I don’t see the same file on my production machine, it must be utilized during the setup process.

OK, thanks, seems like the install should be taken care of when installing HASS.

So I did the pyharmony install manually
This is where my lack of pythin and virtual environment understanding set me back but it is running now.
Here the steps I took, it might help the next guy.
I am running hass on a raspberry pi 3 with AIO installer

# go to virtual environment
sudo su -s /bin/bash hass
source /srv/hass/hass_venv/bin/activate

# download pyharmony
cd /tmp
wget https://github.com/iandday/pyharmony/tarball/1.0.7

# install 
pip install 1.0.7

that did the trick for me, now I can see a basic remote component.

Tried the same, RPI3 with Hassbian / virtual env… Problems with installing:

[quote]Collecting 1.0.7
Could not find a version that satisfies the requirement 1.0.7 (from versions: )
No matching distribution found for 1.0.7[/quote]

OK, update:

I installed pyharmony after download from pypi (sudo pip install pyharmony-1.0.7.tar.gz) - some errors seen without sudo, not recorded.
Out of interest the command (python3 pyharmony) doesn’t give me the feedback @Bahnburner mentioned…

Following @iandday instructions, I placed the “remote” folder into “/usr/local/lib/python3.4/dist-packages/homeassistant”
and, hey presto, I have a working sensor!

I haven’t worked with virtual environments before, but you should be able to use pip to install it by specifying the package name pyharmony. I installed it on my production ubuntu instance with pip3 install pyharmony