Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

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

Legacy Cumulus 1 release 1.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

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

Default Cumulus web page working in PHP using realtime.txt

Discussion and questions about Cumulus weather station software version 1. This section is the main place to get help with Cumulus 1 software developed by Steve Loft that ceased development in November 2014.
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: Default Cumulus web page working in PHP using realtime.t

Post by daj »

Synewave wrote:...David, I am wondering the reason why you coded this line?
It was a basic attempt at catching the error.

What I am saying is if the file name for realtime.txt is returned in the data it reads from the server then assume an error, if not (i.e. -1) then we have some good data.

For me, when it failed to read realtime.txt my server returned an error saying it "could not find the file realtime.txt" so I was checking to see if that is what it returned.

Does that make sense? :?
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
Synewave
Posts: 642
Joined: Mon 25 Jan 2010 1:55 pm
Weather Station: Watson W-8681
Operating System: Raspian
Location: Brighton, UK
Contact:

Re: Default Cumulus web page working in PHP using realtime.t

Post by Synewave »

daj wrote:
Synewave wrote:...David, I am wondering the reason why you coded this line?
It was a basic attempt at catching the error.

What I am saying is if the file name for realtime.txt is returned in the data it reads from the server then assume an error, if not (i.e. -1) then we have some good data.

For me, when it failed to read realtime.txt my server returned an error saying it "could not find the file realtime.txt" so I was checking to see if that is what it returned.

Does that make sense? :?
Yes thanks, it all makes sense, but that line of code doesn't seem to rectify the problem for me. I'll give it a few days and let you know how it goes without that line.
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: Default Cumulus web page working in PHP using realtime.t

Post by daj »

I guess it depends what your own server returns as the error, which I think is caused when Cumulus is uploading the file AND the Ajax call is trying to read it
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Default Cumulus web page working in PHP using realtime.t

Post by mcrossley »

After you do your .split() on the returned text, check the array length? Too short or too long, then retry the fetch?
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Default Cumulus web page working in PHP using realtime.t

Post by beteljuice »

That's the beteljuice way - although the length of the array keeps growing (and will different between 190 stable and 191 beta)

Code: Select all

    var currdat = x.responseText.replace(/\r\n/g, "");	// this gets rid of any line ending
   	var currdat = currdat.split(' ');	// populate the array

	// now make sure we got a realtime.txt with minimum content 
	// If we have a valid currdat file AND updates is < maxupdates
	if(currdat[47] && ( updates <= maxupdates || maxupdates > 0  ) ) {
Simply bombs out to my 'normal' 10s cycle which I deemed acceptable, especially as using ftp rename seemed to fix any conflict problems I may have had, which were mostly with the 'banner'
Image
......................Imagine, what you will KNOW tomorrow !
tjaliwalpa
Posts: 293
Joined: Sun 18 Apr 2010 9:47 am
Weather Station: Davis VP2
Operating System: Linux Lite Ubuntu 16.04
Location: Karoonda, SA
Contact:

Re: Default Cumulus web page working in PHP using realtime.t

Post by tjaliwalpa »

While all of this has been going on I have set up my main data page (Current Conditions) to use the realtime data at a refesh of 15sec (also my realtime upload). The script (based on Davids wconsole) seems to work OK. I've added a few bits for trends (pressure, temp)and beaufort decriptions. I also use the script to feed my title summary (used to be a scrolling marquee but I got sick of it).

I shall work on expanding the current conditions a little to take full advantage of the new fields in realtime.txt as it currently exists (1.9.1).
Bob
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: Default Cumulus web page working in PHP using realtime.t

Post by daj »

Bob,

On a side note, I see from your site that you have a FineOffset type station -- why update every 15 seconds? The FO stations only refresh every 48 seconds so there is a lot of wasted processing going on.

(I have my 'hosting' hat on at the moment -- sending an update every 15 second to the web is 5760 updates per day, tow thirds of which is duplicate data. Granted it is small amounts of data, but....)

Just an observation.
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
tjaliwalpa
Posts: 293
Joined: Sun 18 Apr 2010 9:47 am
Weather Station: Davis VP2
Operating System: Linux Lite Ubuntu 16.04
Location: Karoonda, SA
Contact:

Re: Default Cumulus web page working in PHP using realtime.t

Post by tjaliwalpa »

daj wrote:Bob,

On a side note, I see from your site that you have a FineOffset type station -- why update every 15 seconds? The FO stations only refresh every 48 seconds so there is a lot of wasted processing going on.

(I have my 'hosting' hat on at the moment -- sending an update every 15 second to the web is 5760 updates per day, tow thirds of which is duplicate data. Granted it is small amounts of data, but....)

Just an observation.
Yes, wondered about that. What would you suggest?
Bob
Synewave
Posts: 642
Joined: Mon 25 Jan 2010 1:55 pm
Weather Station: Watson W-8681
Operating System: Raspian
Location: Brighton, UK
Contact:

Re: Default Cumulus web page working in PHP using realtime.t

Post by Synewave »

I have mine set to 48 secs upload interval, works fine.
tjaliwalpa
Posts: 293
Joined: Sun 18 Apr 2010 9:47 am
Weather Station: Davis VP2
Operating System: Linux Lite Ubuntu 16.04
Location: Karoonda, SA
Contact:

Re: Default Cumulus web page working in PHP using realtime.t

Post by tjaliwalpa »

Synewave wrote:I have mine set to 48 secs upload interval, works fine.
Shall give that a try. I guess the most the data can be out od sync is 47 seconds.
Bob
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Default Cumulus web page working in PHP using realtime.t

Post by beteljuice »

Keep your Ajax call at approx. 15s - think about it ;)
Image
......................Imagine, what you will KNOW tomorrow !
Synewave
Posts: 642
Joined: Mon 25 Jan 2010 1:55 pm
Weather Station: Watson W-8681
Operating System: Raspian
Location: Brighton, UK
Contact:

Re: Default Cumulus web page working in PHP using realtime.t

Post by Synewave »

beteljuice wrote:Keep your Ajax call at approx. 15s - think about it ;)
I have that set to 15 secs too. Seems to be the optimum to avoid 'clashes'.
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: Default Cumulus web page working in PHP using realtime.t

Post by daj »

Yes, keep your Ajax calls at 15 seconds so it will pick up any updates regularly. My original point was more to do with why your upload from Cumulus every 15 seconds
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
Post Reply