• Monitoring the status of your garage door, did the kids leave it open?

    tuxgrpahics ethernet garage door opener in Panasonic battery case

    Awhile back I reviewed the tuxgraphics smartphone garage door opener, which you can purchase here. After using it for awhile I decided it was the perfect candidate for a simple bat file. This short article will show you how to monitor whether your garage door is open or closed with just the use of a bat file. You might have interest in doing this if your family often forgets to close the door and you're worried about theft from your garage.


    For this you'll need to download a couple of apps:

    The first is blat, which allows you to send email from a command line.

    The second is the Windows port of curl, which pulls down webpages and allows you to analyze and manipulate the content.

    You will also need a txt file with your alert text, which I named notification.txt and populated with a simple, "Garage door is open! Should it be? I'll only warn you hourly."

    Background

    The tuxgraphics smartphoen garage door opener's webpage returns |=| if the door is closed, and |.| if the door is open. You see where we are going here. We simply use curl to pull down the web page, analyze it with our bat file, and alert accordingly with blat.

    Code:
    set blat=C:\admintools\blat262\full\blat.exe
    set adminemail=you@youremail.com
    set emaildomain=@youremaildomain.com
    set SMTP=smtp.yourserver.net
    
    pushd c:\admintools\garagedoor\
    
    
    curl http://yourgaragedoor:80 -o curlresults.txt
    
    
    type curlresults.txt |FIND "|=|"
    
    
    echo %errorlevel%
    
    
    if %errorlevel%==0 del DoorOpen.txt
    
    type curlresults.txt |FIND "|.|"
    
    
    if %errorlevel%==0 echo Garage Door is Open! > DoorOpen.txt
    
    if exist DoorOpen.txt %blat% notification.txt -serverSMTP %SMTP% -f garagedoor@yourdomain.com -to %adminemail% -s "Garage door is open!"
    
    :END
    That's all it takes, an error level of 0 means the text you are looking for is found. I schedule this as a scheduled task and have it run once an hour. My wife has quit commenting about my seemingly senseless monitoring scripts.