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

New addon: Live data on the web

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

Moderator: daj

User avatar
Stig
Posts: 48
Joined: Thu 14 Jan 2010 6:24 pm
Weather Station: WMR928NX
Operating System: Windows 7
Location: Hareskov near Copenhagen
Contact:

Re: New addon: Live data on the web

Post by Stig »

thanks for all your efforts DAJ, I have just installled your weather console as a meny option on my website,
but do not get any data into the console, it writes undefined in all boxes, could you tell me what I am missing
kind regards
Stig

my site: www.hareskovvejr.dk
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: New addon: Live data on the web

Post by steve »

Stig wrote:thanks for all your efforts DAJ, I have just installled your weather console as a meny option on my website,
but do not get any data into the console, it writes undefined in all boxes, could you tell me what I am missing
You've entered the URL of your realtime.txt file in wconsole.js as http://www.hareskovvejr.dk/realtime/realtime.txt which gives a 404; it looks like it should be http://www.hareskovvejr.dk/realtime.txt
Steve
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: New addon: Live data on the web

Post by daj »

You could also get away with this...

Code: Select all

var realtime_location="realtime.txt";
As your realtime file seems to be in the root of your web server
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
User avatar
Stig
Posts: 48
Joined: Thu 14 Jan 2010 6:24 pm
Weather Station: WMR928NX
Operating System: Windows 7
Location: Hareskov near Copenhagen
Contact:

Re: New addon: Live data on the web

Post by Stig »

:oops: thanks DAJ, i had uploaded the wconsole.js from a weather console map copy on another computer-
thank you for your help

Stig

www.Hareskovvejr.dk
Synewave
Posts: 642
Joined: Mon 25 Jan 2010 1:55 pm
Weather Station: Watson W-8681
Operating System: Raspian
Location: Brighton, UK
Contact:

Re: New addon: Live data on the web

Post by Synewave »

gemini06720 wrote:
daj wrote:Yes, I'm trying to capture that problem and get it to ignore it. For now, I resolve it by staggering the timing. So if Cumulus is updating every 5 seconds, refresh the console maybe every 7
David how about a loop within the JavaScrip file ... and no, I do not know how to do it... :P

In one of my PHP script I have the following:

Code: Select all

$realtime = 'realtime.txt';  // relative FILE location of realtime.txt
$fileOpenTries = 3;          // number of open retries for realtime files
$retrySleepTime = 5;       // seconds to wait before next open retry
...
  for ($i = $fileOpenTries; $i > 0; $i--) {
    $dataraw = file_get_contents($realtime);
    if ($dataraw===false)
    {
      sleep($retrySleepTime);
    }
    else
    {
      break;
    }
...
What the code snippet basically do is:
- it tries to open the file;
- if it cannot get the content of the file, it waits for 5 seconds (as setup) and tries again to open the file;
- it will repeat the same open/wait loop 3 times (as setup) and then give up... :(

But, that is a 15 seconds loop and that might be what is needed inside the JavaScript to eventually get the 'realtime.txt' information... ;)

Just a suggestion... :roll:
Hi David,

Did you come up with anything based on Ray's suggestion to prevent the 'undefined' data problem?
I've just been playing with the code for the past few hours and not really got anywhere with it. It's not just for the wconsole, I'm using a modified version of your script to drive most of my pages as realtime.
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: New addon: Live data on the web

Post by gemini06720 »

Synewave wrote:...Did you come up with anything based on Ray's suggestion to prevent the 'undefined' data problem?
I've just been playing with the code for the past few hours and not really got anywhere with it. It's not just for the wconsole, I'm using a modified version of your script to drive most of my pages as realtime.
Paul, I have been looking at other forums where similar questions/requests have been made, about some JavaScript code to check if a file exist and do something if it does exist and something else if it does not exist.

From what I have read, here are the consensus seems to be: "For security reasons JavaScript does not have any functions for file handling... Javascript is called "client-side programming" for a reason - it cannot manipulate server files or client files... Would you really want a JavaScript deleting your hard drive while you were surfing the Net...".

One user suggested the use of XMLHttpRequest Object - also check XMLHttpRequest Object for the use of the code...

The W3Schools site has, indeed, great information (ressources)...
n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: New addon: Live data on the web

Post by n9mfk »

David,
the pop out does not seem to work in ff it works in ie
http://www.n9mfk.com/wconsole.html
Beau
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: New addon: Live data on the web

Post by gemini06720 »

n9mfk wrote:...the pop out does not seem to work in ff it works in ie...
Beau, on my computer in the four browsers that I have installed, the pop-up weather console only works properly (opening in a new smaller window) in the Google Chrome browser:

- in Opera, it opens what appears to be another windows but it is more like a frame within the original (starting) windows;
- in Internet Explorer, it opens a new full size window (because that is the way I have Internet Explorer setup);
- in Firefox, it also opens a full size window (because that is the way I have Firefox setup).

But the small lower-right-corner click-on box does open a new weather console in all 4 browsers... ;)
n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: New addon: Live data on the web

Post by n9mfk »

Ray, what is odd this on works http://www.grantownweather.co.uk/wconsole.html
but mine does not
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: New addon: Live data on the web

Post by gemini06720 »

n9mfk wrote:...but mine does not
Beau, your weather console might not work with your Firefox, but it does work with my Firefox...

Try running Firefox in safe mode, meaning that Firefox will not load any of it extensions ... might be worth the try...
Arnie
Posts: 85
Joined: Tue 05 Jan 2010 9:45 am
Weather Station: La Crosse Ws 2355
Operating System: Windows XP SP3
Location: Wentworthville, Sydney Australia
Contact:

Re: New addon: Live data on the web

Post by Arnie »

Hi David
Great program, unfortunatly I can't seem to get it to work
Ive saved all the files to the root directory
www.wentworthvilleweather.com/wconsole.html

The "Weather Console" just does not load the data
Msg on screen "Reading data, one moment please"
That's as far as it goes
Any ideas

Regatds
Brian
Cheers
Brian
Sydney Australia

http://www.wentworthvilleweather.com

Image
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: New addon: Live data on the web

Post by steve »

Arnie wrote:The "Weather Console" just does not load the data
Msg on screen "Reading data, one moment please"
You've got an extra 'var' keyword in your wconsole.js:

var var realtime_location="realtime.txt";

It should be:

var realtime_location="realtime.txt";
Steve
Arnie
Posts: 85
Joined: Tue 05 Jan 2010 9:45 am
Weather Station: La Crosse Ws 2355
Operating System: Windows XP SP3
Location: Wentworthville, Sydney Australia
Contact:

Re: New addon: Live data on the web

Post by Arnie »

Working great :D

Thanks Steve
Cheers
Brian
Sydney Australia

http://www.wentworthvilleweather.com

Image
Areco747
Posts: 102
Joined: Sun 05 Oct 2008 2:13 pm
Weather Station: WH-1081
Operating System: Windows XP
Location: San Antonio de Areco-Buenos Aires - Argentina
Contact:

Re: New addon: Live data on the web

Post by Areco747 »

Why is not forecast in my "Weatherconsole" http://www.arecoclima.com.ar/console/wconsole.html
Can you help?
Many Thanks!
Mauricio
----------------------------------------------------------------------------------------

Image


http://www.arecoclima.com.ar
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: New addon: Live data on the web

Post by gemini06720 »

Mauricio, when I access the link you provided, the weather console was displaying weather information - see the clip from your Web page:
Post Reply