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

Sunrise / Sunset

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

Moderator: daj

Post Reply
captzero
Posts: 363
Joined: Wed 03 Mar 2010 10:20 am
Weather Station: Vantage Pro2 w/ daytime FARS
Operating System: Windows 10
Location: Brisbane, Australia
Contact:

Sunrise / Sunset

Post by captzero »

Hi All,
I'm putting together a new webpage that's a little bit different. I'll have a webcam streaming a live image of an Australian Native Bee beehive (the bee's activity is dependent on whether its day or night, the current temperature and if its raining or not). I'll probably only have the camera streaming during the day. I'd like to display the time until sunrise and sunset, ie, 3 hours 30 mins to sunrise (not a countdown timer). Is this possible using the <#sunrise> and <#sunset> webtags or should I use the date_sunrise / date_sunset php functions?
Demo page is here
Thanks in advance.
Last edited by captzero on Thu 30 Jan 2014 9:09 am, edited 1 time in total.
Dan

http://www.brisbaneliveweather.com




A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
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: Sunrise / Sunset

Post by beteljuice »

If you are 'streaming' video (as opposed to a snapshot every x seconds) you don't want to keep refreshing your page (Unless perhaps you have current weather data on it).
So you would probably be better embedding one of the many 'coundown to an event' widgets which you set up with the sunset <#webtag>, or just code a JS timer to do the same thing.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Sunrise / Sunset

Post by mcrossley »

Either solution is workable, either client side using some JavaScript or server side using PHP. The basic process for both would be to convert the current station time and sun rise/set times to native data-time objects, subtract one from the other to get the difference, display that value back in hours and minutes.
captzero
Posts: 363
Joined: Wed 03 Mar 2010 10:20 am
Weather Station: Vantage Pro2 w/ daytime FARS
Operating System: Windows 10
Location: Brisbane, Australia
Contact:

Re: Sunrise / Sunset

Post by captzero »

Thanks beteljuice, thanks Mark.
I'll see what I can come up with. I was able to display both the sunset and sunrise time with php using lon and lat and time offset and then wondered if I could use the cumulus tags instead. I'll probably go down the php path.
Thanks again.
Dan

http://www.brisbaneliveweather.com




A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Sunrise / Sunset

Post by mcrossley »

Either way, personally I'd only display the message within a hour say of sun rise/set, it would be pretty meaningless around midday station time.
Post Reply