Using Amazon Echo and HA bridge to control DisplayFusion

0

 I have been using the echo since it was released in the UK (I’m in Ireland, still works great).I decided it was time to get an echo dot for the room. I wanted to be able to do some simple control, with the light, turn on the speakers and turn on the power connected to the computer (Using a TP-Link WiFi Socket).

Using WOL took a little effort to get running, and of course the HA bridge emulator worked fantastic for triggering it, however, I then wanted to be able to do more, particularly lock the computer and put the monitors into standby.

I tried many many ways to get this working, using PSTools, Wmic; using my home server, but sadly, these commands would not work properly, with some triggering what I wanted, and others doing nothing. Couldn’t figured out why.

Being a big fan of DisplayFusion, I figured, wouldn’t it be great if I could run the function scripts from that program remotely, and then tie it into the HA bridge.

It took some doing and a little sniffing with WireShark to find the commands it was sending through HTTP using DisplayFusions remote app, but thankfully it’s very possible and works very well.

Let’s dig right in and take a look at what was needed to get things up and running.

Straight off the bat, I’m assuming you have working Amazon HA Bridge emulator. This can be set up on a linux/windows computer or using a raspberry PI. This obviously needs to be continually running in the background for the HA Bridge to work. i’m also assuming you have DisplayFusion installed and running, and are somewhat familiar with how it works.

This breakdown is mostly to show how this works, and of course gives you most of the information needed to do it yourself.

Wake on Lan

I might as well start with WOL, and how I went about getting it running with the HA bridge. This part was pretty straight forward, and there is probably many ways for doing it, and probably some that don’t require a HA Bridge at all, but alas, we’re using it for everything else, so why not.

First thing we need is WOL.exe, which can be downloaded from this MC-WOL.EXE . I then created a quick batch file and threw in C:/mc-wol.exe “MacAddressHere” . Note we put the mc-wol.exe in the c:/ directory, so you can do that as well, or place it anywhere and just link directly too it. Save your batch file somewhere, and keep a local link to it ready.

The next step is setting up HA bridge to run our batch file whenever it’s triggered using Alexa. Again, this part is simple, and just involves linking to the batch file created earlier. Name it whatever you want to command Alexa to turn on; for us it was just ‘Computer’, so the command to wake is ‘Alexa turn on Computer‘ .Pick Execute Script/Program under device type and then put the following in the ‘On Url’ section.

In my case it was

[{“item”:”C:\\Users\\Server-PC\\Documents\\WOL\\wake computer.bat “}]

Make sure to include the double \\, and the rest of it, including quotes and such. Just swap it out for your bat file location.

DisplayFusion

Now as mentioned before, the act of triggering DisplayFusion functions came from the desire to be able lock the computer and put the monitors into standby at will, but upon thinking that if I could get DisplayFusion to work remotely, then it would allow almost limitless control with DisplayFusions built in script support.

I figured since DisplayFusion already had remote support using their mobile app, that those commands must be triggered using HTTP and that if I managed to determine exactly which, I can simply have the HA bridge trigger it instead of the app.

Thankfully that just required a little work using WireShark, which is a network traffic sniffer that displays all current traffic pipping through your network connection.

 

I quickly set up the DisplayFusion remote app on my phone and connected it to my computer (The one I wish to control). This requires inputting a security code from DisplayFusion that can be found under Settings – Remote Control.

Once that app was setup, I ran WireShark and begin sniffing out network traffic. I then simply picked the function I wish to trigger using the app and watched as my PC was locked and the monitors entered standby. Once I unlocked it again, I stopped WireShark from sniffing.

I found out that DisplayFusion uses the tcp port 21452, so I did a quick filter with the TCP port using “(tcp.port == 21452 ) or (tcp.port == 21452 )“. That’s when the HTTP link stood out almost as beautifully as the blurred photo above.

 

/remotecontrol/?mode=execute&code=869998&id=e5316cbe-39c8-4493-9d59-2c712930e16a&version=2.1

That was the command needed, and it includes the DisplayFusion security code and function ID right in the link. All we needed now was to direct it to the PC in question, and we could easily activate that same trigger with a simple URL.

Adding DisplayFusion URL to HA bridge

Now it’s time to take a URL and add it to the HA Bridge, this part is pretty simple.

Since the HTTP Link from the remote app used an IP address, we figured changing it to the PC name would be easier.

To set up the HA bridge to accept it, we just need to put in a desired name; in this case we called it ‘Computer Lock’. I then dropped the link into the ‘On Url’ section and changed HTTP Verb to GET and that’s it for setting up the HA Bridge.

Last step was to have Alexa discover new devices, and up came ‘Computer Lock’. Saying ‘Alexa turn on Computer Lock‘, would instantly lock the desktop and put the monitors into standby.

This works exactly how I wished it too, and thankfully having scripting support allows me to pretty much doing anything using Alexa as a voice command. This does require sniffing out each function separately, and setting them up as a individual device, unless you want to get fancy with using both ‘On Url’ and ‘Off URL’ for non related function.

Once you have everything done the first go around, doing it again for any functions you wish to add only takes a few minutes.

That’s pretty much it for using Alexa to control your computer by using functions from DisplayFusion (sounds weird). Perhaps there might be easier ways to determine the function ID’s someway, or perhaps DisplayFusion could put together their own Skill for use with the Echo, with custom names for functions. Would make it easier for all, and skip the need of having a HA Bridge running.

Hopefully this article helps anyone looking to do the same, but if anyone has any similar ideas, or better ways of doing the above, please comment below.

 

Total 0 Votes
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?