Purpose of this How-To:
To create a pop up message that includes a screen capture in Windows Media Centre to alert when someone is at the front door
Steps:
1. Download and install Beta 2 vmcController on your Windows Media Centre PC. This allows you to control MCE via either HTTP request or via TCP connection. While the message pop up control works via both methods the msgboxrich function that allows the inclusion of an image only works via TCP.
2. Create an event that you will use to trigger the alert. In order to call the popup via TCP I use the script below to do it. The sections in red will need to edited to your MCE location and where your camsnapshot location is.The sections in green can be reworded as your like.
If you use BlueIris like I do, you can also trigger the alert directly from BI. Under the properties of the camera you would trigger from go to Alerts and check the Request from a Web Service option. On the next page in the http section edit the URL to point to the IP or hostname of your HS3 pc and then the group and name to reflect the event that you created
10.1.1.20/JSON?request=runevent&group=Camera&name=Front Door Camera
To create a pop up message that includes a screen capture in Windows Media Centre to alert when someone is at the front door
Steps:
1. Download and install Beta 2 vmcController on your Windows Media Centre PC. This allows you to control MCE via either HTTP request or via TCP connection. While the message pop up control works via both methods the msgboxrich function that allows the inclusion of an image only works via TCP.
2. Create an event that you will use to trigger the alert. In order to call the popup via TCP I use the script below to do it. The sections in red will need to edited to your MCE location and where your camsnapshot location is.The sections in green can be reworded as your like.
Code:
Imports System.Net Imports System.Net.Sockets Imports System.Text Sub Main(parm as object) Const RemoteIP As String = "[COLOR=red]10.1.1.50[/COLOR]" Const PortNumber As Integer = 40500 ' Connect to the remote Dim Client As New TcpClient() Client.Connect(IPAddress.Parse(RemoteIP), PortNumber) Dim NetStream As NetworkStream = Client.GetStream() ' Send something SendString(NetStream, "msgboxrich ""[COLOR=lime]Motion Detected[/COLOR]"" ""[COLOR=lime]Front door[/COLOR]"" 10 ""OK"" ""modal"" ""[URL="file://\\hostname\blueiris\cam1.jpg"][COLOR=red]\\hostname\blueiris\cam1.jpg[/COLOR][/URL]""") ' Receive reply Dim Reply As String = ReadString(Client) ' Disconnect Client.Close() End Sub Private Function ReadString(ByVal Client As System.Net.Sockets.TcpClient) As String Dim Stream As NetworkStream = Client.GetStream Dim Buffersize As Integer = Client.ReceiveBufferSize Dim Data(Buffersize) As Byte If Stream.CanTimeout Then Stream.ReadTimeout = 1000 * 5 End If Dim BytesRead As Integer = Stream.Read(Data, 0, Buffersize) Return Encoding.ASCII.GetString(Data, 0, BytesRead) End Function Private Function SendString(ByVal Stream As NetworkStream, ByVal Data As String) As Boolean Dim Bytes As [Byte]() = Encoding.ASCII.GetBytes(Data) If Stream.CanTimeout Then Stream.WriteTimeout = 1000 * 5 End If Stream.Write(Bytes, 0, Bytes.Length) Return True End Function
10.1.1.20/JSON?request=runevent&group=Camera&name=Front Door Camera