Refresh Timer for template

Post Reply
User avatar
Dehatter
Professional
Professional
Posts: 350
Joined: Sun Jan 07, 2018 5:11 am
Location: Matthews, NC, USA
Station model: Ecowitt WH80
Software: Ecowitt GW1000
Contact:

Refresh Timer for template

Post by Dehatter » Sat Jan 20, 2018 2:37 am

I noticed that if I left the webpage open for an extended period of time, most of the blocks become stale. I added a timer so my page refreshes automatically every 30 mins (adjustable time). It is really easy to do, but would like some feedback before I share it.

Thanks!

Tom
Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Refresh Timer for template

Post by Jachym » Sat Jan 20, 2018 9:36 am

Which blocks freeze? Most blocks are static, the few interactive ones (current etc.) should keep updating indefinitely

User avatar
Johnny
Developer
Developer
Posts: 313
Joined: Sat Aug 19, 2017 10:16 pm
Location: Watford, Hertfordshire, England
Station model: Davis Vantage Pro2 Plus
Software: Meteobridge
Contact:

Re: Refresh Timer for template

Post by Johnny » Sat Jan 20, 2018 9:47 am

For me the block that doesn't update is 'stationData' I have to refresh the browser or select a new period from the stationData drop-down menu. I've always assumed that's the way this block is meant to work.

http://www.watfordweather.uk
http://www.watfordweather.co.uk
Image
Davis Vantage Pro2 Plus: http://www.watfordweather.uk

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Refresh Timer for template

Post by Jachym » Sat Jan 20, 2018 1:44 pm

No, not all blocks update, that would consume way too much resources

Blocks which update include current, gauges, steel series, some image blocks, webcam etc.

User avatar
Dehatter
Professional
Professional
Posts: 350
Joined: Sun Jan 07, 2018 5:11 am
Location: Matthews, NC, USA
Station model: Ecowitt WH80
Software: Ecowitt GW1000
Contact:

Re: Refresh Timer for template

Post by Dehatter » Sat Jan 20, 2018 3:15 pm

The following blocks do not update on a schedule that can can see:
Forecast
Meteogram
Air Quality
Station Status
Warnings
Station Records
Wind
World Weather
Earthquakes
Today

So rather than mess with putting a timer in all of them, I just refresh the page twice an hour. It is a single line of code.
Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Refresh Timer for template

Post by Jachym » Sat Jan 20, 2018 3:21 pm

No those dont, I did not expect someone would be looking at the page for like an hour or so. Placig a timer would slow down the entire website a lot if every user triggered dozens of updates every few seconds

User avatar
Dehatter
Professional
Professional
Posts: 350
Joined: Sun Jan 07, 2018 5:11 am
Location: Matthews, NC, USA
Station model: Ecowitt WH80
Software: Ecowitt GW1000
Contact:

Re: Refresh Timer for template

Post by Dehatter » Sat Jan 20, 2018 4:11 pm

Well i don't stare at it for an hour, but I have left the page open...lol.

I agree most of them do not need updating every few seconds. A few updating would be helpful.

Trends Today Warnings wind stationstatus and stationaverages on the half hour

forecast meteogram stationrecords airquality much less frequently

windy times out after some period and goes away.

and at least once a day for the rest of them
Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Refresh Timer for template

Post by Jachym » Sat Jan 20, 2018 4:39 pm

Hi,
this in my opinion is not very useful - once per day? That would assume you really keep looking at it for a day, the page being opened for a day or more. Every block auto-updates during each loding, so I really dont think many people spend more than a few seconds or max. minutes on the homepage before they go somewhere else on the website or elsewhere

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Refresh Timer for template

Post by Jachym » Sat Jan 20, 2018 4:39 pm

Every JS timer potentially slows the page down and considering the Pros and Cons Im not a big fan of this, those that really need updating - eg. the current and gauges, already have it

Lespius
Advisor
Advisor
Posts: 61
Joined: Wed Aug 23, 2017 7:32 pm
Location: Cugy, Switzerland
Station model: Davis VP2
Software: Meteobridge
Contact:

Re: Refresh Timer for template

Post by Lespius » Sat Jan 20, 2018 5:34 pm

Hi,
I input a line of code for an autorefresh as well, every 5 minutes. Mainly to refresh the interactive graph block.
Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Refresh Timer for template

Post by Jachym » Sat Jan 20, 2018 8:18 pm

Yes, that will work of course and feel free to do so. It is not so elegant solution because the entire page has to reload, but it will do the trick. Probabyl easiest solution.

Post Reply