Testers Needed - Harmony Hub Support Implemented in Python

Thanks. I must have missed that modification to how the config worked. Would be great if there was maybe a definitive wiki entry somewhere for the current version, how to install it and what the config should look like.

I just tried that with the following result:

(homeassistant_venv) homeassistant@homepi:~/.homeassistant $ hass --script check_config
Testing configuration at /home/homeassistant/.homeassistant
16-11-01 17:19:19 ERROR (Thread-1) [homeassistant.loader] Unable to find component remote
Failed config
  General Errors:
    - Component not found: remote

Successful config (partial)

Do I have to install something with pip before this will work?

I keep coming back to this thread in hopes of seeing such a thing, but I think it’s still a little too early and things are still being worked out. I’m sure once things settle down, guidelines will be written. I’m just being patient and following the progress.

@mihalski
There’s no wiki entry yet since this is still in active development and a pull request hasn’t been submitted to Home Assistant. The information below is included at the top of the source code in harmony.py, it should have enough information to get you going.

"""
Support for Harmony Hub devices.

For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/remote.harmony/

Sample configuation.yaml entry:
remote:
  - platform: harmony
    name: Bedroom
    username: !secret username   (email address used to login to harmony website)
    password: !secret password   (password used to login to harmony website)
    host: 10.168.1.13            (Harmony device IP address)
    port: 5222                   (Harmony device port, 5222 is default)
    activity: BedroomTV          (activity to start if no activity is specified when turnon service is called, Optional)
  - platform: harmony
    name: Family Room
    username: !secret username
    password: !secret password
    host: 10.168.1.16
    port: 5222
    activity: Kodi

Configuration File
  Upon startup one file will be written to your HASS configuration directory per device in the following format:
    harmony_conf_REMOTENAME.txt.  The file will contain:
        A list of all programmed activity names and ID numbers
        A list of all programmed device names and ID numbers
        A list of all available commands per programmed device

Template sensors can be utilized to display current activity in the frontend by adding the following:
sensor:
  - platform: template
    sensors:
      family_room:
        value_template: '{{ states.remote.family_room.attributes.current_activity }}'
        friendly_name: 'Family Room'
      bedroom:
        value_template: '{{ states.remote.bedroom.attributes.current_activity }}'
        friendly_name: 'bedroom'

The remote's current activity can be utilized in automations as shown below.
    The example will turn on an input boolean switch on when the remote's state changes and the Kodi activity is started
    The second rule will turn off the same switch when the current activity is changed to PowerOff

automation:
- alias: "Watch TV started from harmony hub"
  trigger:
    platform: state
    entity_id: remote.family_room
  condition:
    condition: template
    value_template: '{{ trigger.to_state.attributes.current_activity == "Kodi" }}'
  action:
    service: input_boolean.turn_on
    entity_id: input_boolean.notify

- alias: "PowerOff started from harmony hub"
  trigger:
    platform: state
    entity_id: remote.family_room
  condition:
    condition: template
    value_template: '{{ trigger.to_state.attributes.current_activity == "PowerOff" }}'
  action:
    service: input_boolean.turn_off
    entity_id: input_boolean.notify

Supported services
  Turn Off:
    Turn off all devices that were switched on from the start of the current activity
  Turn On:
    Start an activity, will start the default activity from configuration.yaml if no activity is specified.
    The specified activity can either be the activity name or the activity ID from the configuration file written to
      your HASS config directory.  The service will respond faster if the activity ID is passed instead of the name
  Send Command:
    Send a command to one device, device ID and available commands are written to the configuration file at startup
  Sync:
    Syncs the Harmony device with the Harmony web service if any changes are made from the web portal or app

"""

I have the same error as mihalski, the remote component is not found for home assistant.

Anyone got any pointers, all i did was copy the remote folder to the folder than contains my home assistant config and restarter the service, do i need to do anything else?

Cheers

Gareth

Hi Gareth,

Read further up in the thread, you need to place the remote component in your HASS installation directory, not the config directory

Thanks. I finally found it and got it starting…

However I am now running into this which isn’t giving me any error… it just stops dead in its tracks and sits there.

16-11-02 10:30:29 INFO (Thread-1) [homeassistant.loader] Loaded remote.harmony from homeassistant.components.remote.harmony
LOADING Living Room

If I had the wrong username should I see an error of some sort?

Regards,
Michal

I was able to reproduce your issue, I’ll try to add some error handling in there for invalid credentials.

In the mean time you can verify your credentials through Harmony’s app before putting them in your HASS config

Ok, so I’ve manually added the remote component to my hass source. Should it still be automatically installing pyharmony, or do I now need to do that manually in the virtual env? As of right now, the component doesn’t load as it can’t find pyharmony.

If I need to manually install, do I need to install a specific version?

Also, I’m assuming when I next update ha the remote component is going to get removed and I will need to manually re add it? What’s the plan long term, will the Component get added to HomeAssistant?

Sorry for all the questions, but there’s quite a lot of conflicting and half complete information on this thread (which I completely understand as this is in active development)

Thanks

Gareth

Ok, so i manually installed pyharmony using pip, and it now doesn’t complain about it being missing, but if i enable debug logging the startup just hangs on the following line, no errors logged after this point it just sits there.

16-11-05 13:57:36 homeassistant.loader: Loaded remote.harmony from homeassistant.components.remote.harmony

Here is my config, with username/password blanked, i have checked my username and password in the myharmony app and they login fine.

remote:
  - platform: harmony
  name: Living Room
  username: email-removed
  password: password-removed
  host: 10.0.1.13
  port: 5222

I can confirm that the following command connects correctly and returns the correct state information:

(hass_venv) hass@raspberrypi:/srv/hass$ harmony --email ************ --password ******** --harmony_ip 10.0.1.13 --harmony_port 5222 show_current_activity

PowerOff

Do i need to grab a specific build of pyharmony, i just did a standard pip install pyharmony

Thanks!

Gareth

edit - have confirmed that the version installed my pip is the same as the one linked for download above, so i don’t think that’s the issue?

everything looks correct except for your config format, it looks like your spacing is off for - platform. Here’s mine

remote:
  - platform: harmony
    name: Bedroom
    username: !secret username
    password: !secret password
    host: 10.168.1.13
    port: 5222
    activity: BedroomTV
  - platform: harmony
    name: Family Room
    username: !secret username
    password: !secret password
    host: 10.168.1.16
    port: 5222
    activity: Kodi

Hi Ian,

Formatting is correct on my end, just internet copy and paste funkiness.

Cheers

Gareth

interesting. The current version contains some exception handling and requires pyharmony 1.0.9. Can you update pyharmony using pip and try the new code?

Latest pyharmony and code from github and the same issue, though it seems to get a line further if I enable debug logging.

HomeAssistant.loader: Loaded Component remote.harmony from homeassistant.components.remote.harmony
homeassistant.components.remote.harmony: Loading Harmony Component: Lounge

And it then just hangs there, nothing further is logged. If I disable debug logging then upon restarting the homeassistant service nothing is ever written to the log file.

Anything else I can do to get more info on what’s going on here? Pyharmony still seems to work as expected if I run it manually in the virtual environment.

Cheers

Gareth

can you try an incorrect email address or password? You should get a critical error saying login failed

Yes with incorrrct authentication details I do get an error logged, and the system continues to load correctly rather than hanging as happens when I entered the correct login details.

Logs are as follows with the incorrect password.

16-11-06 22:27:40 pyharmony.auth: Received response code 400 from Logitech.
16-11-06 22:27:40 pyharmony.auth: Data: 
{"ErrorCode":1,"Id":"4c380dde-3151-4db4-bc40-38b988decc07","Message":"Authentication failure BadCredentials  : Unable to authenticate user's mail with the corresponding password via LIP:: ********@********","Source":"GetUserAuthToken "}

its very strange, can you post your sanitized config file?

I have my config files broken down into lots of sub files/folder, so i’ve PM’d you a zip of the whole lot, let me know if i can do anything else to help.

Cheers

Gareth

@iandday - I’ve updated to the latest versions, still a good experience here

I’m actually getting the following with the CORRECT login details:

16-11-08 07:54:52 CRITICAL (Thread-3) [pyharmony.auth] Received response code 400 from Logitech.
16-11-08 07:54:52 CRITICAL (Thread-3) [pyharmony.auth] Data:
{"ErrorCode":1,"Id":"3f4de38a-8562-4560-b99a-43d5057a2055","Message":"Authentication failure BadCredentials  : Unable to authenticate user's mail with the corresponding password via LIP:: [email protected]","Source":"GetUserAuthToken"}

16-11-08 07:54:52 ERROR (MainThread) [homeassistant.components.remote] Error while setting up platform harmony

I updated pyharmony to 1.0.9 and I updated Home Assistant to the latest version. I’m not sure if it replaced the manually installed pyharmony remote module with your latest code though.

Regards,
Michal