Harmony Hub plugin

Posted on
Sat May 28, 2016 6:30 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Harmony Hub plugin

Latest release here: https://github.com/FlyingDiver/Indigo-Harmony/releases

This plugin enables monitoring of certain activities on the Harmony Hub, and provides the capability to send Activity changes and device commands to the Hub. Only AV Activity changes and state changes of Home Automation devices are broadcast by the Hub. As far as I can tell, the hub does not broadcast any specific device commands it sends during an activity, so there's no way to monitor button presses or specific IR commands sent.

This plugin does not allow the hub to send commands to Indigo, per se. You can monitor the activities on the hub, and automate events based on that. If you want to be able to trigger specific Indigo events independent of Activity changes, see my LIFX Bridge plugin: viewforum.php?f=177

Communications with the hub uses the pyharmony library along with the sleekxmpp module. The Python requests module is also required. Pyharmony is included with the plugin. Use pip to install sleekxmpp and requests.

What works as Actions for a specific Hub:

Start Activities
Power Off
Set Channel
Volume Up/Down/Mute
Send Command

There's some menu commands for dumping config data from the hub to the Indigo log. There's also trigger-able events for Activity changes on the hub.

I'm also not at all sure what's going to happen when Activities on a hub are updated, or any changes are synced. If the device IDs that the Hub uses to identify various AV components changes, then the plugin will likely break. I don't currently have a way to resync the plugin's data with the hub. Deleting the hub and recreating it will be required. And even if I can resync, I'm not sure if I can fix any device references if the device IDs change. I only have one Hub device, and I'd be sleeping on the couch if I mess it up. ;)

Feedback on all aspects of the plugin are appreciated.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat May 28, 2016 6:43 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Harmony Hub plugin - BETA

About the generic "Send Command" action...

It takes two strings. One is the Hub's DeviceID for the component you want to send the command to, and the other is the "name" of the command. At some point I'll build a nice UI for constructing the command, but for now you have to fill in text fields. To get the info you need, use the menu command "Write Hub Config to Log". You'll get a LOT of data. It's organized by Activity, with the devices used in each Activity in the data. The following is the data for my "Watch Apple TV" activity:
Code: Select all
        {
            "activityOrder": 2,
            "activityTypeDisplayName": "Default",
            "baseImageUri": "https://rcbu-test-ssl-amr.s3.amazonaws.com/",
            "controlGroup": [
                {
                    "function": [
                        {
                            "action": "{\"command\":\"Mute\",\"type\":\"IRCommand\",\"deviceId\":\"35552594\"}",
                            "label": "Mute",
                            "name": "Mute"
                        },
                        {
                            "action": "{\"command\":\"VolumeDown\",\"type\":\"IRCommand\",\"deviceId\":\"35552594\"}",
                            "label": "Volume Down",
                            "name": "VolumeDown"
                        },
                        {
                            "action": "{\"command\":\"VolumeUp\",\"type\":\"IRCommand\",\"deviceId\":\"35552594\"}",
                            "label": "Volume Up",
                            "name": "VolumeUp"
                        }
                    ],
                    "name": "Volume"
                },
                {
                    "function": [
                        {
                            "action": "{\"command\":\"DirectionDown\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Direction Down",
                            "name": "DirectionDown"
                        },
                        {
                            "action": "{\"command\":\"DirectionLeft\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Direction Left",
                            "name": "DirectionLeft"
                        },
                        {
                            "action": "{\"command\":\"DirectionRight\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Direction Right",
                            "name": "DirectionRight"
                        },
                        {
                            "action": "{\"command\":\"DirectionUp\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Direction Up",
                            "name": "DirectionUp"
                        },
                        {
                            "action": "{\"command\":\"Select\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Select",
                            "name": "Select"
                        }
                    ],
                    "name": "NavigationBasic"
                },
                {
                    "function": [
                        {
                            "action": "{\"command\":\"Stop\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Stop",
                            "name": "Stop"
                        },
                        {
                            "action": "{\"command\":\"Play\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Play",
                            "name": "Play"
                        },
                        {
                            "action": "{\"command\":\"Rewind\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Rewind",
                            "name": "Rewind"
                        },
                        {
                            "action": "{\"command\":\"Pause\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Pause",
                            "name": "Pause"
                        },
                        {
                            "action": "{\"command\":\"FastForward\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Fast Forward",
                            "name": "FastForward"
                        }
                    ],
                    "name": "TransportBasic"
                },
                {
                    "function": [
                        {
                            "action": "{\"command\":\"SkipBack\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Skip Backward",
                            "name": "SkipBackward"
                        },
                        {
                            "action": "{\"command\":\"SkipForward\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Skip Forward",
                            "name": "SkipForward"
                        }
                    ],
                    "name": "TransportExtended"
                },
                {
                    "function": [
                        {
                            "action": "{\"command\":\"Menu\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Menu",
                            "name": "Menu"
                        },
                        {
                            "action": "{\"command\":\"Back\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Back",
                            "name": "Back"
                        }
                    ],
                    "name": "NavigationDVD"
                },
                {
                    "function": [
                        {
                            "action": "{\"command\":\"Home\",\"type\":\"IRCommand\",\"deviceId\":\"35618169\"}",
                            "label": "Home",
                            "name": "Home"
                        }
                    ],
                    "name": "GameType3"
                },
                {
                    "function": [
                        {
                            "action": "{\"command\":\"Wide\",\"type\":\"IRCommand\",\"deviceId\":\"35552586\"}",
                            "label": "Aspect",
                            "name": "Aspect"
                        },
                        {
                            "action": "{\"command\":\"Display\",\"type\":\"IRCommand\",\"deviceId\":\"35552586\"}",
                            "label": "Display",
                            "name": "Display"
                        }
                    ],
                    "name": "DisplayMode"
                }
            ],
            "fixit": {
                "35552586": {
                    "Input": "HDMI 4",
                    "Power": "On",
                    "id": "35552586"
                },
                "35552594": {
                    "Input": "Media Player",
                    "Power": "On",
                    "id": "35552594"
                },
                "35618169": {
                    "Power": "On",
                    "id": "35618169"
                },
                "35761825": {
                    "id": "35761825",
                    "isManualPower": true
                }
            },
            "icon": "userdata: 0x4454e0",
            "id": "19859161",
            "isAVActivity": true,
            "isTuningDefault": false,
            "label": "Watch Apple TV",
            "rules": [],
            "sequences": [],
            "suggestedDisplay": "WatchAppleTV",
            "type": "VirtualGeneric"
        },


For a "Left" button press, look for the "NavigationBasic" section (name is at the end of the section). You can see that the command name is "DirectionLeft" and the deviceID is "35618169".

Alternatively, look toward the end of the config data for the "device" section which has all the known commands for each device in your setup. You can get the device IDs and command names there.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat May 28, 2016 7:04 pm
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Harmony Hub plugin - BETA

SUPER AWESOME!

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Sat May 28, 2016 11:19 pm
peteinau offline
Posts: 65
Joined: Jan 10, 2015

Re: Harmony Hub plugin - BETA

Must say, very excited about this plugin! Thanks for your work in advance :)

I'm having a trouble installing and getting the plugin running, I get the following message in the log. Is there something I need to do?

Enabling plugin "Harmony Hub 0.1.1"
Starting plugin "Harmony Hub 0.1.1" (pid 33691)
Harmony Hub Error Error in plugin execution InitializeMain:

Traceback (most recent call last):
File "plugin.py", line 7, in <module>
ImportError: No module named sleekxmpp

Stopping plugin "Harmony Hub 0.1.1" (pid 33691)
Stopped plugin "Harmony Hub 0.1.1"
Error plugin "Harmony Hub 0.1.1" (pid 33691) failed to start -- restarting in 20 seconds

Posted on
Sun May 29, 2016 2:53 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Harmony Hub plugin - BETA

Looks like sleekxmpp is a prerequisite.

You can install it by typing the following into a terminal window:
Code: Select all
sudo pip2.6 install sleekxmpp
You will need to type your password to authorise the install. :)

Posted on
Sun May 29, 2016 2:55 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Harmony Hub plugin - BETA

Nice! Now I need to get a new harmony remote to test it out with! :D

Computer says no.

Posted on
Sun May 29, 2016 4:42 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Harmony Hub plugin - BETA

Oops. Yes, I forgot to mention that you need to install sleekxmpp. Thanks for the instructions on that.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun May 29, 2016 9:03 am
Woetjes offline
Posts: 117
Joined: Apr 04, 2016
Location: Belgium

Re: Harmony Hub plugin - BETA

Thanks Joe - this plugin is very great!!

Posted on
Sun May 29, 2016 9:53 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Harmony Hub plugin - BETA

The only reasons I'm not already all over this:

    Weather is nice, garden needs work.
    My Harmony setup is off in a couple of ways and I need to fix that first. This has proven awkward to do.
But when it starts raining this afternoon, I'll be all over it!

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Sun May 29, 2016 10:22 am
Londonmark offline
Posts: 509
Joined: Feb 29, 2012

Re: Harmony Hub plugin - BETA

May be misunderstanding this (and don't currently have a Hub) but will this allow two way comma between the Hub and Indigo? In other words will it be possible to control lights etc with an Elite remote?

Posted on
Sun May 29, 2016 10:54 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Harmony Hub plugin - BETA

Londonmark wrote:
May be misunderstanding this (and don't currently have a Hub) but will this allow two way comma between the Hub and Indigo? In other words will it be possible to control lights etc with an Elite remote?


No, for that you want my LIFX-Bridge plugin (viewtopic.php?f=177&t=16120).

Using the LIFX-Bridge plugin, you set things up similarly to using the Alexa-Hue plugin, except with LIFX devices. The hub knows how to control LIFX devices, so you publish selected Indigo Devices or Action Groups as fake LIFX devices. Then you set up the Hub to control those devices. I use that with my Hub/Companion setup to assign selected Lutron scenes to buttons on the Companion remote.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun May 29, 2016 12:53 pm
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Harmony Hub plugin - BETA

Would it make sense to merge these two plugins seeing as they both work with the same hardware?

Computer says no.

Posted on
Sun May 29, 2016 1:02 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Harmony Hub plugin - BETA

durosity wrote:
Would it make sense to merge these two plugins seeing as they both work with the same hardware?


I don't think so. The HarmonyHub is specific to Harmony devices. The LIFX-Bridge one is not. It could be used to enable Indigo integration with any client application capable of controlling LIFX devices, of which the Harmony is just one example.

Also, they talk very different protocols and I really don't want to make things more complicated than they have to be. In fact, I'm ripping the code for controlling LIFX devices out of the plugin, since I found out that Autolog already has a plugin that does that.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun May 29, 2016 1:05 pm
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Harmony Hub plugin - BETA

Makes sense, I thought it only worked with the hub :D

Computer says no.

Posted on
Sun May 29, 2016 1:15 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Harmony Hub plugin - BETA

durosity wrote:
Makes sense, I thought it only worked with the hub :D


Yeah, I actually used a couple of different iOS apps during development, to see what different clients expected from the devices. I even bought an LIFX bulb (which I have no use for) just to get the correct responses from an actual device.

Anyone want to buy an LIFX White 800? ;)

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Who is online

Users browsing this forum: No registered users and 2 guests

cron