To be able to send data to HouseBot, use the External Control device just like the Echo example in the Tips and Tricks section. Set it to ASCII = NO and assign a port.
I downloaded Mongoose webserver and assigned a port to it different than the standard 80. Opened this port in my router and now any application able to send url (http://myip:myport/index.vbs?here_comes_my_data) like IOS Geofancy or IOS Home Remote or IOS iControl can be used to control HouseBot.
A simple and nice example would be with Geofancy: I set a point on my house's location with a radius of 50 meters. When leaving the radius, an url gets sent to Mongoose which index.vbs parses and inputs the data using external control to HouseBot. I can have HouseBot check if the garagedoor is closed and if not, notify myself that I forgot to close the door.
Below the code for Mongoose config file and the code for index.vbs
Copy C:\Windows\System32\cscript.exe to Mongoose document root
Have fun!
cgi_interpreter cscript.exe
cgi_pattern **.cgi$|**.vbs$|**.php$|**.pl$
document_root C:\Program Files\Webserver
listening_port 80
Code: Select all
Option Explicit
Dim objShell
Dim objHB
Dim strValue
Dim intLength
Dim ReceivedData
Dim arrData
Dim arrLabel
Dim nit
Set objShell = CreateObject("WScript.Shell")
Set objHB = CreateObject("HBControlMod.HBControl")
Call objHB.Connect(4721, "192.168.0.3", "")
For Each strValue In objShell.Environment("Process")
If strValue = "REQUEST_METHOD=POST" Then
intLength = objShell.ExpandEnvironmentStrings("%CONTENT_LENGTH%")
ReceivedData = Replace(WScript.StdIn.Read(intLength), "?", "")
Exit For
End If
If InStr(strValue, "QUERY_STRING") Then
arrData = Split(Replace(Replace(strValue, "QUERY_STRING=", ""), "%20", " "), "&")
For nit = 0 To UBound(arrData)
arrLabel = Split(arrData(nit), "=")
Select Case arrLabel(0)
Case "cmd": ReceivedData = arrLabel(1)
Case "id" : ReceivedData = ReceivedData & "^" & arrLabel(1)
End Select
Next
Exit For
End If
Next
Call objHB.SetPropertyValue("myDevice", "myProperty", ReceivedData)
Set objHB = Nothing
Set objShell = Nothing