Core: Logitech Harmony API

Created on 26 Jan 2016  路  20Comments  路  Source: home-assistant/core

Hi guys,

Support for Logitech's Harmony API would be an awesome addition.

https://www.myharmony.com/en-us/harmony-api

Cheers,
Andrew

Most helpful comment

Since this is still the first hit in search engines, this was eventually merged. See this page for documentation:
https://home-assistant.io/components/remote.harmony/

All 20 comments

+1

@balloob I was thinking about experimenting with this, but directly controlling the harmony hub with something like this https://github.com/bkanuka/pyharmony

Would this end up needing an entirely new Component type? It doesn't seem to fit in with existing Components, since it is really just a remote control API.

Does the harmony expose the current state of any of the devices it can control? If so it could be integrated as platforms for existing components.

If it doesn't, probably a new component is needed.

Good point. It does let you fetch current state. I'll see if I can approach it from a platform perspective.

Hi guys,
I opened a thread on the google groups some months ago : Logitech Harmony Hub component

Mervin did a component using the python api for Harmony Hub. Here is the last source he gave to me :harmony.zip

It works like a charm with my activities. Dunno if Mervin continue to work on it...

Looks nice. Perhaps if Mervin isn't going to continue working on it then someone else could take ownership and raise it as a pull request for further comments, improvements and discussion?

My initial comments after having a quick scan of the code:

  • Code and comments needs tidying
  • It polls for activity status every 30 seconds, harmony sends a message in the XMPP room on change so this could be subscribed to for instant updates
  • Only activities have been implemented, it is possible to send specific commands like volume up

For reference here are the most up to date projects I've found which implement this protocol:

Both the Java and the C# projects cite pyharmony as inspiration, however they seem to be more feature complete. The Java project implements listeners for the activity change for example.

I started looking at the pyharmony, to handle notifications from the hub. Seems that xmpp messages are only sent when activities are started/stopped, not when individual devices state is changed.
I'm really new to home assistant... Maybe the harmony hub should be treated like others hubs ? I mean that devices known from it should be viewed as components from the HA point of view ?
Let me know... Dunno how to start this dev :)

@LaurentTrk that's basically what Balloob was telling me above. Other Hubs work as Platforms in Home Assistant, which are basically the specific implementations of Components under the hood. So perhaps the Harmony Hub integration could be implemented in terms of Harmony Hub implementations of Switches and Sensors. I've been learning about Platforms myself, and I'd be happy slow-start this attempt with you.

Thanks @jer. I just commited the job done by Mervin on my githib fork (see https://github.com/LaurentTrk/home-assistant), with some improvements:

  • Use pyharmony lib instead of including necessary code (need to be installed manually from my github also, see https://github.com/LaurentTrk/pyharmony)
  • Do some refactor
  • Remove 30 seconds polling, and use callback from hub to update status

Lot's of work to do on this, any help is welcome :)

@LaurentTrk good work! If you want some help perhaps it would be best to make a list of the things you want help with.

@LaurentTrk Any update on this?

I'm afraid not. No spare time to work on this.
I started to create switches component for devices known by the hub. Was thinking about using media center component to emulate tv...
Also I started working on receiving events from the hub (by emulating a rooku device see my github for poc). It could be great to treat those events in home assistant to trigger others devices not compatible with the harmony hub (let say zwave devices...). To be continued...

@LaurentTrk Any updates on this?

I'm already interested in this :+1:
For now I'm using @maddox API of the pyharmony that exposes the current activity to a MQTT broker, so I can make automations with that, and can use shell_command to start any activity, all within same API.
Here is the repo.

Hey all. I actually just merged a pull and shipped a new version that added support for MQTT command topics. So now you can control your Harmony with MQTT as well as via HTTP, so MQTT isn't just for monitoring state.

This means you can just use simple MQTT switches in HA to handle control of your Harmony hub. You can read more about it in the README.

Here's an example of my config setting up components that my harmony controls:

switch:
  - platform: mqtt
    name: "Family Room TV"
    state_topic:   "harmony-api/state"
    command_topic: "harmony-api/activities/watch-apple-tv/command"
    qos: 0
    payload_on: "on"
    payload_off: "off"
  - platform: mqtt
    name: "Tivo"
    state_topic:   "harmony-api/activities/watch-tv/state"
    command_topic: "harmony-api/activities/watch-tv/command"
    qos: 0
    payload_on: "on"
    payload_off: "off"
  - platform: mqtt
    name: "Apple TV"
    state_topic:   "harmony-api/activities/watch-apple-tv/state"
    command_topic: "harmony-api/activities/watch-apple-tv/command"
    qos: 0
    payload_on: "on"
    payload_off: "off"
  - platform: mqtt
    name: "Xbox"
    state_topic:   "harmony-api/activities/play-xbox-one/state"
    command_topic: "harmony-api/activities/play-xbox-one/command"
    qos: 0
    payload_on: "on"
    payload_off: "off"
  - platform: mqtt
    name: "Wii U"
    state_topic:   "harmony-api/activities/play-wii-u/state"
    command_topic: "harmony-api/activities/play-wii-u/command"
    qos: 0
    payload_on: "on"
    payload_off: "off"
  - platform: mqtt
    name: "Family Room Music"
    state_topic:   "harmony-api/activities/listen-to-music/state"
    command_topic: "harmony-api/activities/listen-to-music/command"
    qos: 0
    payload_on: "on"
    payload_off: "off"

Hi guys,
Thanks for the MQTT work, will have a look on it :)

I worked a couple of hours on the harmony component. See my last github commit:

  • Add switches (support on/off, but status is not accurate)
  • Add RokuEmulated server to receive hub command
  • Fire event on hub command (then you can use automation to react on harmony remote action)
  • Add send_device_command service to send individual command to a device

The status of devices is not sent by the hub, not sure using them as switches in ha is the good option...

Thanks for your efforts @LaurentTrk.

Do you have any updates on this?

Closing this issue as feature requests should be posted in the forum.

Since this is still the first hit in search engines, this was eventually merged. See this page for documentation:
https://home-assistant.io/components/remote.harmony/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sibbl picture sibbl  路  3Comments

Elmardus picture Elmardus  路  3Comments

TheZoker picture TheZoker  路  3Comments

kirichkov picture kirichkov  路  3Comments

neonandu picture neonandu  路  3Comments