Author |
|
UpstateMike Senior Member
Joined: February 18 2006 Location: United States
Online Status: Offline Posts: 142
|
Posted: March 03 2006 at 13:52 | IP Logged
|
|
|
I was wondering if you are considering support for Virtual Weather Station so people can use data from their home weather stations in PowerHome? Seems like it would be a pretty easy thing to add: Virtual Weather Station just takes the data from the weather station and dumps it into a .csv file that gets updated about once per second. Should be simple to add a place to designate the path to the .csv file and then import the data into the PowerHome database. Does this sound feasible?
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 03 2006 at 13:56 | IP Logged
|
|
|
Mike,
It sounds very feasible. Do you have a link to Virtual Weather Station so I can poke around? I don't have any hardware to play with so if you could possibly post or email me a sample CSV, I can take a look at what might be involved.
Dave.
|
Back to Top |
|
|
UpstateMike Senior Member
Joined: February 18 2006 Location: United States
Online Status: Offline Posts: 142
|
Posted: March 03 2006 at 14:52 | IP Logged
|
|
|
Sent you a sample .csv and a copy of the manual. Let me know if you did not get them.
Also note that not all the data in the file is used by most people. You could easily limit it to about a dozen parameters or less. I would suggest:
Outside Temp
Outside Humidity
Wind Speed
Wind Gust
Wind Direction
Wind Chill
Dew Point
Barometric Pressure
Rainfall
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: March 07 2006 at 15:10 | IP Logged
|
|
|
TonyNo has programmed a script which logs on to wunderground.com and extracts several temperatures and humidity and so forth and stores these into GV's .... Perhaps something to look into? Been using his script for a few months now without any problems..
Peter
|
Back to Top |
|
|
UpstateMike Senior Member
Joined: February 18 2006 Location: United States
Online Status: Offline Posts: 142
|
Posted: March 07 2006 at 16:08 | IP Logged
|
|
|
I don't mind using the Internet for weather forecasts but for current conditions I prefer using my own weather station.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: March 07 2006 at 19:49 | IP Logged
|
|
|
Take a look at wunderground.com. They pull data from local personal weather stations, and I have one person within a mile or so of me.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 07 2006 at 20:36 | IP Logged
|
|
|
Mike,
Havent forgotten you...I did receive the files you sent me.
I didnt get a chance to look at it in depth, but did get the gist of what was being done. Since I don't have any kind of "built-in" support yet, I'd like to get you going with something that PowerHome can do right now.
I understand it's just a CSV file that's updated approx once a second. You said you would like the data imported into the PowerHome database...that should be no problem, but not sure where it should be. Do you just want the current data available in global variables or virtual X-10 devices?
Let me know how I can take care of this for you initially and I'll work on the VWS support as a plugin when I get the plugin interface up and going.
Thanks,
Dave.
|
Back to Top |
|
|
UpstateMike Senior Member
Joined: February 18 2006 Location: United States
Online Status: Offline Posts: 142
|
Posted: March 07 2006 at 23:51 | IP Logged
|
|
|
Not really sure but I assume Global variables. The way I want to use them would eventually include:
Have a TTS warning triggered from a wind gust of 18mph or higher.
Pass the values in an ASCII message to my stargate so they can be displayed on keypads and TV screens. The sending of the ASCII message would be triggered by any change in the variable value.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 08 2006 at 03:48 | IP Logged
|
|
|
Mike,
Thats easy enough. Once the data is in as globals, you can then create triggers on a global change and compare the amount of change or new value to determine the appropriate action.
I'll work on this later today and get some exported code for you to try.
Dave.
|
Back to Top |
|
|
UpstateMike Senior Member
Joined: February 18 2006 Location: United States
Online Status: Offline Posts: 142
|
Posted: March 08 2006 at 15:00 | IP Logged
|
|
|
Dave-
No need to rush on this as I still have a lot of things to put in place before I am ready to test it (serial link between PowerHome Machine and Stargate Machine, etc.)
I also have not been able to get the TTS function to work.
ph_tts("This is a test")
I tried changing my default voice, default speech engine, etc. but no sound.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 08 2006 at 15:51 | IP Logged
|
|
|
Dohh!! I just got the first part done for you. Right now, all the code below does is read the data.csv file created by VWS and imports the parameters you're interested in into global variables. I havent worked on the PH to Stargate yet so you can play with this if you want.
Code:
insert into global_variables values ('VWS_PATH','w:\data.csv');
insert into global_variables values ('VWS_OUTHUMID','74');
insert into global_variables values ('VWS_OUTTEMP','12.0');
insert into global_variables values ('VWS_WINDCHILL','3.0');
insert into global_variables values ('VWS_WINDGUST','14');
insert into global_variables values ('VWS_WINDSPEED','5');
insert into macroheader values ('VWS_READ','VWS READ',0,0,1);
insert into macrodetail values ('VWS_READ',1,15,'[LOCAL1]',NULL,'ph_readfile("{VWS_PATH}")',0,'');
insert into macrodetail values ('VWS_READ',3,10,'VWS_WINDGUST',NULL,'ph_regexsnap("[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,\([0-9\.]*\),","[LOCAL1]",1,0)',0,'');
insert into macrodetail values ('VWS_READ',5,10,'VWS_OUTTEMP',NULL,'ph_regexsnap("[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,\([0-9\.]*\),","[LOCAL1]",1,0)',0,'');
insert into macrodetail values ('VWS_READ',2,10,'VWS_WINDSPEED',NULL,'ph_regexsnap("[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,\([0-9\.]*\),","[LOCAL1]",1,0)',0,'');
insert into macrodetail values ('VWS_READ',4,10,'VWS_OUTHUMID',NULL,'ph_regexsnap("[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,\([0-9\.]*\),","[LOCAL1]",1,0)',0,'');
insert into macrodetail values ('VWS_READ',6,10,'VWS_WINDCHILL',NULL,'ph_regexsnap("[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,\([0-9\.]*\),","[LOCAL1]",1,0)',0,'');
insert into timedevents values ('2006-03-08 15:00:00.000',1,0,'VWS_READ',0,'2006-03-08 15:00:00.000',0,0);
|
|
|
Just copy and paste the code above into a Multi-Editor window. Press shift-F5 to be in SQL mode and then execute it.
What it does is create 6 global variables all starting with VWS_. You'll need to set the VWS_PATH global to the location of your data.csv file. It defaults to what you had in the batch file "w:\data.csv". The code also creates a macro named "VWS_READ". This macro will read the data in the CSV file pointed to by VWS_PATH and places it into the 5 VWS_ globals. The last thing it does is create a Timed Event to run the macro once every minute. You would need to set the Timed Event start time to the time value that you like.
Concerning TTS...did you download and install the MSSPCHAPI.EXE and MSTTSL.EXE files? If you download and install these files, then use "Direct SS". If you've already got SAPI5 from some other install, then use the SAPI5 setting (be sure and reinitialize after any changes).
If you're working with SAPI5 and have done the above and it still doesnt work, try downloading and installing this file http://www.power-home.com/download/sapi5setup.exe. If this still doesnt take care of it, let me know as there are some more things we can try.
Dave.
|
Back to Top |
|
|
UpstateMike Senior Member
Joined: February 18 2006 Location: United States
Online Status: Offline Posts: 142
|
Posted: March 08 2006 at 16:37 | IP Logged
|
|
|
Cool. Got the macro working but not the timed event to trigger it. I set the start time to 1 minute past the current time but nothing happens when the minute clicks over.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 08 2006 at 16:52 | IP Logged
|
|
|
Heh,
Do you have timed events turned on? Alt-F5 will toggle them on and off (the menu option is under the "Control" menu). You can also tell by looking at the toolbar icon that looks like a watch.
If you don't have timed events set to turn on automatically with PowerHome, this is a setting in the Explorer under Setup->Preferences.
Dave.
|
Back to Top |
|
|
UpstateMike Senior Member
Joined: February 18 2006 Location: United States
Online Status: Offline Posts: 142
|
Posted: March 08 2006 at 19:19 | IP Logged
|
|
|
They were set to turn on automatically but I must have turned them off somehow. It's humming along now!
I also got TTS working. Now I need to go back to test inserting a variable into the sentence similiar to:
ph_tts("The outside temperature is {VWS_OUTTEMP} degrees")
Edited by UpstateMike
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 08 2006 at 19:54 | IP Logged
|
|
|
Mike,
Thats great! I figured it would just be something simple .
Im glad the TTS is worked out as well. Sometimes people have problems as a result conflicts with other drivers such as L&H so Im glad that wasnt the case.
To insert a variable is real easy. You can just use variable substitution. If you're using a global variable, just surround it with braces. Local or Temp variables (system variables), surround with brackets. So if you were to speak the temperature of one of your new globals, it would be: ph_tts("The outside temperature is {VWS_OUTTEMP} degrees.")
HTH,
Dave.
Edited by dhoward
|
Back to Top |
|
|
UpstateMike Senior Member
Joined: February 18 2006 Location: United States
Online Status: Offline Posts: 142
|
Posted: March 08 2006 at 20:03 | IP Logged
|
|
|
Got it! I was updating my post even as you were posting. Only difference is I had to use "dee grees" so the Anjali voice would pronounce it correctly.
I have to go install more Insteon stuff now but I will definitly have some fun with this over the next couple of days!
Then on to the ascii stuff.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 08 2006 at 20:37 | IP Logged
|
|
|
Great!
Yep, Ive had to play games like that with the TTS as well to get the pronunciation I like.
Glad it's working for you and let me know if you encounter any problems or need any help.
Dave.
|
Back to Top |
|
|
frodier Newbie
Joined: December 20 2007 Location: Canada
Online Status: Offline Posts: 16
|
Posted: March 08 2008 at 14:08 | IP Logged
|
|
|
Dave or Mike,
I know it's been awhile since this thread was active but I was trying to implement the macro as described above and ran into a problem. I am using C instead of F degrees and as a result negative values are common, especially this time of year. I noticed that the parsing formulas in the ph_regexsnap stop working as soon as they encounter a minus sign in the text string (-). Is there any way to modify the values in ph_regexsnap so that a -10.5 for example would parse properly?
Regards
Frank
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 09 2008 at 23:00 | IP Logged
|
|
|
Frank,
Should be easy enough to do. It's been quite awhile since I wrote the above macro (and not having VWS) it appears that Im snapping comma separated values out of a file that is created by VWS. The basis of this is the ph_regexsnap function such as this one below that retrieves the WINDGUST:
Code:
ph_regexsnap("[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,[0-9\.]*,\([0-9\.]*\),","[LOCAL1]",1,0) |
|
|
It's slightly confusing, but if you take it one step at a time, you'll see how it works. You see this regex expression
repeated several times. What this basically says is to match any numeric character, 0 thru 9, or the decimal point (0 thru 9 and the decimal point can occur multiple times), followed by a comma. So this simple expression will match:
9,
.56,
45.23,
.,
..,
23.23..5,
As you can see, some of the examples above arent really valid data, but it would still match if it existed. For your case, you need to also add a negative sign to the match. This could be done a couple of different ways, but probably the easiest would be to modify the regex expression above into:
this will now match all of the values above plug the following:
-,
-5.3,
-34.12,
5-3,
5.--2.-3,
Again, you can see that some of these values arent valid, but as long as the file is structured properly, we don't have to check for exactness.
If we continue on, we can see our basic regex expression above being repeated for a total of 8 times. These 8 occurences are then followed by a 9th, slightly different regex expression which actually corresponds to the WINDGUST value:
The code above has \( and \) which represents that the ninth, numeric value (comma separated) is the actual data that we're interested in. If this value can be negative, then you would want to modify the regex expression as follows:
So, since the entire function is built by these regex expressions either skipping or snapping out comma separated values, you would just need to add the \- character combination within the [] set anywhere a negative value could possibly occur. You could just add it to *every* combination even if it's impossible for a negative to occur since the values within brackets are a set of *possible* characters to encounter. Of course, if a negative occurs and the \- isnt in the character set, then the ph_regex will fail because it does not match.
Let me know if this helps or not.
Dave.
|
Back to Top |
|
|
frodier Newbie
Joined: December 20 2007 Location: Canada
Online Status: Offline Posts: 16
|
Posted: March 10 2008 at 13:33 | IP Logged
|
|
|
Dave,
Your explanation was really clear. I went ahead and added \- in all the cases concerned and now it works like a charm. Now that I understand how the formula works I also added some new global variables that I wanted to extract from the csv file.
Thanks alot for the help.
Frank
|
Back to Top |
|
|
|
|