Remote Control Devices

Yeah, would like to have Logitech Harmony support too!

I built a Harmony http API bridge for talking to your hub. It fully supports MQTT (how I use it) as well.

You can easily set this up and then create MQTT buttons and sensors for it in HA.

2 Likes

Hi maddox, you don’t happen to have a step-by-step guide on that Harmony HTTP API bridge do you?

I’m sort of new to Home-assistant and this forum, but I came across your post here and on github, and do have some questions.

I’ve set up HA on a Raspberry Pi and am wondering can I install Harmony API on the Pi itself or if I’d need to have another machine for the MQTT (I’ve never played around with MQTT so this would be my first go at it).

It would be quite amazing to get everything running through Home Assistant.

You can totally run it all on your Pi. The latest (0.16) HA has an mqtt service in it already. You can start there. If you just add:

mqtt:

…to your configuration, it will load up. Now you’ll have an MQTT server running locally on port 1883. You can learn more about this here: https://home-assistant.io/components/mqtt/#use-the-embedded-broker

If you want to eventually run your own MQTT server, just install mosquito. sudo apt-get install mosquito and run it in the background. (obviously there’s more to it after that, heh)

Once you have mqtt running, you can configure the harmony bridge to use it using the config.json file. Then to start it you can just run script/server. All of this and more is available in the README.

To keep it running and start it on boot, you’ll have to investigate that for linux. It only supports running as a service like that for OS X right now, because that’s where I run it :stuck_out_tongue_winking_eye:

Excellent information!

So after setting up MQTT and pointing the harmony bridge api to it via the config.json file, I should be able to add switches to the configuration.yaml file, such as you had in this post on github:

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"

Or am I still missing something?

Yup, exactly. If you visit the harmony bridge’s web front end, it actually lists the HTTP api. You can click on the activities endpoint and it will actually load it and show your list of activities and their slugs. Use the slugs in the mqtt topics.

Amazing.

I’ll be trying this out tonight! Thank you!

Hi Maddox,

I seem to still be having some trouble with this.

I have the Harmony API working on the Pi, and I think I have MQTT setup on Home Assistant. I added:

mqtt:

To the configuration.yaml file and it appeared to install properly. I did try installing Mosquitto and running that, but it said that the port was already in use (by Home Assistant, I assume). I then added the IP address of the Pi to the Harmony API config.json file, but all I see at http://raspberrypi.local:8282 is this:

Which I think is displaying information for HTTP, not the MQTT slugs like you mentioned.

The mqtt setting in config.json looks like this:

{
  "mqtt_host": "http://10.0.0.108"
}

Any ideas?

What you see is correct. It’s just a simple front page to show that it’s working allowing you to click into some of the GET http endpoints to see the results of the API. The MQTT topics are not documented here, they are documented on the project’s README file on GitHub.

Hmm, so at this point I should be able to configure the switches in the configuration.yaml file for Home Assistant?

I will have to give this another shot tonight.

Thanks again for helping me out!

maddox:

I seem to have gotten it to work!

I did have to use mosquitto, but once I did, everything seems to work properly.

Thanks for all your assistance!!

:metal::metal: :metal:

@mrtrimble - How did you get this installed in Raspberry PI if I may ask? I couldn’t get forever installed because I couldn’t use the npm command suggested by the script. And pip couldn’t find forever to install it.

Hi @rpitera,

Unfortunately I did not get that working, sort of skipped that part. At the moment I have to start the services manually. Got busy with some work projects and haven’t gotten back to Home Assistant quite yet.

I think it probably can be done though, can you install anything using npm?

No; it bash says NPM is not a valid command. But I’m really new to Raspian specifically and Linux in general; is npm part of the distro or is it something that has to be installed, like with pip?

Hmm… I would try the following commands to install nodejs npm:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install nodejs npm

If all seems to install well, then try using the npm install command to get forever.

@mrtrimble - That definitely fixed the npm issue; thanks very much, Ryan! I got npm installed and working. One or two warns along the way but nothing serious. Unfortunately I got a number of errors with the bootstrap script so it looks like I’m going to have to get @maddox to take a look at my npm debug log. It did install some of it but I couldn’t get the server to launch.

@maddox - Jon, would you be willing to take a look at my debug log and see if I did something wrong? I could PM it to you. I renamed it as a YAML file so I could upload it but it’s actually just a text log file. I’d really like to get my Harmony Hub to join in the HA fun!

Thanks to everyone for the support of a new user!

npm-debug.log.yaml (244.3 KB)

No problem! Glad that worked out for you! @rpitera

1 Like

I should have mentioned that your instructions not only solved the npm problem but also allowed me to install forever without a hitch. My problems were in the harmony-api script. Thanks again.

Hey just wanted to let you know that I finally got this up and working with some great help from @mrtrimble and @beanian - I’ve documented the steps I took here in case anyone reading this thread wants to do the same.