Btinternet

Home

Btinternet, including btinternet in my blog, and btinternet talk in Folkestone.

Venues:

The Kings Head 4.08 pub bar booze real ale restaurant food music :: [comment] :: [delete]
A nice old style Shepherd Neame boozer, with regular events, fireplaces, and a piano in the corner. www.kingsheadhythe.co.uk

Rate The Kings Head

Blog / forum etc:

RE: Linksys WVC54G wireless camera, btinternet SMTP and gmail

Pictures

I have a similar problem and I got tired of fighting with it. Most of these cameras also will send a screen shot to an ftp server so I wrote a vbscript that polls the server and then sends an email using my workplace smtp server. Obviously, you need an external ftp and smtp server that will accept your requests, and I run the script on my workstation at work. I am a beginner at script writing and I am sure that a real programmer could come up with a more elegant solution, but I was able to get the script to work well enough so that I feel more secure leaving my house unoccupied. I loop the script once a minute and send the email to my work address that is automatically forwarded to my blackberry with the first and last images as attachments. The ftpdownload function that I found online is unchanged. The script runs until it finds a specially named text file in the working folder. (I have a separate script to create that file sitting on my desktop.) All images are saved to an archive folder for later review if necessary.

Function FTPDownload(sSite, sUsername, sPassword, sLocalPath, sRemotePath, _

sRemoteFile)

'This script is provided under the Creative Commons license located

'at http://creativecommons.org/licenses/by-nc/2.5/ . It may not

'be used for commercial purposes with out the expressed written consent

'of NateRice.com

Const OpenAsDefault = -2

Const FailIfNotExist = 0

Const ForReading = 1

Const ForWriting = 2



Set oFTPScriptFSO = CreateObject("Scripting.FileSystemObject")

Set oFTPScriptShell = CreateObject("WScript.Shell")

sRemotePath = Trim(sRemotePath)

sLocalPath = Trim(sLocalPath)



'----------Path Checks---------

'Here we will check the remote path, if it contains

'spaces then we need to add quotes to ensure

'it parses correctly.

If InStr(sRemotePath, " ") > 0 Then

If Left(sRemotePath, 1) <> """" And Right(sRemotePath, 1) <> """" Then

sRemotePath = """" & sRemotePath & """"

End If

End If



'Check to ensure that a remote path was

'passed. If it's blank then pass a ""

If Len(sRemotePath) = 0 Then

'Please note that no premptive checking of the

'remote path is done. If it does not exist for some

'reason. Unexpected results may occur.

sRemotePath = ""

End If



'If the local path was blank. Pass the current

'working direcory.

If Len(sLocalPath) = 0 Then

sLocalpath = oFTPScriptShell.CurrentDirectory

End If



If Not oFTPScriptFSO.FolderExists(sLocalPath) Then

'destination not found

FTPDownload = "Error: Local Folder Not Found."

Exit Function

End If



sOriginalWorkingDirectory = oFTPScriptShell.CurrentDirectory

oFTPScriptShell.CurrentDirectory = sLocalPath

'--------END Path Checks---------



'build input file for ftp command

sFTPScript = sFTPScript & "USER " & sUsername & vbCRLF

sFTPScript = sFTPScript & sPassword & vbCRLF

sFTPScript = sFTPScript & "cd " & sRemotePath & vbCRLF

sFTPScript = sFTPScript & "binary" & vbCRLF

sFTPScript = sFTPScript & "prompt n" & vbCRLF

sFTPScript = sFTPScript & "mget " & sRemoteFile & vbCrLf

sFTPScript = sFTPScript & "mdel " & sRemoteFile & vbCrLf

'sFTPScript = sFTPScript & "ls" & vbCrLf

sFTPScript = sFTPScript & "quit" & vbCRLF & "quit" & vbCRLF & "quit" & vbCRLF

sFTPTemp = oFTPScriptShell.ExpandEnvironmentStrings("%TEMP%")

sFTPTempFile = sFTPTemp & "" & oFTPScriptFSO.GetTempName

sFTPResults = sFTPTemp & "" & oFTPScriptFSO.GetTempName

'Write the input file for the ftp command

'to a temporary file.

Set fFTPScript = oFTPScriptFSO.CreateTextFile(sFTPTempFile, True)

fFTPScript.WriteLine(sFTPScript)

fFTPScript.Close

Set fFTPScript = Nothing

oFTPScriptShell.Run "%comspec% /c FTP -n -s:" & sFTPTempFile & " " & sSite & _

" > " & sFTPResults, 0, TRUE



Wscript.Sleep 1000



'Check results of transfer.

Set fFTPResults = oFTPScriptFSO.OpenTextFile(sFTPResults, ForReading, _

FailIfNotExist, OpenAsDefault)

sResults = fFTPResults.ReadAll

'WScript.Echo(sResults)

fFTPResults.Close



oFTPScriptFSO.DeleteFile(sFTPTempFile)

oFTPScriptFSO.DeleteFile (sFTPResults)



If InStr(sResults, "226 Transfer complete.") > 0 Then

FTPDownload = True

ElseIf InStr(sResults, "File not found") > 0 Then

FTPDownload = "Error: File Not Found"

ElseIf InStr(sResults, "cannot log in.") > 0 Then

FTPDownload = "Error: Login Failed."

Else

FTPDownload = "Error: Unknown."

End If



Set oFTPScriptFSO = Nothing

Set oFTPScriptShell = Nothing

End Function

'Set up array

Dim fileAttach()

'On Error Resume next

'Check date and see if download folder exists

strdate = date

strdate = Split(strdate,"/")

strFolderName = strdate(2) + strdate(0) + strdate(1)

strFTPFolder = "/camera/snapshot/"

Set objFSO = CreateObject("Scripting.FileSystemObject")

'Create archive folder and reset working folder

If Not objFSO.FolderExists("C:SecurityCam") Then

objFSO.CreateFolder("C:SecurityCam")

End If

If Not objFSO.FolderExists("C:SecurityCamArchive") Then

objFSO.CreateFolder("C:SecurityCamArchive")

End If

If Not objFSO.FolderExists("C:SecurityCamWorkingFolder") Then

objFSO.CreateFolder("C:SecurityCamWorkingFolder")

Else 'delete any subfolder

objFSO.DeleteFolder("C:SecurityCamWorkingFolder")

objFSO.CreateFolder("C:SecurityCamWorkingFolder")

End If

strArchiveFolder = "C:SecurityCamArchive" + strFolderName

If Not objFSO.FolderExists(strArchiveFolder) Then

objFSO.CreateFolder(strArchiveFolder)

End If

loops = 0

Do While True

'Check for stop request

Set objFExists = CreateObject("Scripting.FileSystemObject")

If objFExists.FileExists("C:SecurityCamWorkingFolderStop FTP Monitor.txt") Then

'WScript.Echo(" Script Ended. Loops= " & loops)

WScript.Quit

End if

'Move files from working folder if it exists

strWorkingFolder = "C:SecurityCamWorkingFolder" + strFolderName

If objFSO.FolderExists(strWorkingFolder) Then

Set objFolder = objFSO.GetFolder(strWorkingFolder)

Set filecoll = objFolder.Files



If filecoll.Count > 0 Then

objFSO.CopyFile strWorkingFolder + "*.*", strArchiveFolder, True

objFSO.DeleteFile strWorkingFolder + "*.*", True

End if

Else

Set objFolder = objFSO.CreateFolder(strWorkingFolder)

End if

Call FTPDownload("yourftpsite.com", "ftpusername", "password", strWorkingFolder, strFTPFolder + strFolderName,"*.*")

Set filecoll = objFolder.Files

If filecoll.Count > 0 then

ReDim fileAttach(filecoll.Count - 1)

Set objShell = CreateObject ("Shell.Application")

Set objFolder = objShell.Namespace ("C:SecurityCamWorkingFolder" + strFolderName)

x = 0

For Each strFileName in objFolder.Items

fileAttach(x) = objFolder.GetDetailsOf(strFileName, FILE_NAME)

x = x + 1

Next





strMailBody = "Living Room Camera has had a motion detect event!"

strFileAttach = strWorkingFolder + "" + fileAttach(0)

Set myMail=CreateObject("CDO.Message")

myMail.Subject="Camera Event"

myMail.From="joeblogs@anywhere.com"

myMail.To="joesecurity@sillywalks.com"

myMail.TextBody= strMailBody

myMail.AddAttachment strFileAttach

If x > 1 then

strFileAttach = strWorkingFolder + "" + fileAttach(x - 1)

myMail.AddAttachment strFileAttach

End if

myMail.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

myMail.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtpserveraddress"

myMail.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25

myMail.Configuration.Fields.Update

myMail.Send

set myMail=nothing

End if

loops = loops + 1

WScript.sleep(60000)

loop

:: 31 Oct :: :: Comment / reply

Linksys WVC54G wireless camera, btinternet SMTP and gmail

Oct6
Recommended / related

Dug out my wireless camera, to see if it could be used as a web cam - it's good quality, with sound, but more for security monitoring than sitting in front of the screen and talking. Don't think it can, but it's good to have it up and running again after about a year... It seems a little slow to respond when setting it up, like changes take a few minutes to take effect so it seems like it's not working correctly occasionally, but I got there. Even my old dyndns account was still running so hopefully I'll be able to use the camera from work today, and maybe give the address out so you can monitor my home security for me.

Only really had problems with one bit of it, and that's the "send an email on motion detect", one of the main features of this camera (pointless still linking to it, I don't think you can buy it any more). You need an smtp server for your outgoing mails, your ISP certainly provides one. I hoped to use gmail, as I use it for all my mail and have never used the email address that came with BT Broadband, but smtp.gmail.com insists on some encryption and an alternative port number that the camera can't cope with, so no go. In the end, some messing about changing settings and trying things it seems that at some point since I last used this BT made changes to not let you set your "from" address in your emails without authenticating that you really own that address. Definitely reasonable and I guessed this so I was already trying to send the emails from what I thought was my real bt broadband address, and what had been my real email address when I registered, let's say it's foo@btinternet.com. I logged on to my btinternet.com address and worked out it had been changed to foo@ btopenworld.com. Oh and there was a mail waiting explaining what had gone on, I didn't need to google round the houses after all.

Urgent – emails you send from non–BT Yahoo! Mail addresses via our SMTP servers may be blocked

Dear Customer,
You've received an Error 553 message because we've upgraded your BT Yahoo! Mail security to help prevent identity fraud and spam.
These enhancements will help protect you from 'spoofing' – when people use alternate addresses to disguise an email's real sender, possibly to commit fraud.
Making the improvements work
For the security improvements to work, we need you to take a few minutes now to verify each of the alternate email addresses you use in BT Yahoo! Mail. This will confirm that these email addresses are genuine.
Please verify addresses now to avoid any further blocking of your outgoing emails.
Simply follow the step-by-step instructions at www.btyahoo.com/verify. You won't be asked for any personal information, but you'll need to log in to your account to make the changes.


UPDATE: I've got the theory of it anyway, but no emails sent as yet. If I suddenly get an email from the camera at work today, that will be a bad thing, as it means someone is moving about in the flat...

:: Comment / reply

Also there's an xml feed of btinternet, a JSON feed, and a KML feed of btinternet , search my btinternet venue info.

Hope you found what you're looking for, if not please leave a message about "btinternet".

Add btinternet as a venue here, help me out, and the next person.

Google the site here

Google
Web this site