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 4019) - 03 April 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

online / offline webtag for htm

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

Moderator: daj

212adws
Posts: 6
Joined: Mon 05 Apr 2010 12:24 pm
Weather Station: Maplin N96FY
Operating System: Windows 7
Location: Woking, Surrey, UK
Contact:

Re: online / offline webtag for htm

Post by 212adws »

I've been following this thread avidly but unfortunately cannot make use of the info because my site is reliant on PHP!! So....here is my less-than-elegant solution using PHP :-

Code: Select all

<?php
$timeNow = time();
$last_update = filemtime("page1.php");  //edit this filename
$timeLapse = $timeNow-$last_update;
if ($timeLapse > 300) {			// 5mins interval
$status = "<font color='red'><b>OffLine</b></font>";
}
else {
$status = "<font color='green'><b>OnLine</b></font>";
}
?>
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: online / offline webtag for htm

Post by beteljuice »

I did say it would be easier with php - but although you have shown the reasoning you have not shown an example of the output code ;)
Image
......................Imagine, what you will KNOW tomorrow !
212adws
Posts: 6
Joined: Mon 05 Apr 2010 12:24 pm
Weather Station: Maplin N96FY
Operating System: Windows 7
Location: Woking, Surrey, UK
Contact:

Re: online / offline webtag for htm

Post by 212adws »

Ok, the way I have used this script is:
1. upload the script to your php enabled server as a php file.
2. edit the <head> of the page where the output is required with:

Code: Select all

<?php include ("script.php"); ?>
3. Within the body, where the output is required, call the script with:

Code: Select all

<?php echo $status ?>
http://www.sheerwater.info shows it in action.

regards
User avatar
GTB
Posts: 75
Joined: Thu 06 Nov 2008 12:14 am
Weather Station: ws1081 with Cumulus
Operating System: win 2000
Location: Terrigal NSW
Contact:

Re: online / offline webtag for htm

Post by GTB »

so now that daylight saving is upon - us we have a problem :bash:

how do we tell the script (or cumulus) that we now have to add an hour to UTC (now, and take it off at the end of daylight saving)?

geoff
Image
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: online / offline webtag for htm

Post by beteljuice »

Edit: Information only - ignore change !

Hmmm ...... I thought that was covered (we are DST), but testing remotely can never truly duplicate things.

Try this additional line:

Code: Select all

...

var now = new Date();
now = now.getTime(); // new line

...
Let me know if there is any change.
Last edited by beteljuice on Mon 03 Oct 2011 4:33 am, edited 1 time in total.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
GTB
Posts: 75
Joined: Thu 06 Nov 2008 12:14 am
Weather Station: ws1081 with Cumulus
Operating System: win 2000
Location: Terrigal NSW
Contact:

Re: online / offline webtag for htm

Post by GTB »

yep
that seems to have worked

the beteljuice strikes again

geoff
Image
User avatar
GTB
Posts: 75
Joined: Thu 06 Nov 2008 12:14 am
Weather Station: ws1081 with Cumulus
Operating System: win 2000
Location: Terrigal NSW
Contact:

Re: online / offline webtag for htm

Post by GTB »

ok - maybe we didn't need to do that change

my problem seems to be only with my win2000 machine

geoff
Image
User avatar
GTB
Posts: 75
Joined: Thu 06 Nov 2008 12:14 am
Weather Station: ws1081 with Cumulus
Operating System: win 2000
Location: Terrigal NSW
Contact:

Re: online / offline webtag for htm

Post by GTB »

and it is happening in both explorer and opera browsers

geoff
Image
User avatar
GTB
Posts: 75
Joined: Thu 06 Nov 2008 12:14 am
Weather Station: ws1081 with Cumulus
Operating System: win 2000
Location: Terrigal NSW
Contact:

Re: online / offline webtag for htm

Post by GTB »

problem solved

it was the daylight saving setting in win2000

i needed to upload a patch to change the dates of start and finish

geoff
Image
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: online / offline webtag for htm

Post by beteljuice »

... problem solved

it was the daylight saving setting in win2000
Sort of glad to hear it :D
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
GTB
Posts: 75
Joined: Thu 06 Nov 2008 12:14 am
Weather Station: ws1081 with Cumulus
Operating System: win 2000
Location: Terrigal NSW
Contact:

Re: online / offline webtag for htm

Post by GTB »

me too beteljuice - me too

geoff
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: online / offline webtag for htm

Post by dazza1223 »

hey um im paying and testing a old bit of javascript

on line and off line

but it allways shows on line all the time and when i shut down Cumulus and wait for like 10 to 15 min and come back to it still shows on line i dont know if it becose my page in php?

but ive look around but i cnt see anything

https://www.davisworthing.co.uk/new/test.php


any help on this will be great?
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
User avatar
HansR
Posts: 5957
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bookworm
Location: Wagenborgen (NL)
Contact:

Re: online / offline webtag for htm

Post by HansR »

Is there a contest going on about who can revive the oldest thread? :groan:
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
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: online / offline webtag for htm

Post by beteljuice »

@dazza ... if you are using a php page why use the clunky js routine ?

Just goto the top of this page.

These are 'one-off' codes in that they only check when the page with the code loads.
With the php solution you can check the age of eg. realtime.txt and not be dependent on the 'holding' page being uploaded continously - which if you are using php and ajax you don't need every page uploaded frequently, only its content via the data uploads.

In regards to the js script .... you are using CuMX, the time / date formats are different - the then_month is giving nonsense figures :shock:

Code: Select all

var then_month = <#timeUTC format=mm> -1;
var then = Date.UTC(<#timeUTC format=yyyy>, then_month, <#timeUTC format="dd', 'hh', 'mm', 'ss">);
Needs to become

Code: Select all

var then_month = <#timeUTC format=MM> -1;
var then = Date.UTC(<#timeUTC format=yyyy>, then_month, <#timeUTC format="dd', 'HH', 'mm', 'ss">);
Image
......................Imagine, what you will KNOW tomorrow !
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: online / offline webtag for htm

Post by dazza1223 »

wow beteljuice yes i have usesd the php one and boom it work but i will like the led flashing Gif like in the old one is there way u can work ur beteljuice magic and incude the GIF flashing or is that two much to ask for? :D :D


ie like ( Station Online then the flashing gif) just like the old one but in php?
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
Post Reply