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.
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:
fractonimbus wrote:And also (3) the Last Rainfall data, which is not part of the realtime.txt. Is there a way to get Cumulus to add parameters to realtime.txt, or to some small text file to upload at the same time?

Ideally the dawn dusk, sun and moon etc data would be nice to include, too, but I may have to let the regular upload process do that (which is what I did with the PHP page).

DN
You don't need to use the default realtime.txt file, you could build your own using webtags or create a second one. Example

realtime-extras.txt
<#sunrise> <#sunset> <#dawn> <#dusk>

Get Cumulus to process this file in realtime and it will upload too. Your code can then parse this additional file for the extra data
Just a little tip here! Davids existing script parses the realtime.txt file and splits the data when it finds a space. A lot of the extra webtags available for use have spaces in (i.e. "Rising Rapidly"). So the script would treat this as two tags, and sometimes one if it was "Steady" for example, therefore resulting in unpredictable data positions.

I've overcome this by creating the extra realtime file and placed a ~ (tilda) after each webtag like this:

Code: Select all

<#temptrendtext>~
<#presstrend>~
<#dawn>~
<#dusk>~
<#daylightlength format="h'hrs' n'min'">~
<#sunrise>~
<#sunset>~
<#daylength format="h'hrs' n'min'">~
<#moonrise>~ ... and so on
Then in the Javascript use var rawdataextras=realdataextras.split("~");
fractonimbus
Posts: 159
Joined: Thu 03 Feb 2011 1:15 am
Weather Station: WH1091
Operating System: Windows 7 on a Dell Vostro
Location: Canberra

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

Post by fractonimbus »

Splendid! Thanks, David.

And I have the FDI maths working too. It's amazing how many different ways there are to express a simple equation -- eg IDL, Python, FORTRAN, PHP and Javascript all do it differently :-(

DN
fractonimbus
Posts: 159
Joined: Thu 03 Feb 2011 1:15 am
Weather Station: WH1091
Operating System: Windows 7 on a Dell Vostro
Location: Canberra

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

Post by fractonimbus »

Paul, thanks, great tip

DN
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 »

Good point Paul. The original script was to parse the standard realtime file, but I forgot extra tags may have a space
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
fractonimbus
Posts: 159
Joined: Thu 03 Feb 2011 1:15 am
Weather Station: WH1091
Operating System: Windows 7 on a Dell Vostro
Location: Canberra

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

Post by fractonimbus »

Well, I've now got the whole page working, including using a "loading..." warning. http://www.dcnicholls.com/wx/ind_test.html

DN
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 »

fractonimbus wrote:Well, I've now got the whole page working, including using a "loading..." warning. http://www.dcnicholls.com/wx/ind_test.html

DN
Working great. You're most welcome to look at the source of my script and use any of it. There is some code in there to make the Last Rain a bit more friendly. i.e. Last Rain: 4 Days Ago
User avatar
laulau
Posts: 678
Joined: Tue 13 Oct 2009 10:52 pm
Weather Station: WeatherDuino Pro2
Operating System: Win 7
Location: Meyenheim, Alsace, FR
Contact:

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

Post by laulau »

Thanks Paul,
Is it possible to have the "webtags" source of your realtimeextras.txt file ? :oops:
BTW where did you get the gauges of your "Gauge dashboard" :oops: ;)
Laurent

Image
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 »

laulau wrote:Thanks Paul,
Is it possible to have the "webtags" source of your realtimeextras.txt file ? :oops:
BTW where did you get the gauges of your "Gauge dashboard" :oops: ;)
I'll send the file to you via PM.

The gauges, I made them - based on the Bindows Free gauges. They also work from the realtime files.
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 »

Paul, you may want to test your gauges in IE :roll: , I had to implement a few work-arounds to get Bindows reliable in IE.
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 »

mcrossley wrote:Paul, you may want to test your gauges in IE :roll: , I had to implement a few work-arounds to get Bindows reliable in IE.
Yes, I'm struggling to get them working in IE, hence I have a bit of Javascript to direct IE users to my old gauges page. If you can give me any help to get them working in IE I would very much appreciate it.
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 »

FAO Daj.

You may remember sometime ago the 'old' beteljuice Ajax where the problem of initial data population suddenly appeared.

The problems seem to be the way 'modern' browsers load CSS (usually applied last, depending upon the browser, amd wether it's in-line, in page or seperate page !)

We are manipulating elements, and (again) depending upon browser, the onLoad is usually executing BEFORE all the CSS properties have been 'declared' !

The Ajax loop actually fails, but as you have probably discovered, it's rare for an error to escape from Ajax :D

The beteljuice got around this by creating an invisible <div id= > at the bottom of the html.
Dumped the Onload and just have code link in <header> and let JS run itself.

The Ajax has several attempts to find the (last) <div> before running the loop.

html:

Code: Select all


<!-- IMPORTANT, you must ALWAYS having the following line before the closing </body> tag !!!! -->
<div id="ajaxEND" style="display; none:"></div>

  </body>
Ajax <div> check

Code: Select all

// invoke when first loaded on page
var ajax_attempt = 0;

function start_up() {
	if(document.getElementById('ajaxEND')) {
		ajaxLoader(currdatFile + '?' + new Date().getTime());
 		window.setInterval("ajax_countup()", 1000); // run the counter for seconds since update
	} else {
		ajax_attempt++;
		if(ajax_attempt >= 50) {
			betel('Page has failed to download fully'); // 50 attempts for page to format
		} else {
			setTimeout('start_up()', 200);
		}
	}
}

start_up();
Not elegant, but it works !

Edit: forgot to mention fuction betel(), simply calls 'alert' outside of the Ajax loop, sometimes it actually works for debugging ;)

Haven't looked at Kens latest work, but the original (PHP mix) version used php duplication of all calculated variable and pre-populated the loaded page, which also keeps the purists happy for PCs not running JS.

... but it's a lot of work to code correctly :?

All gone a bit off topic, but at least we have given a guiding light. :idea:

Note to Ajax newbies:
You don't HAVE to have the 'html templates' of someomes Ajax, just follow the element naming structure and make the pages how you want.
Last edited by beteljuice on Wed 09 Feb 2011 1:52 pm, edited 2 times in total.
Image
......................Imagine, what you will KNOW tomorrow !
fractonimbus
Posts: 159
Joined: Thu 03 Feb 2011 1:15 am
Weather Station: WH1091
Operating System: Windows 7 on a Dell Vostro
Location: Canberra

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

Post by fractonimbus »

Synewave wrote: Working great. You're most welcome to look at the source of my script and use any of it. There is some code in there to make the Last Rain a bit more friendly. i.e. Last Rain: 4 Days Ago
Thanks, Paul I might do that. It's getting a tad late here and I'm supposed to be writing a research paper (but Cumulus is much more fun :-)

DN
fractonimbus
Posts: 159
Joined: Thu 03 Feb 2011 1:15 am
Weather Station: WH1091
Operating System: Windows 7 on a Dell Vostro
Location: Canberra

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

Post by fractonimbus »

I'm noticing the occasional data corruption when the Javascript tries to load an page that's being updated by Cumulus (mentioned earlier in this thread, I think).

A Javascript question for the gurus on this list: who something like the following work to reload the page?

window.onerror=function(){
window.location.reload();}


DN
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 »

fractonimbus wrote:A Javascript question for the gurus on this list: who something like the following work to reload the page?

window.onerror=function(){
window.location.reload();}
No, as you are never reloading the page -- what you are actually doing is updating small bits of the HTML document in the browser. A bit like you having a sheet of paper in front of you, already full of words. You then rub out a few works and write something else. No one takes the page away and gives it to you again, you just tweaked it

You should not get the 'corruption' too much if you get your timings correct. How often is Cumulus updating realtime? And howoftenis jQuery Ajax reading the file?

I'm sure I did write something to check the rawdata variable to ensure it was valid data -- must look it out.
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:I'm sure I did write something to check the rawdata variable to ensure it was valid data -- must look it out.
I made a change to my script today and it seems to have made a difference. If the data tries to reload at the same time as the realtime.txt being uploaded by Cumulus, I would get the strange HTML characters instead of the data. If I then waited for the interval time to elapse (i.e 15 secs), the data returns to the real data.

So I removed the line:

Code: Select all

if (realdata.indexOf(realtime_location) == -1 ) { .......
and the corresponding  }
The effect is that the script doesn't wait for the interval time to elapse but refreshes the data as soon as it is available i.e a few secs.

David, I am wondering the reason why you coded this line?
Post Reply