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

Auto-refresh Website Index Page Without Using Meta Refresh

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

Moderator: daj

loades
Posts: 5
Joined: Tue 05 Feb 2013 10:50 am
Weather Station: WH1080
Operating System: XP
Location: Southampton

Re: Auto-refresh Website Index Page Without Using Meta Refre

Post by loades »

steve wrote:Unregistered and 'new' users can't download files from the forum. Now that your first post has been approved, you should be able to download the attachments.
Yes, that was it!

I really don't understand javascript, php, html etc., I just keep cutting 'n pasting and changing things until I see what I want! My site is www.loades.net/weather and the only thing which I can't seem to get right is the 'next update in x seconds'. It counts down from 15 seconds, not the 10 second realtime interval set in Cumulus and which I'd like to see. Which part of which file needs changing to correct this?

Thanks in advance.

Malcolm
User avatar
vaggos
Posts: 160
Joined: Sat 06 Feb 2010 7:00 pm
Weather Station: PROWEATHER STATION 1080
Operating System: XP SP3, win7, Win10
Location: Acharnes Athens Greece
Contact:

Re: Auto-refresh Website Index Page Without Using Meta Refre

Post by vaggos »

Did you add jquery and realtimereader?
Image
Acharnes Athens Greece Meteo station
http://www.meteoacharnes.gr
https://weather.meteoacharnes.gr/
Thanks Sandaysoft
loades
Posts: 5
Joined: Tue 05 Feb 2013 10:50 am
Weather Station: WH1080
Operating System: XP
Location: Southampton

Re: Auto-refresh Website Index Page Without Using Meta Refre

Post by loades »

vaggos wrote:Did you add jquery and realtimereader?
Yes, they are both there.

Malcolm
User avatar
vaggos
Posts: 160
Joined: Sat 06 Feb 2010 7:00 pm
Weather Station: PROWEATHER STATION 1080
Operating System: XP SP3, win7, Win10
Location: Acharnes Athens Greece
Contact:

Re: Auto-refresh Website Index Page Without Using Meta Refre

Post by vaggos »

And the
<script src="jquery.js" type="text/javascript"></script>
<script src="realtimereader.js" type="text/javascript"></script>
above head?
I do it in my site and works fine
Image
Acharnes Athens Greece Meteo station
http://www.meteoacharnes.gr
https://weather.meteoacharnes.gr/
Thanks Sandaysoft
loades
Posts: 5
Joined: Tue 05 Feb 2013 10:50 am
Weather Station: WH1080
Operating System: XP
Location: Southampton

Re: Auto-refresh Website Index Page Without Using Meta Refre

Post by loades »

vaggos wrote:And the
<script src="jquery.js" type="text/javascript"></script>
<script src="realtimereader.js" type="text/javascript"></script>
above head?
I do it in my site and works fine
Thanks for trying, but this already appears between <head> and </head> in indexT.htm

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

Re: Auto-refresh Website Index Page Without Using Meta Refre

Post by Synewave »

To change the countdown interval, edit realtimereader.js .

Change the second line 'var update_seconds=15;' value to whatever you want.

Then upload the modified file to the webserver.

Note that I chose 15 seconds as that works well with the 48sec interval that Cumulus uploads the realtime.txt files.
loades
Posts: 5
Joined: Tue 05 Feb 2013 10:50 am
Weather Station: WH1080
Operating System: XP
Location: Southampton

Re: Auto-refresh Website Index Page Without Using Meta Refre

Post by loades »

Synewave wrote:To change the countdown interval, edit realtimereader.js .

Change the second line 'var update_seconds=15;' value to whatever you want.

Then upload the modified file to the webserver.

Note that I chose 15 seconds as that works well with the 48sec interval that Cumulus uploads the realtime.txt files.
Thank you!

Malcolm
ttexsun
Posts: 85
Joined: Sun 29 Jan 2012 2:51 pm
Weather Station: Davis Vantage Pro 2
Operating System: Windows10
Location: Georgia USA
Contact:

Re: Auto-refresh Website Index Page Without Using Meta Refre

Post by ttexsun »

Thanks Paul, I am sorry it has taken me so long to get back to you. I downloaded the file and placed it in the indexT.html file and it works fine about the timer, but the "The Conditions At Local Time" does not change. Any more help would be greatly appreciated. ttexsun
tul9033
Posts: 15
Joined: Sun 09 Jun 2013 6:45 am
Weather Station: Davis Vantage Vue
Operating System: Windows 7
Location: OK

Re: Auto-refresh Website Index Page Without Using Meta Refre

Post by tul9033 »

I've updated the code with the new webtags. One thing I'd like to change is the date display. "It is now showing Conditions at local time 15:40:36 on 09/06/13". I'd like to change the 09/16/13 to June 6th 2013. The "date" below appears to be responsible for the date displayed. I've tried a few of the tags in the wiki FAQ without success.
<caption>Conditions at local time <span id="time"></span> on <span id="date"></span></caption>

Is there a way to just force a refresh automatically when you go to one of the other pages? If I go to any of the other pages; gauges, today yesterday, etc I must manually refresh the page to get the updated data.
Thanks!
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: Auto-refresh Website Index Page Without Using Meta Refre

Post by steve »

tul9033 wrote:I've updated the code with the new webtags. One thing I'd like to change is the date display. "It is now showing Conditions at local time 15:40:36 on 09/06/13". I'd like to change the 09/16/13 to June 6th 2013. The "date" below appears to be responsible for the date displayed. I've tried a few of the tags in the wiki FAQ without success.
Most of the Cumulus date/time web tags have an optional 'format' parameter; see the web tag sections in the help and the wiki. But I don't think this setup uses web tags? If not you'll need to amend the code somehow to generate the date format you want.
Steve
Palmyweather
Posts: 52
Joined: Sat 28 Nov 2009 9:57 am
Weather Station: W1081
Operating System: Windows 7
Location: New Zealand
Contact:

Re: Auto-refresh Website Index Page Without Using Meta Refre

Post by Palmyweather »

Hi all

It has been a while since this topic has been used but I hope someone can help out. I have been using a modified version of this script, the one which Mark (mcrossley) mentioned on September 03, 2011, which until now has been working great. But for some reason it has stopped working with out any known modification.

I liked the one he produced because it indicated by colour which values had been modified.

As this code has not been working for a while, I have gone back to the original posted in this forum to temporary measures.

If anyone has any clues as to why this code no longer works, they would be most appreciated or alternatively a different method of updating data on a page without needing to refresh the page.

Code: Select all

var tick_counter=0;
var j = 8;
var first_run=true;
setInterval('getlivedata()', 1000);

function getlivedata() {

if (j >= 0) {

if (tick_counter <= 0) {

// read realtime.txt file and parse it using a space
j--;

var rawdata = $.ajax({
  url: "http://palmyweather.co.nz/realtime.txt",
  async: false
}).responseText.split(' ');

// Get current values on the page
var temp_out = $("#temp_out").text();
var temp_trend = $("#temp_trend").text();
var hum = $("#hum").text();
var rain_rate = $("#rain_rate").text();
var rain_today = $("#rain_today").text();
var rain_hour = $("#rain_hour").text();
var wind_latest = $("#wind_latest").text();
var wind_avg = $("#wind_avg").text();
var bearing = $("#bearing").text();
var pressure = $("#pressure").text();
var press_trend = $("#press_trend").text();
var wind_gust = $("#wind_gust").text();


// Set all Spans to their values
$("#temp_out").html(rawdata[2]);
$("#temp_trend").html(rawdata[25]);
$("#hum").html(rawdata[3]);
$("#rain_rate").html(rawdata[8]);
$("#rain_today").html(rawdata[9]);
$("#rain_hour").html(rawdata[47]);
$("#wind_avg").html(rawdata[5]);
$("#wind_latest").html(rawdata[5]);
$("#bearing").html(rawdata[11]);
$("#pressure").html(rawdata[10]);
$("#press_trend").html(rawdata[18]);
$("#wind_gust").html(rawdata[6]);
$("#last_contact").html(rawdata[0] +" "+ rawdata[1]);

// is it currently raining, show the icon

if ($("#rain_rate").text() != "0.0") { $("#israining").show();} else { $("#israining").hide();}

// Calculate the Beaufort desc
var beau = rawdata[12];
if (beau=="0"){var bdesc="(Calm)";} else
if (beau=="1"){var bdesc="(Light Air)";} else
if (beau=="2"){var bdesc="(Fresh breeze)";} else
if (beau=="3"){var bdesc="(Moderate breeze)";} else
if (beau=="4"){var bdesc="(Strong breeze)";} else
if (beau=="5"){var bdesc="(Near gale)";} else
if (beau=="6"){var bdesc="(Gale)";} else
if (beau=="7"){var bdesc="(Strong Gale)";} else
if (beau=="8"){var bdesc="(Storm)";} else
if (beau=="9"){var bdesc="(Violent Storm)";} else
if (beau=="10"){var bdesc="(Hurricane)";} else
{ var bdesc="";}
$("#beaufort").html(bdesc);

// highlight if there was a change and show last values
if (first_run==false) {
if (temp_out != $("#temp_out").text()) {$("#temp_out").css("background","yellow"); $("#last_temp_out").text(temp_out);} else {$("#temp_out").css("background","");}
if (temp_trend != $("#temp_trend").text()) {$("#temp_trend").css("background","yellow");$("#last_temp_trend").text(temp_trend);} else {$("#temp_trend").css("background","");}
if (hum != $("#hum").text()) {$("#hum").css("background","yellow"); $("#last_hum").text(hum);} else {$("#hum").css("background","");}
if (rain_rate != $("#rain_rate").text()) {$("#rain_rate").css("background","yellow"); $("#last_rain_rate").text(rain_rate);} else {$("#rain_rate").css("background","");}
if (rain_today != $("#rain_today").text()) {$("#rain_today").css("background","yellow"); $("#last_rain_today").text(rain_today);} else {$("#rain_today").css("background","");}
if (rain_hour != $("#rain_hour").text()) {$("#rain_hour").css("background","yellow"); $("#last_rain_hour").text(rain_hour);} else {$("#rain_hour").css("background","");}
if (wind_avg != $("#wind_avg").text()) {$("#wind_avg").css("background","yellow"); $("#last_wind_avg").text(wind_avg);} else {$("#wind_avg").css("background","");}
if (wind_latest != $("#wind_latest").text()) {$("#wind_latest").css("background","yellow"); $("#last_wind_latest").text(wind_latest); } else {$("#wind_latest").css("background","");}
if (bearing != $("#bearing").text()) {$("#bearing").css("background","yellow"); $("#last_bearing").text(bearing);} else {$("#bearing").css("background","");}
if (pressure != $("#pressure").text()) {$("#pressure").css("background","yellow"); $("#last_pressure").text(pressure);} else {$("#pressure").css("background","");}
if (press_trend != $("#press_trend").text()) {$("#press_trend").css("background","yellow"); $("#last_press_trend").text(press_trend);} else {$("#press_trend").css("background","");}
if (wind_gust != $("#wind_gust").text()) {$("#wind_gust").css("background","yellow"); $("#last_wind_gust").text(wind_gust); } else {$("#wind_gust").css("background","");}

}
else
{
first_run=false;
}
tick_counter=30;
}
else
{
tick_counter--;
$("#refresh_in").html(tick_counter);
}

}
else
{
tick_counter--;
$("#refresh_in").html('<br/> TIMER PAUSED. PLEASE RELOAD PAGE TO GET THE LATEST DATA.');$("#refresh_in").css("background","orange");
}
}
When this code runs, it will not jump back in time for at least one upload and not retrieve any fresh data; the last retrieval of data information will stay static. Upon load, it will also change other environmental factors (such as temperature) to what ever the readings were at the previous time when it jumps back. EG: Current time might be 8pm. Initial load of page shows last contact with station was at 7:59pm before the script takes hold and it will change the time and other data to 7:58pm.

Thanks for your help,
Matt
Check my Palmerston North, New Zealand weather station out at https://palmyweather.co.nz .

Image
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: Auto-refresh Website Index Page Without Using Meta Refresh

Post by dazza1223 »

hey mate i saw ur code about adding this

var temptrendicon = rawdata[25];
if (temptrendicon==0){var imagen = "steady1.gif";}
if (temptrendicon>0){var imagen = "up1.gif";}
if (temptrendicon<0){var imagen = "down1.gif";}
$("#temptrendicon").html('<img src="http://www.brisbaneliveweather.com/'+imagen+'"align =absmiddle>');

ive added it but it not working hase this been tested?
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: Auto-refresh Website Index Page Without Using Meta Refresh

Post by dazza1223 »

any one want wind dir icons script
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
Nevizio
Posts: 106
Joined: Wed 10 Feb 2016 8:43 pm
Weather Station: Oregon Scientific wmr-200
Operating System: Windows 10 - Android
Location: U.S.

Re: Auto-refresh Website Index Page Without Using Meta Refresh

Post by Nevizio »

javascript is great but not all the tags work well for example the one related to the last rain even modifying <#LastRainTipISO> in <span id = "LastRainTipISO"> </ span> does not automatically update forwarding nothing appears in the box. Can someone explain to me why?
Thank you ;)
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: Auto-refresh Website Index Page Without Using Meta Refresh

Post by dazza1223 »

i use <span class="ajax" id="LastRainTipISO"></span>


but what script you use to up date your tags?


link to your website be good!
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
Post Reply