I have been trying to search for a solution to a problem I am having with some of my webtags. I am able to see correct values being generated to CUtags.php, but those same values do not appear on my website (weather.paulkiener.com). The webtags in question are: $sunrise, $sunset, $daylength, and $tomorrowdaylength.
The attachment has snippets from the CUtags.php dump; ajax-dashboard.php; view from View Page Source from my Chrome browser; and a snapshot from my web page. For example, from the CUtags.php dump, the value for "daylength" is 10:41. The values noted in the Page Source and snapshot from the web page, both display 10:44. The most glaring discrepancy is for the "tomorrowdaylength": the CUtags.php dump shows "There will be 2min 13s more daylight tomorrow"; the Page Source and snapshot from the web page both display "19:00".
Any help with pointing me in the direction of correcting these discrepancies would be greatly appreciated. Thank you very much in advance!
Paul
website: weather.paulkiener.com
Welcome to the Cumulus Support forum.
Latest Cumulus MX V4 release 4.0.0 (build 4022) - 11 May 2024
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
Latest Cumulus MX V4 release 4.0.0 (build 4022) - 11 May 2024
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
Incorrect tag values display on website
Moderator: saratogaWX
-
- Posts: 59
- Joined: Mon 24 Feb 2014 10:21 pm
- Weather Station: Davis Vantage VUE
- Operating System: Windows 10
- Location: United States
- Contact:
Incorrect tag values display on website
You do not have the required permissions to view the files attached to this post.
- saratogaWX
- Posts: 1211
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: Incorrect tag values display on website
It looks like you added those (Daylength, Tomorrow's Daylength) to the stock ajax-dashboard.
The issue is that the Daylength is a time in hh:mm format, and the tomorrowdaylength is a string with embeded time in it .. you can't feed that through the fixup_time() function (which is expecting only a string of hh:mm format). You could just print the value of the string instead, but it would be very verbose and likely distort the layout of the dashboard.
The easy course is to just delete the added display for tomorrowdaylength and just go with the current daylength.
The harder course would be to parse/process the string, extract the data, convert to a timestamp, add/subtract from the timestamp of the current daylenth and reformat as hh:mm to display via fixup_time()
The issue is that the Daylength is a time in hh:mm format, and the tomorrowdaylength is a string with embeded time in it .. you can't feed that through the fixup_time() function (which is expecting only a string of hh:mm format). You could just print the value of the string instead, but it would be very verbose and likely distort the layout of the dashboard.
The easy course is to just delete the added display for tomorrowdaylength and just go with the current daylength.
The harder course would be to parse/process the string, extract the data, convert to a timestamp, add/subtract from the timestamp of the current daylenth and reformat as hh:mm to display via fixup_time()
-
- Posts: 59
- Joined: Mon 24 Feb 2014 10:21 pm
- Weather Station: Davis Vantage VUE
- Operating System: Windows 10
- Location: United States
- Contact:
Re: Incorrect tag values display on website
Thank you for the quick reply. I should have mentioned that the Tomorrow's Daylength was working before I did the recent update to ajax-dashboard.php a few days ago. But I will follow your suggestion and just remove it from the site.
However, your explanation did not address the fact that the other "fields" (not sure if that is the correct term) for Sunrise, Sunset, and Length of Day do not correspond to the values that are present in the CUtags.php file. Any help with that would be appreciated.
Thanks!
Paul (weather.paulkiener.com)
However, your explanation did not address the fact that the other "fields" (not sure if that is the correct term) for Sunrise, Sunset, and Length of Day do not correspond to the values that are present in the CUtags.php file. Any help with that would be appreciated.
Thanks!
Paul (weather.paulkiener.com)
- saratogaWX
- Posts: 1211
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: Incorrect tag values display on website
Those values come from Cumulus, but are overwritten by code in ajax-dashboard to use date_sun_info() time, and your lat/long. In CU-defs.php there is
and your CUtags.php?sce=dump shows and your dashboard shows which gets data from get-USNO-sunmoon.php using the PHP built-in function date_sun_info() to get sunrise/sunset times.
If your website has the same timezone/latitude/longitude settings as your CumulusMX does, the times should likely be the same since the libraries used for those calcs are likely the same too.
Code: Select all
$sunrise = $WX['sunrise'];
$sunset = $WX['sunset'];
$moonrise = $WX['moonrise'];
$moonset = $WX['moonset'];
Code: Select all
$WX['sunrise'] = '07:34';
$WX['sunset'] = '18:18';
$WX['moonrise'] = '01:16';
$WX['moonset'] = '11:28';
In ajax-dashboard.php, there isSunrise: 07:32
Sunset: 18:19
Length of Day: 10:46
Moonrise: 01:17
Moonset: 11:28
Code: Select all
if(isset($USNOdata['sunrise'])) {$sunrise = $USNOdata['sunrise']; }
if(isset($USNOdata['sunrisedate'])) {$sunrisedate = $USNOdata['sunrisedate']; }
if(isset($USNOdata['sunset'])) {$sunset = $USNOdata['sunset']; }
if(isset($USNOdata['sunsetdate'])) {$sunsetdate = $USNOdata['sunsetdate']; }
if(isset($USNOdata['moonrise'])) {$moonrise = $USNOdata['moonrise']; }
if(isset($USNOdata['moonrisedate'])) {$moonrisedate= $USNOdata['moonrisedate']; }
if(isset($USNOdata['moonset'])) {$moonset = $USNOdata['moonset']; }
if(isset($USNOdata['moonsetdate'])) {$moonsetdate = $USNOdata['moonsetdate']; }
If your website has the same timezone/latitude/longitude settings as your CumulusMX does, the times should likely be the same since the libraries used for those calcs are likely the same too.
-
- Posts: 59
- Joined: Mon 24 Feb 2014 10:21 pm
- Weather Station: Davis Vantage VUE
- Operating System: Windows 10
- Location: United States
- Contact:
Re: Incorrect tag values display on website
Thank you, again, for the quick reply. Very much appreciated.
I had the TimeZone in ajax-dashboard.php incorrectly set. It has now been corrected to correspond with what is in get-USNO-sunmoon.php.
I noticed that there is a cache file that should be created (USNO-moondata.txt), but I do not see that in any of my directories. I didn't see where I could turn off the creation of that file, so am wondering if this is adding to my problem.
Again, thank you for your help.
Paul (weather.paulkiener.com)
I had the TimeZone in ajax-dashboard.php incorrectly set. It has now been corrected to correspond with what is in get-USNO-sunmoon.php.
I noticed that there is a cache file that should be created (USNO-moondata.txt), but I do not see that in any of my directories. I didn't see where I could turn off the creation of that file, so am wondering if this is adding to my problem.
Again, thank you for your help.
Paul (weather.paulkiener.com)
- saratogaWX
- Posts: 1211
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: Incorrect tag values display on website
The cache file USNO-moondata.txt is not used/created by the current get-USNO-sunmoon.php since the USNO discontinued their API a couple of years ago, and have only now restarted publishing it (but with a different JSON format and query structure). The get-USNO-sunmoon.php forces a calculation to be done instead, but doesn't need to cache the values, so the USNO-moondata.txt file is not used.
You don't need to change get-USNO-sunmoon.php to configure it .. it uses the $SITE[] entries for tz, latitude,longitude as overrides, so if they're correct in Settings.php, that's all you need.
When the USNO discontinued the original API a couple of years ago, I'd decided to install the calculation routines for moon/sun data in the script to return the data the same as the prior USNO had done (to minimize changes in the other scripts in the templates). Labor saving, for me and you
Hope this answers your question.
You don't need to change get-USNO-sunmoon.php to configure it .. it uses the $SITE[] entries for tz, latitude,longitude as overrides, so if they're correct in Settings.php, that's all you need.
When the USNO discontinued the original API a couple of years ago, I'd decided to install the calculation routines for moon/sun data in the script to return the data the same as the prior USNO had done (to minimize changes in the other scripts in the templates). Labor saving, for me and you
Hope this answers your question.
-
- Posts: 59
- Joined: Mon 24 Feb 2014 10:21 pm
- Weather Station: Davis Vantage VUE
- Operating System: Windows 10
- Location: United States
- Contact:
Re: Incorrect tag values display on website
Your answer helps very much. Thank you!
And thanks for all you have done and continue to do in order to make the Saratoga Template so great.
Paul
And thanks for all you have done and continue to do in order to make the Saratoga Template so great.
Paul