Control WMC with the Amazon Echo? Try this
-
- Posts: 1294
- Joined: Wed Feb 24, 2016 3:36 pm
- Location:
- HTPC Specs:
-
- Posts: 1294
- Joined: Wed Feb 24, 2016 3:36 pm
- Location:
- HTPC Specs:
Here's what should be a simpler way:
Install and run MCE Controller from https://mcec.codeplex.com/
Download latest Python (3.5 or above)
Install it, choosing the option to have python added to the PATH
Create C:\webserver and C:\webserver\cgi-bin directories
In C:\webserver put the batch file webserver.bat with this content:
In C:\webserver\cgi-bin put the file runCmd.py with this content:
Run C:\webserver\webserver.bat
In a browser on same machine go to ://localhost:5050/cgi-bin/runCmd.py?cmd=mcestart
That, in theory, should start Windows Media Center. All that's left:
Open up the port 5050 in your firewall and all the way through from the internet
Create recipes in http://ifttt.com that trigger via Alexa and call your webserver with the command of your choosing
For a bit of safety the runCmd.py needs to be updated to a) require a "secret" key to be passed in the URL for the command to work plus b) the code should only allow whitelisted commands go through as it would be unwise to allow access to all the dangerous abilities of MCE Controller from the internet to your HTPC
Make sure C:\webserver\webserver.bat runs on Windows startup by placing a shortcut to it in the Programs -> Startup folder
Install and run MCE Controller from https://mcec.codeplex.com/
Download latest Python (3.5 or above)
Install it, choosing the option to have python added to the PATH
Create C:\webserver and C:\webserver\cgi-bin directories
In C:\webserver put the batch file webserver.bat with this content:
Code: Select all
cd \webserver
python -m http.server --cgi 5050
Code: Select all
#!/usr/bin/env python
import cgi
import socket
LOCALHOST_IP = '127.0.0.1'
MCE_PORT = 5150
arguments = cgi.FieldStorage()
cmd = arguments.getvalue("cmd") + "\n"
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((LOCALHOST_IP, MCE_PORT))
sock.send(bytes(cmd, 'utf-8'))
sock.close()
print("Content-Type: text/plain\n")
print("Sent " + cmd + "OK!")
In a browser on same machine go to ://localhost:5050/cgi-bin/runCmd.py?cmd=mcestart
That, in theory, should start Windows Media Center. All that's left:
Open up the port 5050 in your firewall and all the way through from the internet
Create recipes in http://ifttt.com that trigger via Alexa and call your webserver with the command of your choosing
For a bit of safety the runCmd.py needs to be updated to a) require a "secret" key to be passed in the URL for the command to work plus b) the code should only allow whitelisted commands go through as it would be unwise to allow access to all the dangerous abilities of MCE Controller from the internet to your HTPC
Make sure C:\webserver\webserver.bat runs on Windows startup by placing a shortcut to it in the Programs -> Startup folder
- DavidinCT
- Posts: 1556
- Joined: Mon Feb 13, 2012 3:45 pm
- Location:
- HTPC Specs:
Nice find... I had a feeling with the MCE Controller app, as you can do lots of stuff from that app, IP control is one of them.
-Dave
Twitter @TheCoolDave
Windows Media Center certified and WMC MVP 2010 - 2012
Twitter @TheCoolDave
Windows Media Center certified and WMC MVP 2010 - 2012