Setup SmartThings and Harmony Play/Pause/Stop Buttons For Lights using EventGhost on a Windows

The full guide has been posted, so I have removed the PDF version of this.

Required Apps/Hardware:

• Samsung SmartThings Hub https://www.samsung.com/us/smart-home/smartthings/hubs/f-hub-us-2-f-hub-us-2/
• Harmony Hub (If Using Bluetooth) https://www.logitech.com/en-us/product/harmony-hub
• (Optional) The Harmony Elite Remote is used in this tutorial. If you only use the hub you will need to use different commands. https://www.logitech.com/en-us/product/harmony-ultimate-home?crid=60
• Harmony IR Remote (If Using IR Only) https://www.logitech.com/en-us/harmony-universal-remotes
• eventGhost Software http://www.eventghost.net/
• Python Installed https://www.python.org/
• SmartThings_CLI from Github https://github.com/rllynch/smartthings_cli
• Bluetooth Dongle (If Using Bluetooth) Bluetooth USB Adapter [On Amazon] This one is what I am using and it connects just fine at about 25’ and it’s going through a wall.
• IR Receiver (If Using IR) Media Center MCE PC Remote Control [On Amazon]
• Windows Physical Computer or Windows Virtual Machine

Overview:

If you are familiar with the products/software above you may not need to follow this guide in full detail. The purpose of this guide is to give the ability to use regular buttons on your Harmony remote to control your lights that you have added into SmartThings. The Harmony software will only allow you to control SmartThings added devices (ex: lights) with activities, but I wanted the ability to press play, pause, or stop and the lights react to those buttons. This guide will help you accomplish this task. The basic process is we will be using Windows PC commands that can be setup within the Harmony App that will send to a computer running eventGhost. EventGhost will see the specific command come through (ex: Ctrl+Shift+A [On] & Ctrl+Shift+M [Off] ) and it will run a command line entry that will talk to SmartThings and that will turn off/on your lights. Through this guide I will explain steps on setting this up with Bluetooth, but you can use a Windows IR receiver and add that device into your Harmony software. My choice was to run a virtual machine (VM) on one of my ESXi servers and pass the Bluetooth dongle through to my VM. I went this route, so I didn’t have to setup a Windows machine in my movie room. You can do this same setup on a physical Windows computer as well.

Windows Options:

You can install the Windows software on many different types of Windows hardware. You can use an Windows IR receiver on a laptop, Intel NUC, HTPC, etc and not do the Bluetooth setup. You would just add the Windows IR receiver into the Harmony software as a device. If you don’t have a Windows IR receiver you can go the Bluetooth route and use the same type of devices. Going Bluetooth you don’t have to have the device be in the same room or area as your Harmony hub. For example, I am running my software on a virtual machine, but you could have your normal daily computer nearby and you could use that. Note: This software has to have the computer always active with no sleep features setup. If you are thinking of putting this on a personal computer, that computer would be always on for anyone to access. If you have Windows 10 Pro or above you could run this on Hyper-V and keep that always running and just not let your PC sleep. Just a few ideas.

Attention For VM Installation

  • If running on a VM, Windows 10 with ESXi it does not seem to pass commands from the Harmony Hub. It is probably the same with VMware Workstation or Hyper-V. Maybe Windows 10 or Harmony will release an update to make it work, but for now it will not pass data into the server running as a VM on ESXi. You will need to use Windows 8.1 or a previous version. I tested on Windows 8.1 and it worked just fine. If you are setting Bluetooth up on a physical machine running Windows 10 you will be fine with this setup. This only applies to a VM installation.
  • If running through VM you cannot use RDP or the commands from harmony will not send. You have to use VNC or if you are running on ESXi/Hyper-V you will need to use the remote console to configure and test.

If you are not a huge Windows fan you could follow the similar steps above and not use eventGhost. The process would be very similar, but I cannot say the commands will not have any send issues similar to Windows 10 on a VM. Defiantly worth a try if you have something like a raspberry pi.

Computer Account:

Your account you use to setup everything will need to have local admin rights to install the “SmartThings_cli” and that will be what is linked to SmartThings. If you switch accounts at any point you will need to re-setup starting on step 8.6

Step By Step Guide:

A few steps may not be into great detail, so if you are not 100% familiar with an area you may have to do a little extra research.

Note: This guide assumes you already have your SmartThings Hub and Harmony Hub setup with some basic configurations.

Step 1: Open the Harmony app on your smartphone and connect to your harmony hub
Step 2: Click Devices, Click Edit Devices, Click Device
Step 3: Add Computer (Windows)
Step 4: Pair Bluetooth with Windows Computer (Note: You could use a USB IR receiver instead)
- Your Harmony Hub and Windows computer need to be within range for this to pair.
Step 5: Install eventGhost on your Windows Computer
Step 6: Install Python on your Windows Computer
Step 7: Download GitHub’s SmartThings_cli to a directory and extract it to your Windows Computer.

https://github.com/rllynch/smartthings_cli

Step 8: Follow installation instructions for SmartThings_cli on Github. Sub-steps below have been added if you are not 100% familiar with running a Python script. Skip sub-steps if you are. Some command line information in the instructions on Github are missing the “.py”, so make sure you add that if you don’t follow these sub-steps.

Note: Steps 1-3 on Github need to be completed before doing the sub steps below.

Step 8.1: If you are not 100% familiar with Python you will need to add the Python working directory to your systems variable path to install SmartThings_cli easily or run the command with the full path to python’s exe and the install location. The environment variable makes it easy and simpler to run other Python programs down the road. The working path will be similar to “C:\Users[your username]\AppData\Local\Programs\Python\Python##-##\python.py”. You just append it to the others existing variable values with a semicolon ;

image

Step 8.2: Now open a command prompt as administrator and change your directory to the location you saved the downloaded/extracted the “SmartThings_cli” folder. After you change the directory type the installation command below.

image

Step 8.3: If you get an error about missing “Microsoft Visual C++ Build Tools” you will need to install that first and re-run the installer.

http://landinghub.visualstudio.com/visual-cpp-build-tools

image

Step 8.4: When the setup completes it should end looking similar to this output.

image

Step 8.5: If you didn’t modify the zip extraction files/folders of the SmartThings_cli zip any you will want to change the directory one more time.

image

Step 8.6: The next step is to run the connection step between the Python script and SmartThings. You will need to gather the information from the “Oauth” section. This was from “Step 2” on the Github Website guide. You will need to have the “Client ID” and the “Client Secret”. Once you have that information enter it into the locations that say “CLIENTID” and “CLIENTSECRET”.

Note: you have to have the first section typed: smartthings_cli.py

image

Step 8.7: Once you run the command you will see the below message and you will need to copy the complete URL into your browser. Once you go to that URL you will login with your “SmartThings” account and select the “From” and which devices you want to control (ex: lights).

image

Step 8.8: Now you can send commands to your SmartThings through CLI running the commands below. The area that says “Movie Room vSwitch” is the name of my switch. If your switch is called Living Room in SmartThings you would type this to turn on the switch: smartthings_cli.py set switch “Living Room” on

image

Now you have the commands setup to type into a command prompt, so we can use these same commands in EventGhost to be triggered based on inputs from the remote.

EventGhost Setup:

Step 1: Create A New Folder


Step 2: Click Add Plugin

Step 3: Select Keyboard and click OK twice

Note: Now all keyboard input is logged through EventGhost. If you press a key or send a key from your remote it will be detected.

Step 4: Test Keystrokes from the Harmony App.

Step 5: Add Macro

image

Step 6: You can select “Python Command” or “Windows Command” for this step. You will be running the same commands as you did during the “SmartThings_cli” setup process. Since the command line process is all setup I am going to use “Windows Command”.

image
image

Step 7: Using the Harmony Mobile app, go into your “Watch PC” activity and edit the buttons to have the play and pause button to send special commands. I used Ctrl+Shift+A for off and Ctrl+Shift+M for on, which you will see eventGhost sees the commands a little different (Shift+Shift+Ctrl+Ctrl+A), but all you need is the final command. I circled them below. Once they show you up just drag and drop them into each section you want to control.

Step 8: Go to your remote and select “Watch PC” as the activity and press Play and Pause on your remote and enjoy your lights. I have my stop button turn the lights on as well. Now that you have this process figured out you can go into other activities like “Watch Xbox” and add a sequence on the Play/Pause/Stop buttons. You will just need to add the Windows PC to the “Watch Xbox” activity and change the button options. Instead of using a regular button command you will use a sequence process to send an Windows PC command and the play command with one button press. I have an example below under the Harmony Activity Setup section.

Final Virtual Switch (vSwitch) Note: I use a vSwitch within Smartthings because you can link routines to that vSwitch. Within the routine you can tell how bright you want your lights. If you do this process you will want to setup a routine within SmartThings to turn on the vSwtich or turn off the vSwitch if one of the lights are manually turned on or turned off with the switch.

Harmony Button Sequence Setup:

Step 1: When you setup your activity on the Mobile App you will always add in your “Windows Computer” to the activity for light control even if you are not using it for anything else besides the lights. You will use the Windows Computer commands to just send the inputs to turn on or off the lights. For example, with my Xbox setup I have it when I push stop I have a sequence setup to stop the Xbox and send the Ctrl+Shift+M command to the Windows Computer to turn on the lights. KV-SH is my Windows Computer. You can do this same process for play button and you would send a separate command like Ctrl+Shift+A.

Tips/Tricks:

  • I have a VM running Windows 8.1 for the setup above. I have Sysinternals Autologon setup to automatically log me back into the computer if a reboot occurs.

  • I modified my pause and stop button for Plex and Netflix. For my pause button I changed the pause command to “A” and for the stop button I did a double stop sequence with a 1s delay between the two. On both buttons I moved the “Windows Computer” command to the top. Not all applications work perfect with this setup, but I mostly use Plex and Netflix, so I can use other commands for other apps or adjust the lights with the pause/play buttons. A good example, is the Fox Sports Go app on Xbox. You cannot use the play button to start the live TV, so you can press play to turn off the lights, but you have to press OK to activate the stream.

  • I have had the Bluetooth connect drop on me and not work after a reboot, which required a re-pair. This was all because of the power settings on the computer and on the Bluetooth devices.

  • Disable Power Saving On Bluetooth Dongle

  • I disabled power savings on the “Bluetooth HID Device” under harmony keyboard as well.

  • Disable computer sleep under “Power Options”

2 Likes

For some odd reason, I understood every step…

I took some time to get something similar working on my Kodi devices and it’s a really cool feature. Great write up!

Sounds like a really excellent idea, but it has been known for several years that PDF files can contain either viruses or malware. I suggest you just come back in a few days after your forum status has improved and you can post your full project report here. I’m sure there will be many people interested in it! :sunglasses:

Yeah, I guess that is true. I’ll remove the PDF route being much safer then a zip from above, since that isn’t always 100% true. This file is safe to view. If my status increases and I will remove the PDF link and apply the content directly. I took sometime the first time I tried to post it all and when it said I couldn’t I was pretty bummed. As others view and report that will help confirm the link is legit. Thanks for your comment!

If anyone is seeing this comment first please know this link does not contain a virus or harmful information. Feel free to run it through as many tests as you would like. It is just a converted OneNote tab into PDF. JDRoberts was just pointing out that I original said this document was a PDF and not a zip, so it is saver in the original post. I removed that section of text from above.

1 Like

Great write-up! Regarding the PDF, I agree that they can potentially contain malware; however, in this instance it is not the case. I scanned it with a couple pieces of software and it is fine.

Please do rewrite it with the forum markup when able to though for easier reading in the future.

Thanks for sharing.

1 Like

You said you were unable to find anything else that allowed you to do this.

If you check the quick browse lists in the community – created wiki and look in the project reports under AV projects, there are at least two other similar methods. Each author had somewhat different objectives, and I think yours may be more straightforward specifically for those who want to add lighting control, but I just thought you might be interested in the others as well. :sunglasses:

http://thingsthataresmart.wiki/index.php?title=How_to_Quick_Browse_the_Community-Created_SmartApps_Forum_Section

I think the most popular right now is kukuharmony, although it is using a raspberry pi rather than a Windows machine as the server. One of the reasons it’s popular is because it’s one of the few that allow you to have multiple harmony hubs. I wasn’t sure whether your method only works with one or whether it works with multiples.

@zraken first posted a method back in 2015 using the HarmonyHub CLI and a Linux hub

So there are a couple of other options, but unless you start with the quick browse lists they are pretty difficult to find in the forums. :sunglasses:

Is there a way to run it on a Raspberry Pi so you don’t need to have a PC running 24/7?

@agenovese820: The links posted by @JDRoberts won’t lead you to accomplishing the same task as my guide, so don’t try and mix those together or it will be a little confusing. Those links show how to control harmony added devices through the harmony API using CLI.

The process for the Raspberry Pi would be similar as my guide, but I don’t have any experience in how the Raspberry Pi can be added with a bluetooth or IR dongle into Harmony as a device. If you can figure out how to do that and have something run on the Raspberry Pi to capture the remote inputs and have Python installed on your Raspberry Pi and do a similar process as the guide shows with Windows.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.