Lavernell Lights: How We Let YOU Control the Lights

 

 

 

So You Want to Know How We Let YOU Control the Lights?

A lot of planning and trial and error went into setting up our display so you can control the lights. After experimenting with other ideas, I ran across a Halloween display where the viewer could call in on the phone and control the lights. The secret behind all of this is a piece of software called IVM Answering Attendant. A free trial period is allowed, after which you will have to pay for the software (and it isn't cheap!).

After the call is answered, the caller is given a menu:

Welcome to Lavernell Lights!
To hear information about our display, press 1.
To leave a comment about our display, press 2.
To vote for your favorite song, press 3.
New for 2009, you can control the lights! To control the lights, press 4.


When a caller decides to request a song, they would press 4. The caller is then presented with a second menu:

Press 1 to see Trans-Siberian Orchestra's Christmas Eve Sarajevo.
Press 2 for Blue Christmas.
Press 3 for I Want a Hippopotamus for Christmas.
Press 4 for Santa Baby.
Press 5 for Danny Elfman's What's This.
Press 6 for Rockin' Around the Christmas Tree.
Press 7 for Happy Christmas (War is Over).
Press 8 for Mele Kalikimaka (a Hawaiian Christmas).
Press 9 for Manheim Steamroller's Deck the Halls.


This is where the magic begins! This second menu is set up a bit differently. Instead of redirecting to another menu, the buttons the caller presses are interpreted as a variable. Here is a few screenshots of the configuration for this menu.








































This is the configuration for the second menu above. When the caller makes his/her selection, it is stored in a variable named circuit. The menu is configured ot only accept numbers 0-9 and the max and min digits is 1 (we only want one digit). After the caller makes his/her selection, they are redirected to the next menu.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               







































This menu is where all the magic is actually done. This menu consists of a recording that says "Thank You for controlling our lights. Your selection will be coming up shortly." Down at the bottom of this screenshot, you can see I have set it to run another executable.





























This is where we define the executable to run. As you can see, we are calling a batch file with some information about the caller. There are 5 command line arguments. The first is our variable (circuit), followed by the date and time of the call, then the Caller ID number and Name.

So, now we have sent the execution to our batch file. Here is the contents of the batch file (requestit.bat):

echo %*>>"c:\lor shows\queue.txt"
echo %*>>"c:\lor shows\logs\2009queue.txt"


Very simple. It just appends the line of information to 2 files - 1 which is the queue that is processed, and a second that is just a running log of all requests for the season. Here is what a queue file looks like (queue.txt):

"1, 2008-01-01, 00:00:00, 0000, STARTUP"
"8, 2009-11-04, 10:07:47, 1xxxxxxxx28, Blow Joe"
"6, 2009-11-04, 10:09:43, 1xxxxxxxx28, Blow Joe"
"1, 2009-11-04, 10:17:28, 1xxxxxxxx23, Blow Mary"
"9, 2009-11-04, 11:23:42, 1xxxxxxxx62, Jones Joe"
"7, 2009-11-04, 11:24:15, 1xxxxxxxx62, Jones Joe"
"8, 2009-11-04, 17:07:32, 1xxxxxxxx62, Jones Joe"
"3, 2009-11-04, 17:08:06, 1xxxxxxxx62, Jones Joe"


That very first line is craeted by the end of the show the previous night. I found while setting this up that if the queue.txt file did not exist, it was not reliably created. At the end of the night, my shutdown cleanup sequence deletes the queue file so that the next night starts fresh with no backed up queue. It also creates a new queue file so that there are no issues with startup the next night. It initializes this queue file with the first line, calling for sequence #1.

So, now we have a queue file. How do we use it. Well that is accomplished with the Windows Command configuration in each sequence:

As you can see, our sequence calls another batch file, sendbeta.bat. The next items on the command line are special. The first argument is the sequence number (for logging purposes). Following the sequence number is the code needed to send the song title to the LED sign. The {Red}, {Green}, and {Amber} tell the sign what color to display the song title in. So now we need to look at the Windows Command Batch File (sendbeta.bat):

"c:\lor shows\betacom.exe" COM4 {Rotate}{Amber}Now Playing: %2 %3 %4 %5 %6 %7 %8 %9
set /p source=<"c:\lor shows\source.txt"
"C:\php\php.exe" "c:\lor shows\changeshow.php"
for /f "tokens=1,2,3 delims=/" %%a in ('@echo %date%') do (set month=%%a) & (set day=%%b) & (set year=%%c)
for /f "tokens=1,2 delims= " %%j in ('@echo %month%') do (set month=%%k)
echo %date%,%time%,%1,%2 %3 %4 %5 %6 %7 %8 %9,%source%>>"c:\lor shows\logs\2009showlog.txt"
echo %date%,%time%,%1,%2 %3 %4 %5 %6 %7 %8 %9,%source%>>"c:\lor shows\logs\%year%%month%%day%.log"


So this batch file is a little more complex. I'll go through line by line. Line 1 Sends the information to the LED sign. This is for a Classic BetaBrite. Line 2 reads a text file (source.txt) to determine whether the current song was played from the queue or the random show. This is used for logging. Line 3 is the one that reads the queue. This is really the heart of the operation. The next two lines parse the date into a usable format. The last two lines generate two log files (one for the season, one for the day).

So now we've sent the data to a PHP script. There is much more to the PHP script. Because the PHP script is almost 100 lines, I won't paste it here, but rather link to it. THere are comments in the file (there is a double slash (//) before any comments). Changeshow.php

Hopefully this is enough information for anyone else to use this as well. You might have to adjust paths for files in my scripts. I store my LOR files in c:\lor shows becasue it's convenient. Another thing to note is that I am swapping out the actual schedule file (weeksched.lsc) becasue I couldn't get it to work swapping the show file (the .lss file). I have created a show file for each sequence (which carries the name of the sequence nubmer, ie. 1.lss is my first sequence, 2.lss is the second). There is also a schedule file for each show file. I created these by scheduling ONE show in the scheduler and then copying it and replacing 1.lss with 2.lss and so on....

So you may ask what you need to make all of this work. Well, here's a list:

Light-o-Ramahttp://www.lightorama.com $ Depends on setup
ICH IVM Answering Attendanthttp://www.nch.com.au $115 - $400
(depends on number of menus necessary)
(3 minimum to JUST control Lights)
PHPhttp://www.php.netFREE
Phone hardware or an VOIP account
(must be compatible with IVM)
(I use CallCentric)~$4.00/month
(based on a Dirt Cheap DID)

 

About Us| Contact Us | © 2007-2010 Lavernell Lights (produced by Affordable Technical Services, LLC).