The Weather Station
Once you have VWS running, follow their instructions to get data from your weather station. If you would prefer not to pay for VW, look around and see if you can find a free program that interfaces with your station of choice (for the Wx200, try SB Weather). You’ll need to play with the output later on to get data into Powerhome, but it might be worth the savings.
Getting Data Out of Virtual Weather Station
Once you have these settings properly configured, Virtual Weather Station will export a .CSV file containing all your sensor data as often as you specify. The next step is getting that data into Powerhome.
Getting Data Into Powerhome
The first thing that this macro needs to do is to find and open up the .CSV file. To do this, create a new step in the Macro. For the boxes, add Set System | [LOCAL 1] | ph_readfile(“C:\The path to your .CSV file”). This loads the .CSV file into the system variable LOCAL 1.
Next, you need Powerhome to grab data from the .CSV file for each global variable. A .CSV file is simply a set of values seperated by commas (Thus Comma Seperated Values), so referencing those commas is the best way to tell Powerhome where to find what it needs. You do this using regular expresssions, which can get kind of complicated. Luckily, the regular expression that you need for this task isn’t too bad–you just need to know where your data is within the .CSV file. To figure this out, open the file in Notepad. You will set a bunch of numbers with no explanation.
To figure out what number does with which piece of data, go into VWS and find the chunk of weather data that you’re looking for, then locate the corresponding number in the .CSV file. For example, if you’re looking for temperature and the temperature is 80 degrees at the moment, find the number 80 in the .CSV file. For each piece of weather data, make a note of the location of the data piece within the .CSV file. Expanding on the temperature example, if the .CSV file looks like this: 45, 56.7, 23, 42, 80, temperature would be number 5. Find the location number for each piece of data that you’re going to grab–you’ll need those numbers later.
Next, go back to the macro. Add a step, and for the boxes enter Set Global | (One of your global variables) | ph_regexsnap(“.Next, copy the following expression: [0-9\.]*, and continously paste it until the number of copies of the expression corresponds with the location number for the global variable you’re trying to set. Finally, finish off the code with this: \([0-9\.]*\),”,”[LOCAL1]”,1,0). For the temperature example, your final macro step would look like this: Set Global | Temperature | ph_regexsnap(“[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,\([0-9\.]*\),”,”[LOCAL1]”,1,0)
Basically, all this is doing is telling Powerhome “grab the stuff that’s located between the fifth comma”. Once you have the basic format, simply set up another macro step for each glocal variable, changing the number of [0-9\.]*, to correspond to the chunk of data you want. When you run the macro, Powerhome should load data from Virtual Weather Station into the Global Variables.
Using the Data
Humidity data is useful too–in the winter, stick a humidifier into an appliance module and set up a macro that turns it on automatically when the indoor humidity gets too low (an ideal indoor humidity is around 40%–in the winter it can get down to 12 or 15). In the summer, do the same thing in reverse with a dehumidifier. Lastly, you can use your weather data to alert you to potential dangers. For example, you could set up a macro that flashes the lights when the wind speed gets too high. There are lots of possibilities.
Download a sample version of the weather station macro here.
ATTRIBUTION: The excellent method described above for using regular expressions to grab VWS data was developed by DHoward of the Powerhome Message Board