Sandaysoft

Support forum for Cumulus weather station software
It is currently Sun May 19, 2013 8:28 pm
Please click here before posting. Help me to help you!
Useful Links: Cumulus FAQ • Enhancement requests • Wiki (documentation)
Please put your approximate location into your profile
Add your web site to the Cumulus user map
Vantage Pro2 users with firmware 3.00 should upgrade to fw 3.12 and Cumulus 1.9.4

All times are UTC




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: v1.8.0
PostPosted: Tue Sep 30, 2008 10:50 pm 
Offline
User avatar

Joined: Wed Sep 17, 2008 1:34 pm
Posts: 629
Location: Mesa, AZ USA
Weather Station: Davis VP2 Plus w/24 FARS
Operating System: WinX Pro SP3 Dedicated wstn
Brad,

Not having access to UI-View.... give the following URL a try to see if it works for you.

http://cumulus.tnetweather.com/WXNOW.txt
or
http://cumulus.tnetweather.com/wxnow.txt

I would think that it would be easy for Steve to just generate a file like this. But in case that is not in the cards, it is easy to cause the generation of the same from the server side of a PHP based server. You could do the same with an ASP (IIS) server too, but I am not familiar with the coding on that...

This method works using some .htaccess trickery... It requires mod_rewrite to be available to on the host.

The script is actually called WXNOW.php and it parses out the data from the realtime.txt file and outputs the text as you see it.

Code:
Sep 30 2008 15:50
141/002g003t098P000h18b10109


To make the system respond to WXNOW.txt or wxnow.txt, I created a simple rewrite rule like:

Code:
RewriteRule ^/?wxnow.txt$ /WXNOW.php [L]
RewriteRule ^/?WXNOW.txt$ /WXNOW.php [L]


This tells the server that if it sees a request for either WXNOW.txt or wxnow.txt, to rewrite the request to point to the PHP script instead. The visitor doesn't really see this, they just get the output of the script as if they had gotten just a plain old txt file.

_________________
Kevin
Image
All you need is Time, Aptitude and Desire ... and you can build just about anything...
Cumulus User Maps


Top
 Profile  
 
 Post subject: Re: v1.8.0
PostPosted: Wed Oct 01, 2008 7:35 am 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17555
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
Yes, I can easily generate one of those. The crucial information I'm missing is: What do I do with the file once I've created it?

Steve

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: v1.8.0
PostPosted: Thu Oct 23, 2008 9:13 pm 
Offline

Joined: Sat Aug 23, 2008 9:26 pm
Posts: 50
Weather Station: Davis Vantage Pro 2 Wireless
Operating System: XP SP3
Apologies again for the delay in getting back to you. For some reason when I log back in this thread isn't marked as "updated", and then I eventually lose it. :-(

Steve: to answer your question, you only need to create it. In UI-View (or the other APRS programs that use it), I just specify the path to where it's been saved. If you want to include the option for me to specify *where* to put the generated file, all the better, but not critical.

TNETWeather: the sample you post is close except if I open it in Notepad, it's not seeing the line break after the time. It looks like you saved it with a Unix-style linebreak (LF only) instead of a DOS-style (CRLF).

I promise to log in more often and keep track of this. Apologies again for leaving you all hanging. :-(

Brad.


Top
 Profile  
 
 Post subject: Re: v1.8.0
PostPosted: Thu Oct 23, 2008 10:16 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17555
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
OK - I'll put the code in to generate one.

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: v1.8.0
PostPosted: Fri Oct 24, 2008 7:53 am 
Offline
User avatar

Joined: Wed Sep 17, 2008 1:34 pm
Posts: 629
Location: Mesa, AZ USA
Weather Station: Davis VP2 Plus w/24 FARS
Operating System: WinX Pro SP3 Dedicated wstn
bpsmicro wrote:
TNETWeather: the sample you post is close except if I open it in Notepad, it's not seeing the line break after the time. It looks like you saved it with a Unix-style linebreak (LF only) instead of a DOS-style (CRLF).


It is not really ever saved, it is dynamically generated each time you hit it with a browser. I suppose it depends on what browser you are using.

Using MSIE, if you look at the source, it contains CRLF's for each line.

Image

If you open it up with FireFox, it will only have LF's since that is how FF interprets it.

The script is actually outputting CRLF after each of the two lines.

When you look at via the browser itself, it won't appear to have any linefeeds since HTML browsers don't display line feeds only html linebreaks (<br/>) and the script is not outputting those.

_________________
Kevin
Image
All you need is Time, Aptitude and Desire ... and you can build just about anything...
Cumulus User Maps


Top
 Profile  
 
 Post subject: Re: v1.8.0
PostPosted: Sat Oct 25, 2008 4:12 pm 
Offline

Joined: Sat Aug 23, 2008 9:26 pm
Posts: 50
Weather Station: Davis Vantage Pro 2 Wireless
Operating System: XP SP3
Curiously, if I do a "Save As" and put the .txt file directly only my local machine (IE of FF) and open in Notepad, it only sees the LFs. But View Source does indeed work as expected. I've never seen that before.
But no matter, I suspect UI-View would work either way, and since I'm not grabbing the file via a browser normally, it's a non-issue. :-)

Now to eagerly watch for the next build. :-)

Brad.


Top
 Profile  
 
 Post subject: Re: v1.8.0
PostPosted: Sat Oct 25, 2008 4:58 pm 
Offline
User avatar

Joined: Wed Sep 17, 2008 1:34 pm
Posts: 629
Location: Mesa, AZ USA
Weather Station: Davis VP2 Plus w/24 FARS
Operating System: WinX Pro SP3 Dedicated wstn
If you want to use that script, you don't need to wait for the next build.

This assumes that you have PHP on your local web server.

Source:

Code:
<?php
############################################################################
# A Project of TNET Services, Inc.
############################################################################
#
#   Project:    Cumulus Project
#   Module:     WXNOW.php
#   Purpose:    WXNOW Auto generated Page
#   Authors:    Kevin W. Reed <kreed@tnet.com>
#               TNET Services, Inc.
#
#   Copyright (c) 1992-2008 Copyright TNET Services, Inc.
############################################################################
#   This document uses Tab 4 Settings
############################################################################
#
#   License:   
#
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License
#   as published by the Free Software Foundation; either version 2
#   of the License, or (at your option) any later version.
#   
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#   
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
#   USA.
#
############################################################################
#   HISTORY
############################################################################
#
#   0.1     Beta
#
############################################################################
# HTACCESS SETTINGS
############################################################################
# If you want the script to respond to a request from a url like
#
# http://YOUR_SERVER/WXNOW.txt
#
# You can add the following to the .htaccess file in your Apache Web
# Server to have it do that.
#
#   RewriteEngine On
#   RewriteRule ^/?wxnow.txt$ /WXNOW.php [L]
#   RewriteRule ^/?WXNOW.txt$ /WXNOW.php [L]
#
############################################################################
# FORMAT OF Variation 4 (Weather Link) HTM File
############################################################################
#
# Jun 01 2003 08:07
# 272/000g006t069r010p030P020h61b10150
# ***********************************************************
#
# 272 - wind direction - 272 degrees
# 010 - wind speed - 10 mph
#
# g015 - wind gust - 15 mph
# t069 - temperature - 69 degrees F
# r010 - rain in last hour in hundredths of an inch - 0.1 inches
# p030 - rain in last 24 hours in hundredths of an inch - 0.3 inches
# P020 - rain since midnight in hundredths of an inch - 0.2 inches
# h61 - humidity 61% (00 = 100%)
# b10153 - barometric pressure in tenths of a millibar - 1015.3 millibars
############################################################################
# Format of File
# Date          DD/MM/YY (we convert it to YYYY-MM-DD
# Time
# Temp          float
# Humidity      int
# Dewpt         float
# wind speed    int
# wind gust     int
# Bearing       compass
# rain rate     float
# rain today    float
# Pressure      float
# Windir        label
# Wind Speed    float
# Wind Unit     label
############################################################################

$months = array( "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
    "Oct", "Nov", "Dec" );

// Change to match path to realtime.txt file
// Should be the only thing you need to change if your realtime.txt
// is NOT located in the same location as this script

$input = file("./realtime.txt");

$vars = preg_split('/ /', $input[0]);

$day    = substr($vars[0],0,2);
$month  = $months[ substr($vars[0],3,2) -1 ];
$year   = "20" . substr($vars[0],6,2) ;
$hour   = substr($vars[1],0,2);
$min    = substr($vars[1],3,2);

echo $month . ' ' . $day . ' ' . $year . ' ' . $hour . ':' . $min . PHP_EOL;
echo sprintf("%03d/%03d", $vars[7], intval($vars[5]) );
echo sprintf("g%03d", $vars[6]);
echo sprintf("t%03d", intval($vars[2]) ) ;
echo sprintf("P%03d", intval($vars[9] * 10));
$hum = intval($vars[3]);
if ($hum == 100) {
    $hum == 00;
}
echo sprintf("h%02d",$hum);
echo sprintf("b%05d", intval($vars[10] * 10) );
echo PHP_EOL;

############################################################################
# END OF SCRIPT
############################################################################

_________________
Kevin
Image
All you need is Time, Aptitude and Desire ... and you can build just about anything...
Cumulus User Maps


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group