Page 1 of 1
UV and SolarRad tags
Posted: Thu 11 Mar 2010 1:15 pm
by GraemeT
Steve,
I've been wondering, is there any way to populate the <#UV> and <#SolarRad> webtags from an external source, such as a textfile as you did with the <#currcond> webtag?
This would be a great asset for those whose stations don't monitor UV or Solar radiation, but who have data available from another source.
Cheers,
Re: UV and SolarRad tags
Posted: Thu 11 Mar 2010 2:00 pm
by steve
If it was just a case of reading the contents of a file, then that's reasonably straightforward, I'd just clone the currcond code. We'd have to agree on exactly how it would work...
Re: UV and SolarRad tags
Posted: Thu 11 Mar 2010 10:45 pm
by GraemeT
It's entirely up to you Steve.
I'm thinking along the lines of currcond in that data is placed in a text file by some method (either by hand or some other process) and that textfile then read by cumulus to update cumulus.xml. I don't know if it would be easier for both values to be in the same file, but that would keep the number of files down - maybe even add it to currentconditions.txt.
These webtags are left empty unless one has a weather station to provide the data for them, and I'm thinking this could be a way of providing that data to cumulus.
I'll just say that if the option is there, people will work out a way of using it, however it's implemented.
Re: UV and SolarRad tags
Posted: Fri 12 Mar 2010 7:31 am
by steve
I'm thinking something general, so it can be expanded in future. A single file, called externaldata.txt, containing, to begin with, something like:
UV=10
SolarRad=25
This should be easy to set up, either automatically or manually. Cumulus would read the file each time an internet upload is scheduled. The easiest approach would be for Cumulus to simply update the UV and solarrad fields on the display, as it the value had come from the station. The web tag processing will then automatically pick it up. It probably needs a few options creating to indicate whether or not to process the file, to avoid unnecessary work where it's not being used.
Re: UV and SolarRad tags
Posted: Fri 12 Mar 2010 1:57 pm
by GraemeT
Sounds like just the ticket, Steve.
Re: UV and SolarRad tags
Posted: Tue 16 Mar 2010 8:11 am
by steve
While I've been thinking about the best way to do this to make it a general facility, it's occurred to me that there's an existing facility that you might be able to use. If a web tag has a colon in it, it's assumed to be a full hierarchic file name. The contents of the file are substituted for the tag. So if you arranged to have a file created with just the UV value in it (for example), you could specify a web tag such as <#C:\full\path\to\UV.txt> and the value would get inserted.
Re: UV and SolarRad tags
Posted: Wed 17 Mar 2010 9:42 pm
by mcrossley

I didn't know that Steve, now to think of a use for it...

Re: UV and SolarRad tags
Posted: Fri 19 Mar 2010 5:27 am
by GraemeT
Thanks Steve,
I'll give it a try.
Re: UV and SolarRad tags
Posted: Fri 19 Mar 2010 12:02 pm
by beteljuice
... you could specify a web tag such as <#C:\full\path\to\UV.txt> and the value would get inserted...
Now you tell us !
Re: UV and SolarRad tags
Posted: Fri 19 Mar 2010 12:09 pm
by steve
beteljuice wrote:Now you tell us !
It's been there for quite some time, but I'd completely forgotten. I was only reminded when I was looking at the code!
Re: UV and SolarRad tags
Posted: Fri 19 Mar 2010 11:02 pm
by GraemeT
Doesn't seem to work for me, Steve.
No matter what I put in the file, nor where I put it, when Cumulus processes cumuluswebtags.php
this....
Code: Select all
$UV = "<#D:\Web\htdocs\weather\data\UV.txt>"; // current uv index
is replaced with this....
Might I going about this the wrong way or something?
Re: UV and SolarRad tags
Posted: Fri 19 Mar 2010 11:32 pm
by steve
Looks OK to me. The UV.txt file definitely exists in that location? It's clearly finding and processing the tag, but for some reason not getting any content. Could you let me have a copy of the file with the tag in, and the uv.txt file?
Re: UV and SolarRad tags
Posted: Sat 20 Mar 2010 12:08 am
by gemini06720
Steve, I also get nothing when trying to import data from an external file, I tried giving the full path (such as 'C:\pathto\thefile\externaltags.txt') or the short path (such as 'externaltags.txt') or even the UNC type path (such as '\\NETWORKDRIVE\C_XAMPP_WEB\pathto\thefile\externaltags.txt') and even the Internet path type (such as 'file://NETWORKDRIVE\C_XAMPP_WEB\pathto\thefile\externaltags.txt') - nothing!
The file I am trying to include is a plain text file and contains two lines with the following tags:
I know the 2 tags have no meaning for/to Cumulus, but should still be imported as the data contained in those new tags could have been created by an external software.
Re: UV and SolarRad tags
Posted: Sat 20 Mar 2010 10:02 am
by steve
The UNC format definitely won't work, as it relies on the presence of a colon. This was presumably working at some point in the past, as someone must have asked for it. I'll investigate.
Re: UV and SolarRad tags
Posted: Sat 20 Mar 2010 10:39 am
by steve
It appears that the Delphi tag parser truncates tags at the first non-alphanumeric character, so this facility can never have worked, and never will. Very odd.