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 4018) - 28 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
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 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
Lightning notification
Moderator: daj
-
- Posts: 1777
- Joined: Sat 17 Dec 2011 11:55 am
- Weather Station: Davis Vantage Pro2
- Operating System: Windows 11 x64
- Location: Dorset - UK
- Contact:
Re: Lightning notification
Parse error: syntax error, unexpected '--' (T_DEC), expecting ',' or ';' in /home/wareham1/public_html/gw1000.php on line 34
$lightningMinAgo returns -480 as of right now.
$lightningMinAgo returns -480 as of right now.
- 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: Lightning notification
Oops - missing quotes in debug .. #
Edit: see viewtopic.php?p=145191#p145191 for 'final' code
a/ say if that is correct or not
b/ say if the correct logic decision (output) was made
Edit: see viewtopic.php?p=145191#p145191 for 'final' code
Code: Select all
$lightningMinAgo = "<#LightningTime format="H,m,s,MM,d,yyyy">";
echo "\n<!-- Cu H,m,s,MM,d,yyyy = ".$lightningMinAgo." -->\n"; // debug
if($lightningMinAgo != "---") $lightningMinAgo = (time() - mktime($lightningMinAgo)) / 60;
echo "\n<!-- Now: ".date(DATE_RFC822)." -->\n<!-- actual mins ago = ".$lightningMinAgo." -->\n"; // debug
<?php if ($lightningMinAgo != "---" && $lightningMinAgo <= 30) { echo '<span class="ligh .....
..is meaningless unless you ..$lightningMinAgo returns -480 as of right now.
a/ say if that is correct or not
b/ say if the correct logic decision (output) was made
Last edited by beteljuice on Thu 13 Aug 2020 12:52 pm, edited 1 time in total.
......................Imagine, what you will KNOW tomorrow !
-
- Posts: 1777
- Joined: Sat 17 Dec 2011 11:55 am
- Weather Station: Davis Vantage Pro2
- Operating System: Windows 11 x64
- Location: Dorset - UK
- Contact:
Re: Lightning notification
view-source:https://warehamwx.co.uk/gw1000.php
Last strike was 4 days ago.
As it's returning -420 now, that would be classed as less than 30.
Last strike was 4 days ago.
As it's returning -420 now, that would be classed as less than 30.
- 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: Lightning notification
<!-- Cu H,m,s,MM,d,yyyy = 8,5,5,07,27,2020 -->
<!-- Now: Sat, 01 Aug 20 01:29:12 +0000 -->
<!-- actual mins ago = -420 -->
... but there must be something wrong with 'time' logic.
27 Jul is much more than 420 mins ago, and -420 shouldn't be "static" - tempus fugit old bean.
I'll look under the bonnet again ..
<!-- Now: Sat, 01 Aug 20 01:29:12 +0000 -->
<!-- actual mins ago = -420 -->
... but there must be something wrong with 'time' logic.
27 Jul is much more than 420 mins ago, and -420 shouldn't be "static" - tempus fugit old bean.
I'll look under the bonnet again ..
......................Imagine, what you will KNOW tomorrow !
- 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: Lightning notification
Doh ... rookie mistake
Won't work - we can't have quotes around all the vars.
We could define each time var separately, but we'll use strtotime() instead, and slightly modify the definition
Edit: oops - missing ; corrected
Edit: #2 - Corrected to 'final' codeHopefully all should now finally be well .....
Code: Select all
$lightningMinAgo = "<#LightningTime format="H,m,s,MM,d,yyyy">";
... mktime($lightningMinAgo)) / 60;
We could define each time var separately, but we'll use strtotime() instead, and slightly modify the definition
Edit: oops - missing ; corrected
Edit: #2 - Corrected to 'final' code
Code: Select all
$lightningMinAgo = "<#LightningTime format="HH:mm:ss"> <#LightningTime format="D">";
if($lightningMinAgo != "---") $lightningMinAgo = (time() - strtotime($lightningMinAgo)) / 60;
<?php if ($lightningMinAgo != "---" && $lightningMinAgo <= 30) { echo '<span class="ligh .....
Last edited by beteljuice on Thu 13 Aug 2020 12:50 pm, edited 2 times in total.
......................Imagine, what you will KNOW tomorrow !
-
- Posts: 1183
- Joined: Fri 27 Jul 2012 11:29 am
- Weather Station: Chas O, Maplin N96FY, N25FR
- Operating System: rPi 3B+ with Buster (full)
Re: Lightning notification
Looks like modified code still has quote confusion,beteljuice wrote: ↑Sat 01 Aug 2020 3:04 am Won't work - we can't have quotes around all the vars.
We could define each time var separately, but we'll use strtotime() instead, and slightly modify the definition ;)
$lightningMinAgo = "<#LightningTime format="HH:mm:ss D">"
if($lightningMinAgo != "---") $lightningMinAgo = (time() - strtotime($lightningMinAgo)) / 60;
<?php if ($lightningMinAgo != "---" && $lightningMinAgo <= 30) { echo '<span class="ligh .....
Hopefully all should now finally be well .....
Surely you want
Code: Select all
$lightningMinAgo = '<#LightningTime format="HH:mm:ss D">';
- 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: Lightning notification
@swfs
By the time PHP gets to see it, only the outer quotes will exist.
However; your query made me see that I'd missed the closing ; from the line
So thanks
Not really, as there are two separate processes involved.Looks like modified code still has quote confusion,
By the time PHP gets to see it, only the outer quotes will exist.
However; your query made me see that I'd missed the closing ; from the line
So thanks
......................Imagine, what you will KNOW tomorrow !
-
- Posts: 1183
- Joined: Fri 27 Jul 2012 11:29 am
- Weather Station: Chas O, Maplin N96FY, N25FR
- Operating System: rPi 3B+ with Buster (full)
Re: Lightning notification
I did forget that.beteljuice wrote: ↑Sat 01 Aug 2020 8:43 pm By the time PHP gets to see it, only the outer quotes will exist.
Glad it was some use.
-
- Posts: 1777
- Joined: Sat 17 Dec 2011 11:55 am
- Weather Station: Davis Vantage Pro2
- Operating System: Windows 11 x64
- Location: Dorset - UK
- Contact:
Re: Lightning notification
Thank you for the replies!
D doesn't seem to be getting formatted for me..
Code: Select all
$lightningMinAgo = "<#LightningTime format="HH:mm:ss D">";
- 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: Lightning notification
Not something I can test unfortunately (not having the software nor a station), but according to the wiki for CuMX
So what is the 'string' from cumulus ?D Displays the date using the format given by the Long Date format. e.g. '22 March 2020' (British Locale)
......................Imagine, what you will KNOW tomorrow !
-
- Posts: 1777
- Joined: Sat 17 Dec 2011 11:55 am
- Weather Station: Davis Vantage Pro2
- Operating System: Windows 11 x64
- Location: Dorset - UK
- Contact:
Re: Lightning notification
This on it's own works..beteljuice wrote: ↑Sat 01 Aug 2020 10:38 pm Not something I can test unfortunately (not having the software nor a station), but according to the wiki for CuMXSo what is the 'string' from cumulus ?D Displays the date using the format given by the Long Date format. e.g. '22 March 2020' (British Locale)
Code: Select all
$lightningMinAgo = "<#LightningTime format="D">";
This returns..
Code: Select all
$lightningMinAgo = "<#LightningTime format="HH:mm:ss D">";
Either a bug, or CMX doesn't allow it?
- 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: Lightning notification
OK - we need to build the string a little bit more ....
Code: Select all
$lightningMinAgo = "<#LightningTime format="HH:mm:ss"> <#LightningTime format="D">";
......................Imagine, what you will KNOW tomorrow !
-
- Posts: 1777
- Joined: Sat 17 Dec 2011 11:55 am
- Weather Station: Davis Vantage Pro2
- Operating System: Windows 11 x64
- Location: Dorset - UK
- Contact:
Re: Lightning notification
haha yesbeteljuice wrote: ↑Sat 01 Aug 2020 10:51 pm OK - we need to build the string a little bit more ....Code: Select all
$lightningMinAgo = "<#LightningTime format="HH:mm:ss"> <#LightningTime format="D">";
I was literally just looking at some of my other files that I use formatting on, and realised that I had to use a duplicate webtag to get another format. Doh!
8146 minutes since the last strike.
Thanks for all your help beteljuice.
- 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: Lightning notification
I'll wait until you say it works as intended, and edit all my posts to a final solution - I won't delete them just to show the beteljuice is increasingly fallible with the passing of time and changes in software
......................Imagine, what you will KNOW tomorrow !
- mcrossley
- Posts: 12694
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: Lightning notification
The format code "D" is a standard format code for the Long date format. It has to be used on its own and cannot be combined with a custom format string, Microsoft set the rules.Mapantz wrote: ↑Sat 01 Aug 2020 10:42 pm$lightningMinAgo = "08:05:05 D";Code: Select all
$lightningMinAgo = "<#LightningTime format="HH:mm:ss D">";
Either a bug, or CMX doesn't allow it?
https://docs.microsoft.com/en-us/dotnet ... at-strings
https://docs.microsoft.com/en-us/dotnet ... at-strings