Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Realtime and mysql download available.

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

mproper23
Posts: 14
Joined: Fri 31 Aug 2012 6:52 am
Weather Station: WH1080
Operating System: 7
Location: Germany

Re: Realtime and mysql download available.

Post by mproper23 »

hi.

i use the actual version of cumulus.


here's a link to my realtime.txt
http://www.volksfrontderhorde.de/wetter/realtime.txt

Thank you for your time!
richardmhowell
Posts: 16
Joined: Thu 30 Aug 2012 12:35 pm
Weather Station: WH1090
Operating System: Windows XP SP3
Location: United Kingdom

Re: Realtime and mysql download available.

Post by richardmhowell »

mproper23 wrote:hi.

i use the actual version of cumulus.


here's a link to my realtime.txt
http://www.volksfrontderhorde.de/wetter/realtime.txt

Thank you for your time!
the problem you have is becuase your date is formatted like this 3.12.2012 the script is written to replace the date formatted like this 3/12/2012 see below;

Code: Select all

// This line should convert any date in the form dd/mm/yy to yy/mm/dd
   $linemysql = preg_replace('/(\d{2})\/(\d{2})\/(\d{2})/' , "\\3/\\2/\\1" , $linemysql)
I am not 100% sure how to change this without making the sky fall in, it might be easier to change your cumulus settings.

Not much use i know i will see if i can get it working for you

Rich
User avatar
mcrossley
Posts: 12685
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Realtime and mysql download available.

Post by mcrossley »

richardmhowell wrote: the problem you have is becuase your date is formatted like this 3.12.2012 the script is written to replace the date formatted like this 3/12/2012 see below;

Code: Select all

// This line should convert any date in the form dd/mm/yy to yy/mm/dd
   $linemysql = preg_replace('/(\d{2})\/(\d{2})\/(\d{2})/' , "\\3/\\2/\\1" , $linemysql)
I am not 100% sure how to change this without making the sky fall in, it might be easier to change your cumulus settings.
I think it would be...

Code: Select all

// This line should convert any date in the form dd/mm/yy to yy/mm/dd
   $linemysql = preg_replace('/(\d{2})\.(\d{2})\.(\d{2})/' , "\\3/\\2/\\1" , $linemysql)
But what do know about PHP! I'm assuming 'dot' is a special char that needs escaping.
User avatar
steve
Cumulus Author
Posts: 26702
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Realtime and mysql download available.

Post by steve »

mcrossley wrote:I think it would be...
I thought the same, and posted it but then deleted it as I wasn't sure :oops:
Steve
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Realtime and mysql download available.

Post by gemini06720 »

The code seems to produce the same results with and without the '\' escaping character.

'mproper23' 'realtime.txt' file contains the date in the following format:

Code: Select all

06.09.12
with the escape character:

Code: Select all

$linemysql = preg_replace('/(\d{2})\.(\d{2})\.(\d{2})/' , "\\3/\\2/\\1" , $linemysql);
without the escape character:

Code: Select all

$linemysql = preg_replace('/(\d{2}).(\d{2}).(\d{2})/' , "\\3/\\2/\\1" , $linemysql);
produce:

Code: Select all

12/09/06
User avatar
steve
Cumulus Author
Posts: 26702
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Realtime and mysql download available.

Post by steve »

Could it be that in the 'unescaped' case, the dot represents 'any character' and hence that form would be a good general case replacement for the original (as some people might have other date separators, e.g. "-")?
Steve
User avatar
mcrossley
Posts: 12685
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Realtime and mysql download available.

Post by mcrossley »

It does and it would Steve.
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Realtime and mysql download available.

Post by gemini06720 »

I concur with Mark - I tried different separators and different combinations of separators and I always end up with the date in the 'yy/mm/dd' format.
Boym
Posts: 1
Joined: Fri 06 Nov 2009 5:39 pm
Weather Station: W-8681

Re: Realtime and mysql download available.

Post by Boym »

I made a little change in script.
Now he take a date in european format; 11.10.12 and I added new column in table.
Now script works.
You do not have the required permissions to view the files attached to this post.
SpeedyGJ
Posts: 13
Joined: Thu 19 Mar 2009 8:26 am
Weather Station: Davis Vantage Pro 2
Location: Holwerd / Netherlands
Contact:

Re: Realtime and mysql download available.

Post by SpeedyGJ »

Hellow!

Setup OK
Real.php: File not found. Make sure you specified the correct path.
Database.php: Empty!

The pad to the realtime.txt is: /httpdocs/weer/realtime.txt but thats not OK!
Even as: http://www.weerstationdokkum.nl/weer/realtime.txt
I have everything try to make this working but nothing work!
What do i wrong?

Even the database.php is empty! Its this correct?
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Realtime and mysql download available.

Post by gemini06720 »

Are you using the scripts found in the 'realtime.zip' (attached to a message released on October 11, 2012?

If so, you need to make modification to (at least) the 'real.php' script.

Unfortunately, the script designer improperly 'assumed' that everyone was using the same date format as was used on his/her computer (poor programming)!

The date format produced by your Cumulus is in this format '16-11-12' - the script is expecting the date format to be in this format '16.11.12' - thus the script is producing an error message that, on most servers, will not be displayed.

To be able to process the 'realtime.txt' produced by your Cumulus, you need to change line 37 of 'real.php' from:

Code: Select all

$tmp_date = explode( ".", $linearray[0] );
to

Code: Select all

$tmp_date = explode( "-", $linearray[0] );
(the period has to be replaced with a dash)

I have just done some tests with the 3 scripts...
  • - the 'sqlsetup.php' scripts did not create the database - it only created the 'realtime' table - you have to manually create the database using something such as phpMyAdmin on an Apache server;
    - the relative path to the 'realtime.txt' data files has to be well specified in the 'real.php' script - otherwise the error message "File not found. Make sure you specified the correct path." will be displayed;
    - the 'database.php' script, as specified, reads the last 288 entries of the database (according to the description in the script, the last 24 hours - that would mean one entry every 12 minutes) and produces 43 arrays, each array containing 288 values;
    - the 'database.php' script has not been designed to display anything - the arrays produced by the 'database.php' script have to be used within a web page template.

I do hope the information provided will help you resolve your situation... If not, just post again explaining as clearly as possible the actions you have taken and the results you are (or are not) obtaining.
inaciovieira
Posts: 54
Joined: Sun 01 May 2011 7:13 pm
Weather Station: Watson
Operating System: Windows 7
Location: Funchal

Re: Realtime and mysql download available.

Post by inaciovieira »

Can some one help me how to put the values in to a graphic. I have been around this and can´t do it.
User avatar
mcrossley
Posts: 12685
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Realtime and mysql download available.

Post by mcrossley »

Ray, would it not be better to replace the explode() with a preg_split(), then t will work with any delimiters?

Code: Select all

$tmp_date = preg_split("/[^0-9]/", $linearray[0] );
Another observation about these scripts, would it not be better to keep the SQL table column names the same as the corresponding webtag names? This is what David did with the ImportCumulusFiles scripts in the Wiki (and I have extended), and I have also done with my realtime.txt log parser. Keeping consistency is usually a good thing.

In fact it may be useful to add this functionality to the already exisiting ImportCumulusFiles scripts? The script already handles the monthly and dayfile logs in a very similar manner.

To be honest I'd forgotten about this script when I wrote my realtimeLogParser :roll:
kc2kzz
Posts: 29
Joined: Tue 31 Jul 2012 2:08 pm
Weather Station: Davis Vantage Vue
Operating System: Raspbian on Pi B+
Location: United States
Contact:

Re: Realtime and mysql download available.

Post by kc2kzz »

I just set this up and getting strange results.

The log shows that data is being inserted into the table:

121204 9:32:59 72 Connect cumulus@localhost on
72 Init DB weather
72 Query insert into realtime values('','12/12/04','09:32:44','50.4','96','49.3','0.0','0.0','46','0.00','0.15','30.270','NE','0','mph','F','in','in','1.6','+0.002','0.21','15.75','0.01','64.2','47','50.4','+0.8','50.4','09:32','42.7','00:12','2.0','08:55','5.0','08:13','30.280','00:10','30.256','05:33','1.9.3','1054','1.0','50.4','52.3','0','0.000','0','114','0.00','1','1','0','ESE','250','ft','50.3','0.0','238','0','')
72 Query insert into realtime values('','')
72 Quit

but I don't see any data in the database:
MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0009 sec )
SELECT *
FROM `realtime`
LIMIT 0 , 30
Image
kc2kzz
Posts: 29
Joined: Tue 31 Jul 2012 2:08 pm
Weather Station: Davis Vantage Vue
Operating System: Raspbian on Pi B+
Location: United States
Contact:

Re: Realtime and mysql download available.

Post by kc2kzz »

Debugging shows this:

$ php real.php
PHP Deprecated: Function split() is deprecated in /home/www/tmp/real.php on line 37

Deprecated: Function split() is deprecated in /home/www/tmp/real.php on line 37
PHP Notice: Undefined offset: 2 in /home/www/tmp/real.php on line 53

Notice: Undefined offset: 2 in /home/www/tmp/real.php on line 53
Image
Post Reply