Author |
|
phcjpp Newbie
Joined: April 21 2010 Location: United Kingdom
Online Status: Offline Posts: 3
|
Posted: April 21 2010 at 09:10 | IP Logged
|
|
|
Hi,
Does PH integrate with any of the hardware weather stations ? E.g Vantage pro ?
Thanks
Chris
Edited by phcjpp - April 21 2010 at 09:11
|
Back to Top |
|
|
spou Newbie
Joined: July 28 2007 Location: Canada
Online Status: Offline Posts: 33
|
Posted: April 22 2010 at 20:01 | IP Logged
|
|
|
I have an Oregon Scientific WMR968. All alone, it can not do a lot, besides that is has a RS232 port.
From there, I found a free software that reads the data from the console, and along with not-so-great-display, create a CSV file, that I import into PowerHome each minute using a vbscript of mine.
From there, I can do a lot, like detect rain, and warn me that I should close the windows. I also create a nice text file that I have PH read out (using TTS) when we wake up (this one gave me very high WAF), and other related things.
Given the fact that new HA devices are getting on the market on high frequency, I dont thing that Dave really have the time for our weather stations. The best is definitely to take it from where PH stops, and give it a small hand.
|
Back to Top |
|
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: April 23 2010 at 12:52 | IP Logged
|
|
|
I have a Davis Vantage Pro and I am using the Envoy RF receiver to connect to the PC using Virtual Weather Station.
I use it a couple of ways. VWS generates CSVs and will process html tags. The tags make it pretty easy to pull specific parameters into a file but there parameters that are only in the CSV file so I use both methods. I just use ph_regexsnap in macros to pull the data into variables.
|
Back to Top |
|
|
phcjpp Newbie
Joined: April 21 2010 Location: United Kingdom
Online Status: Offline Posts: 3
|
Posted: April 23 2010 at 14:57 | IP Logged
|
|
|
Thanks guys - I think I will go with the Davis option.
Cheers
Chris
|
Back to Top |
|
|
syonker Senior Member
Joined: March 06 2009 Location: United States
Online Status: Offline Posts: 212
|
Posted: October 09 2010 at 14:50 | IP Logged
|
|
|
Spou - Can you point me to the free software that reads the console and produces a CSV (is it Virtual Weather Station)? Any details (scripts, macros, etc.) would be helpful...what's TTS...?
Regards,
-S
__________________ "I will consider myself having succeeded when my house becomes sentient and attempts to kill me."
><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.
·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
|
Back to Top |
|
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: October 09 2010 at 15:10 | IP Logged
|
|
|
Virtual Weather Station generates CSV files. I have some macros that read them if you want.
|
Back to Top |
|
|
syonker Senior Member
Joined: March 06 2009 Location: United States
Online Status: Offline Posts: 212
|
Posted: October 09 2010 at 15:23 | IP Logged
|
|
|
I would LOVE those macros! :)
__________________ "I will consider myself having succeeded when my house becomes sentient and attempts to kill me."
><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.
·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
|
Back to Top |
|
|
syonker Senior Member
Joined: March 06 2009 Location: United States
Online Status: Offline Posts: 212
|
Posted: October 09 2010 at 15:44 | IP Logged
|
|
|
Is it based on something like this, by any chance...?
sub ImportCSV()
'
Const ForReading = 1
dim DataArray
dim strROMId
dim strName
dim dblValue
dim dteLastReadingDate
dim dteLastReadingTime
dim strAvg
dim strMin24H
dim strMax24H
dim strDateFormat
dim strTimeFormat
dim retour
dim SourceFile
dim TextFile
dim intDay
dim intPosition
'
'set filename to read
FileToRead = ph.getglobal_s("TEMP_CSV_FILE")
'
'
'file format:
'"ROMId","Name","Value","dd.mm.yyyy","hh:nn:ss","Avg","MinH2 4","MaxH24",
'"46000000274F1910","atelier",19.56,14.08.2007,23:25:45,19.4 9,18.62,20.95,
'"DA00000015EEDF10","bureau",20.45,14.08.2007,23:25:47,20.31 ,18.18,22.56,
'"FE00080031602E10","chambre",21.19,14.08.2007,23:25:44,20.9 0,20.25,22.38,
'"2800000015FA6610","test",20.73,14.08.2007,23:25:43,20.26,1 8.29,22.17,
'"45000800311CD910","test2",21.31,14.08.2007,23:25:46,21.23, 20.50,22.81,
'------------------------------------------
'
'msgbox "1"
Set SourceFile = CreateObject("Scripting.FileSystemObject")
If not SourceFile.FileExists(FileToRead) Then
' msgbox "CSV File not found!"
exit sub
end if
Set TextFile = SourceFile.OpenTextFile(FileToRead, ForReading)
'
Do While Not TextFile.AtEndOfStream
redim DataArray(0)
TextLine = TextFile.ReadLine 'Read a dataline from SourceFile
'
if instr(textLine,"ROMId")<>0 then 'we will get the date and time format from the first line
DataArray=split(TextLine,",")
strDateFormat=ucase(dataArray(3))
strTimeFormat=ucase(DataArray(4))
end if
if instr(TextLine,"ROMId")= 0 then 'this line contains data
DataArray=split(TextLine,",")
'using the split command, we now have DataArray containg 4 cells (0..3)
'cells that we will transfer into separated variables (not absolutly needed, but might come handy
'for educational purpose)
strROMId = DataArray(0)
strROMId = replace(strROMId,"""","") 'remove doublequote
strName = DataArray(1)
strName = replace(strName,"""","") ' remove doublequote
dblValue = cdbl(DataArray(2))
dteLastReadingDate = DataArray(3)
dteLastReadingDate = replace(dteLastReadingDate,".","/")
dteLastReadingTime = DataArray(4)
strAvg=cstr(DataArray(5))
strMin24H=cstr(DataArray(6))
strMax24H=cstr(DataArray(7))
'
'transfer data from the script to powerhouse
'
'standard naming will be as follow:
'"temp_" followed by the strName value (ex: temp_office)
'that global variable will be of type double and containt the last temperature read
'
'there will be a temp_[strName]_time of type time
'and a temp_[strName]_date of type date
strGlobalId=ucase("TEMP_" & strName)
retour = ph.setglobal_a ( strGlobalId ,cdbl(dblValue ))
retour = ph.setglobal_s ("TEMP_CSV_LAST_DATE", dteLastReadingDate)
retour = ph.setglobal_s ("TEMP_CSV_LAST_TIME", dteLastReadingTime)
'we could also transfer min/max and average, but I have no use for it..yet!
end if
loop
TextFile.Close
end sub
Edited by syonker - October 09 2010 at 15:45
__________________ "I will consider myself having succeeded when my house becomes sentient and attempts to kill me."
><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.
·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
|
Back to Top |
|
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: October 09 2010 at 18:49 | IP Logged
|
|
|
I have been thinking about trying VBS and the plugin SDK for getting a variety of external data into Powerhome. A seperate execution thread would probably help things.
Virtual Weather Station generates several CSV files. There is a file, data.csv, that is generated once a minute. This simple macro that reads that file into some global variables.
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',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',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',4,10,'VWS_WINDDIR',NULL,'ph_regexsnap("[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',5,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_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',7,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 macrodetail values ('VWS_READ',8,10,'VWS_HOURLYRAIN',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\.]*\),","[LOCAL1]",1,0)',0,'');
insert into macrodetail values ('VWS_READ',9,10,'VWS_DAILYRAIN',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\.]*\),","[LOCAL1]",1,0)',0,'');
-Patrick
|
Back to Top |
|
|
syonker Senior Member
Joined: March 06 2009 Location: United States
Online Status: Offline Posts: 212
|
Posted: October 09 2010 at 20:52 | IP Logged
|
|
|
Patrick - That is WONDERFUL! I can use this to directly build a "needs-based" lawn-watering algorithm. How AWESOME! I cannot thank you enough!
-S
__________________ "I will consider myself having succeeded when my house becomes sentient and attempts to kill me."
><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.
·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
|
Back to Top |
|
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: October 10 2010 at 12:50 | IP Logged
|
|
|
I have been doing that for a long time. My macros are in this thread.
http://www.myx10.com/forum/forum_posts.asp?TID=2638&PN=1
|
Back to Top |
|
|
syonker Senior Member
Joined: March 06 2009 Location: United States
Online Status: Offline Posts: 212
|
Posted: October 10 2010 at 12:55 | IP Logged
|
|
|
Do you happen to know if there's a limit to the number of delimiters you can snap with ph_regexsnap? I'm trying to get the "Inside Temp" which I *think* is in the 29th position (modifying a line from the above macro). I can get the data point in the 28th position, but anything after that comes back blank...
-S
__________________ "I will consider myself having succeeded when my house becomes sentient and attempts to kill me."
><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.
·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
|
Back to Top |
|
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: October 10 2010 at 13:04 | IP Logged
|
|
|
I did find out recently that you cannot have more than 1024 characters in one formula.
I think you should be fine 29 * 9 = 261 characters
|
Back to Top |
|
|
syonker Senior Member
Joined: March 06 2009 Location: United States
Online Status: Offline Posts: 212
|
Posted: October 10 2010 at 13:09 | IP Logged
|
|
|
I added a minus (-) as an acceptable character (temps, wind chills, etc.). Here is my formula:
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\.\-]*,\([0-9\.\-]*\),","[LOCAL1]",1,0)
-And it returns nothing. If I remove one of the parse groups, I get the 28th variable in the CSV, but this and anything after return blank. Any ideas?
Regards,
-S
__________________ "I will consider myself having succeeded when my house becomes sentient and attempts to kill me."
><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.
·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
|
Back to Top |
|
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: October 10 2010 at 13:13 | IP Logged
|
|
|
I just looked at the VWS manual (06/19/09) and the inside temp is in the 13th position. Wind Chill is the 29th position. Indoor Heat Index in 30.
|
Back to Top |
|
|
syonker Senior Member
Joined: March 06 2009 Location: United States
Online Status: Offline Posts: 212
|
Posted: October 10 2010 at 13:17 | IP Logged
|
|
|
Aha! YOU ARE AGAIN A LIFE SAVER! What I need for this exercise is the Inside Temp.
I guess I would be curious if anyone has found whether snapping from far-right positions has been an issue, but beyond that, I think my problem is solved. Thank you SO SO SO MUCH!.....again!
Regards,
-S
__________________ "I will consider myself having succeeded when my house becomes sentient and attempts to kill me."
><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.
·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
|
Back to Top |
|
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: October 10 2010 at 13:18 | IP Logged
|
|
|
I will try to get some data past the 28th column right now.
|
Back to Top |
|
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: October 10 2010 at 13:37 | IP Logged
|
|
|
I just confirmed the formula does not work past 28 positions.
|
Back to Top |
|
|
syonker Senior Member
Joined: March 06 2009 Location: United States
Online Status: Offline Posts: 212
|
Posted: October 10 2010 at 13:40 | IP Logged
|
|
|
Well, that's certainly good to know for the future...seems like VBScript is the most viable option in that case.
__________________ "I will consider myself having succeeded when my house becomes sentient and attempts to kill me."
><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.
·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: October 10 2010 at 15:10 | IP Logged
|
|
|
Hmmm...I checked into the ph_regexsnap function and the 29 position problem and it appears that its a limitation of the regular expression search of the Scintilla control (what PowerHome uses to perform regular expression searches). I was thinking it may have something to do with the length of the regular expression search pattern but even with shortening it, it still does not seem to go beyond a certain point. At this point, I dont think this is fixable because of the external control doint the regular expression searching.
However, always more than 1 way to skin the cat . Looking at what was trying to be accomplished, I immediately thought of the ph_regexsnap1 function. My version looks like:
Code:
ph_regexsnap1(",\([^,]*\),","\1","[LOCAL1]",1,29,0,0,0) |
|
|
Much simpler if I say so myself. This code searches for the a comma, snaps the block of text that does not contain a comma, followed by a comma. The 29 in the formula says to snap the 29th occurrence of this particular pattern...no length problems of any sort using this logic. Alas, there is a bug in the ph_regexsnap1 function where the occurrence value seems to be skipping (Im working on fixing this now). So in theory, this would be great...it just doesnt work until I correct the bug.
But...we also have access to the ph_regexdiff1 function. My code using this function looks like this:
Code:
ph_regexdiff1(",",",","[LOCAL1]",1,29,0,0,0) |
|
|
Wow..even simpler. This also has the added benefit of actually working . This just uses two search strings and returns the data in between them and also returns the 29th occurrence.
But...hold on, were not through yet. PowerHome provides a function designed to work with comma (or tab, or etc.) separated values. The ph_parseline function. The equivlant code (and it also works) looks like:
Code:
ph_parseline("[LOCAL1]",",",29) |
|
|
Tailor made for just this type of data .
Hope this helps.
Dave.
|
Back to Top |
|
|
|
|