Graph your Data

 

Up Parts List IR Distribution TV Sensor Stereo Sensor Watch Remote HAL Interface Talking Scale Dollar Bill Acceptor Open Air Microphones Smart Car Sensor Ocelot to HAL Random Speak Device Usage Graph your Data Tell Me

Have HAL keep track of the amount of use, on devices in your house with AutoGraph. 

 

I have developed a completely FREE small program called AutoGraph that, when combined with HAL, can display the amount of time a device is used.  For example, you may want to know when someone is using the telephone and the duration of each call.  Or you may want to know how often the hot water heater turns on and heats the water for each day throughout the week.  You can even chart the temperature in the house throughout the day. 

Take a look here at some of the devices AutoGraph charts for me on a daily basis.

 

Click to return

 

AutoGraph conveniently stores these images into the HAL HomeNet images folder and allows you to view them from your web browser in HAL HomeNet (under video monitoring).  You can optionally have AutoGraph transfer (FTP) the graph to your personal web site as I have done above.

HAL can run AutoGraph from a macro and chart a specific graph in seconds.  Hal passes the name of the chart (text file) to AutoGraph via the command line prompt.

 

Getting Started

In order to use AutoGraph you must first create an empty text file for each device you wish to monitor.  Be sure to create these text files in the path:

Program Files\HAL\Data\Custom

Be sure to name the text log something descriptive since the log file name is used in the title of the graph. 

Once you have created the empty text files, you will then need to set up rules in HAL that will populate the text files with the date, time and status of the device (as in the example above).  AutoGraph will then parse these test files and create a graph.

In most cases you will need to set up 2 rules for each device.  One rule will trigger when the device turns on and will write "ON" to the event log.  And the other rule will trigger when the device turns off and will write "OFF" to the event log. 

Note: In some cases you may not need to actually add any new rules, you may be able to add the actions to existing rules.

Here are some of my rules for logging events in HAL.

 

The clothes dryer rule expanded:

 

Here is how the action should look for the "OFF" command:

Be sure to press the browse button and select the text file you created for the specified event and you must select "options" under the action and check "Include Date and time stamp".  Do NOT select "include event information".

Don't forget to create a similar rule and action to populate the text file when the device turns ON.

 

Logging Temperature

If you have a thermostat hooked up to HAL you can log the temperature throughout the day.  If you wish to log the temperature, then set up an event in the schedule that repeats every 30 minutes.  Use the HAL TTS replacement code to place the temperature in the log file in place of the ON or OFF command.  Your single action should look like this:

 

Installing the AutoGraph application

Version 1.5 Download Here

Download the zip file (Right-click then Save Target as...) and extract it to a temporary folder on your HAL computer.  Run the file Setup.exe and follow the instruction to install AutoGraph to a folder of your choice.

Once the AutoGraph is installed, double click the AutoGraph.exe to start the application.  Normally, HAL will run this same EXE and pass the name of the chart to graph via the command line prompt.  When HAL runs AutoGraph from the command line prompt the user interface is not displayed.

Below is the user interface.  Be sure to navigate to the path where you will store the images and text files and press the respective SET button.  The text log files you created should be displayed in the list box.  Simply select a file and press the "Graph Log File Now" button. 

If you wish to select a day in the past select the "Date" button and select the day you wish to graph.

 

Archiving Graphs

You may want to have AutoGraph automatically archive the graph files into an "Archive" folder after a specific number of days.  Simply set the number of days you wish to keep in the text box and AutoGraph will keep this number of days worth of graphs in the root of the HomeNet images folder. 

This function will operate automatically when HAL runs the application from the command line prompt.  You do not have to manually archive the files. 

If you do not want to archive the graphs after a specific number of days simply leave the text box empty.

 

FTP Support

If you have a web site and wish to FTP the images to your site, then select the "FTP Graph" check box, then press the "FTP Settings" button to display the settings for your FTP server.

Simply enter your FTP settings into the appropriate text boxes and press save. 

As long as the check box is selected, AutoGraph will FTP the latest graph when HAL runs the application from the command line prompt or manually from the user interface.

Do not leave the FTP Graph" checkbox checked unless you have the proper settings set.  Anytime this box is selected AutoGraph will attempt to FTP the graph to the specified FTP location.

NOTE:  When the jpg file is transferred to the web site the file name is changed from:

Hot Water 07-31-2004.jpg  to  HotWater.jpg        (Example)

The date is dropped (so you can update the image daily) and any spaces are removed from the file name (necessary for some FTP servers).

 

Setting HAL to Graph Automatically

Now that you have HAL setup to log to your text files and you have AutoGraph installed.  You will want to setup a macro to have HAL automatically run the AutoGraph application on command.

The easiest way to do this is to create a single macro that will run AutoGraph for each device you wish to graph.  Take a look at my "Update Graphs" macro and the actions within:

Use the "Run Program" action to have HAL update each graph. 

IMPORTANT You need to specify the exact name of the text file (without the .txt extension) in the "Parameters" text box as seen below. 

When entering the name of the text file, do not use all CAPS since this is exactly how the title of the graph will look.

 

Create a schedule in HAL to run the "Update Graphs" macro each night at "11:57 AM".  If you have a lot of graphs or you are using the FTP option (as I am) you will need to put a delay in between each action. 

Note: AutoGraph will only graph the current day from the command line prompt.  If you wish to graph a previous days data, then run the application manually and select the date you wish to graph.

Any errors encountered when running autograph from the command line prompt are placed in a text file called "error.txt" located in the root of the AutoGraph.exe application.  Be sure to check this if you are having any problems.

Have fun and be sure to let me know what unique devices you are graphing with AutoGraph.