Test from ANOTHER MACHINE THAN YOUR WMC, that you can telnet to port 40500 to ensure your firewall settings are correct.
This CMD: “telnet yourWMCip 40500”
Should get something like this: “204 Connected (Clients: 2 Version: 0.1.0 Build Date: 5/25/2010)”
Since PLEG now supports LUUP in the actions, I will not be continuing this plugin. You can paste this Luup code below in a normal Scene (in Luup tab) or in PLEG actions (need 6.0+).
Variables:
I need some additional research on how to provide the following variables to the actions. For example, a scene controller has 2 variables for the setlight.
1 Variable (URL): PlayVideo, PlayAudio, Goto ExtensibilityURL
3 Variables (“Title” “Message Here” “TimeoutSec”): MsgBox
Speed:
Currently takes about 6 seconds to fire first command. VMC Controller can keep socket open, so I will investigate how to speed this up by not closing the connection.
Logging:
Ideally, I would log the result of the command from the WMC server (success/fail).
Since PLEG now supports LUUP in the actions, I will not be continuing this plugin. I entered working Luup code for WMC commands (play, pause, etc.) and a message box samples in step #3 to copy and paste.
Cheers!
PS - I’m using this streamlined code to use with VoxCommando and WMC Message box on the same PC:
--TTS and WMC Server
ttsHost = "192.168.0.100"
--TTS Funtions
function ttsAlert(ttsAlertName)
local socket = require("socket")
local udp = socket.try(socket.udp())
socket.try(udp:sendto("VC.TriggerEvent&&" .. ttsAlertName, ttsHost, 33000))
end
function ttsMsg(ttsMsg)
local socket = require("socket")
local udp = socket.try(socket.udp())
socket.try(udp:sendto("tts.speak&&" .. ttsMsg, ttsHost, 33000))
end
function tvMsgBox(wmcTitle,wmcMsg)
local socket = require("socket")
tcp = assert(socket.connect(ttsHost, 40500))
tcp:send("msgbox \"" .. wmcTitle .. "\" \"" .. wmcMsg .. "\" 8")
tcp:close()
end
--General
function HTTPGet(URL)
local status, result = luup.inet.wget(URL, 3)
end
You can than call the functions:
ttsAlert("Motion")
ttsMsg("Outdoor Sensor Warning,, Motion Detected in the Downstairs Patio Lawn")
tvMsgBox("Outside_Motion","Motion Detected in the Downstairs Patio Lawn")
Example of how to call a camera webpage when motion is detected in WMC, and then return to the playing media (which was a small PIP window) after 15 seconds to full screen.
In this example, it also tells my ISpy camera server to start recording.
--TTS and WMC Server
ttsHost = "192.168.0.100"
--TTS Funtions
function ttsAlert(ttsAlertName)
local socket = require("socket")
local udp = socket.try(socket.udp())
socket.try(udp:sendto("VC.TriggerEvent&&" .. ttsAlertName, ttsHost, 33000))
end
function ttsMsg(ttsMsg)
local socket = require("socket")
local udp = socket.try(socket.udp())
socket.try(udp:sendto("tts.speak&&" .. ttsMsg, ttsHost, 33000))
end
function tvMsgBox(wmcTitle,wmcMsg)
local socket = require("socket")
tcp = assert(socket.connect(ttsHost, 40500))
tcp:send("msgbox \"" .. wmcTitle .. "\" \"" .. wmcMsg .. "\" 8")
tcp:close()
end
--General
function HTTPGet(URL)
local status, result = luup.inet.wget(URL, 3)
end
--iSpy Result
function iSpyStartRecord(Camera)
local status, result = luup.inet.wget("http://192.168.0.100:8080/record?ot=2&oid=" .. Camera, 2)
end
function iSpyStopRecord(Camera)
local status, result = luup.inet.wget("http://192.168.0.100:8080/recordstop?ot=2&oid=" .. Camera, 2)
end
--WMC Functions
function GoToUrl(GoToUrl)
local socket = require("socket")
tcp = assert(socket.connect(ttsHost, 40500))
tcp:send("GOTO ExtensibilityUrl C\:\\ProgramData\\Microsoft\\Windows\\StartM~1\\Programs\\Accessories\\MediaC~1\\MediaC~1\\" .. GoToUrl .. ".htm \r\n")
tcp:close()
luup.call_delay("delayFullScreen",15)
end
function delayFullScreen()
local wmcCmd = "fullscreen"
local socket = require("socket")
tcp = assert(socket.connect(ttsHost, 40500))
tcp:send("button-back" .. "\r\n")
luup.sleep(500)
tcp:send("fullscreen" .. "\r\n")
end
And then I call these funtions:
GoToUrl("Cam-DPA-Lawn")
ttsMsg("Outdoor Sensor Warning,, Motion Detected in the Downstairs Patio Lawn")
tvMsgBox("Outside_Motion","Motion Detected in the Downstairs Patio Lawn")
@wilme2 You may need to learn Luup scene programming best practices before applying this code. I would love to help, but that is beyond my expertise in WMC via VMC Controller.
It is high time for me to start adding some Vera functionality to my WMC DVR. AgileHumor, I assume the pop-up message boxes work on extenders too? I only have one in my bedroom, but it would be nice for anything I do to appear on all my TVs (the other three all show the main PC)…
Hmm, i’ve never seen MCEController…and VMCController has kind of been slow/non-existent. VMC Controller does support extenders. Don’t know if MCEController does.
You should just need to use the same code, but change the port/command codes.
I see some old posts on MCEController that did not come up on my first search… Like this one http://forum.micasaverde.com/index.php/topic,9205.0.html which gives good information on sending commands (but not full integration like you are doing…)
@wilme2 Does MCE Controller work with extenders? Are you able to get media info back from MCE? I’ve heard it is “better” than vmccontroller, but I have extenders!
@AgileHumor I love your scripts and will be testing them soon. I’m hoping to make these as robust as possible and want to know how they behave in certain circumstances. Looks like the method you used to show video for 15 secs involved popping up the webpage then simulating the back button, correct? If I’m in the middle of playing media (recorded show, live show, music etc.), does the show pause then play again when it returns? If I want to return earlier by pressing back, does the back button effectively be pressed twice (once by me and once by the script? Does it leave the web page open in the background after the 15 seconds?
Pause is a big problem as I don’t know the state of WMC. Double tapping pause resumes, so you can’t pause multiple times…or every other one = play.
Stop is most reliable for me, as pausing TV will resume after the registry defined playback buffer is exceeded (default 30 minutes). Stop will make sure it doesn’t come back. However, I would really prefer pause.
I’d love to know the state of WMC so I can pause only when playing video/audio/netflix and stop when playing LiveTV. The XMBC team already has a cool plugin that has this called XBMC State:
FYI, Here is my Startup LUA funtions in PLEG. MSGBox is near the top. WMC pop to camera at bottom:
--TTS and WMC Server
ttsHost = "192.168.0.100"
--TTS Funtions
function ttsAlert(ttsAlertName)
local socket = require("socket")
local udp = socket.try(socket.udp())
socket.try(udp:sendto("VC.TriggerEvent&&" .. ttsAlertName, ttsHost, 33000))
end
function ttsMsg(ttsMsg)
local socket = require("socket")
local udp = socket.try(socket.udp())
socket.try(udp:sendto("tts.speak&&" .. ttsMsg, ttsHost, 33000))
end
function tvMsgBox(wmcTitle,wmcMsg)
local socket = require("socket")
tcp = assert(socket.connect(ttsHost, 40500))
tcp:send("msgbox \"" .. wmcTitle .. "\" \"" .. wmcMsg .. "\" 5")
tcp:close()
end
--General
function HTTPGet(URL)
local status, result = luup.inet.wget(URL, 3)
end
--iSpy Result
function iSpyStartRecord(Camera)
local status, result = luup.inet.wget("http://192.168.0.100:8080/record?ot=2&oid=" .. Camera, 2)
end
function iSpyStopRecord(Camera)
local status, result = luup.inet.wget("http://192.168.0.100:8080/recordstop?ot=2&oid=" .. Camera, 2)
end
--WMC Functions
function GoToUrl(GoToUrl)
local socket = require("socket")
tcp = assert(socket.connect(ttsHost, 40500))
tcp:send("GOTO ExtensibilityUrl C\:\\ProgramData\\Microsoft\\Windows\\StartM~1\\Programs\\Accessories\\MediaC~1\\MediaC~1\\" .. GoToUrl .. ".htm \r\n")
tcp:close()
luup.call_delay("delayFullScreen",15)
end
function delayFullScreen()
local wmcCmd = "fullscreen"
local socket = require("socket")
tcp = assert(socket.connect(ttsHost, 40500))
tcp:send("button-back" .. "\r\n")
luup.sleep(500)
tcp:send("fullscreen" .. "\r\n")
end
MCE Controller only works with the PC on which it is installed. Designed to be a remote control app, eliminating the need for an IR receiver on the PC. For my extender I use IR - sadly enough the Ceton Echo does not support IP control other than via their own smartphone app (sigh). You can only send commands, but not get media info…
Still, works great controlling a WMC via iRule - and with some modification to these scrips, I should be able to send commands from Vera…