New Zealand Local Weather Forum

Weather Discussion => Hardware Software and Technology => Projects => Topic started by: TonyC on September 22, 2017, 08:47:59 AM

Title: Home Weather Station Dashboard 3.4 - forecast
Post by: TonyC on September 22, 2017, 08:47:59 AM
One minor annoyance I have found with the Dashboard is that when the page was launched, the weather forecast showed up displaying the days it was last launched which may have been some days previous. Has anyone noticed the same? By refreshing the page, it went away and got the current 3 day forecast. Wether this is due to the Browser (Firefox) I'm using I don't know.
I solved it with a bit of code at the bottom of index,php which refreshes the page just once after loading. If anyone is interested this is what it is.
I believe that if people have cookies turned off it might not work, but it works for me anyway  :)

<script type='text/javascript'>
(function()
{
  if( window.localStorage )
  {
    if( !localStorage.getItem( 'firstLoad' ) )
    {
      localStorage[ 'firstLoad' ] = true;
      window.location.reload();
    } 
    else
      localStorage.removeItem( 'firstLoad' );
  }
})();
</script>

cheers

Tony C.
Title: Re: Home Weather Station Dashboard 3.4 - forecast
Post by: PaulMy on September 23, 2017, 01:16:30 AM
Hi Tony,
Yes I have noticed that the Forecast block shows for yesterday's day/date, as well as today and tomorrow, but can't recall if I have seen it start with any earlier  day/date

 KOMOKA, ON CANADA Smart Home Weather Station (http://www.komokaweather.com/pws)

Seeing yesterday's forecast there doesn't bother me as I can then quickly compare yesterday's forecast to what we actually had.
A refresh brings up today and the next 2.

Enjoy,
Paul

Title: Re: Home Weather Station Dashboard 3.4 - forecast
Post by: TonyC on September 23, 2017, 08:51:53 AM
I guess what was bothering me is if no one looked at the page (including myself) for a number of days, the forecast that first appeared would be well out of date and visitors wouldn't know that they needed to refresh the page. This will hopefully will fix that for most viewers of my site anyway.

cheers
TC
Title: Re: Home Weather Station Dashboard 3.4 - forecast
Post by: Wolfie33 on September 23, 2017, 10:15:23 AM
I don't appear to have that issue with 3.4a. Only occasionally the current conditions image reports my WU as offline.
From memory this version still relies on a cron, maybe something going on there, perhaps a cache issue?
Cheers
Title: Re: Home Weather Station Dashboard 3.4 - forecast
Post by: TonyC on September 24, 2017, 09:53:57 AM

I'm using V34-X5 which doesn't use cron jobs.......
TC
Title: Re: Home Weather Station Dashboard 3.4 - forecast
Post by: JennyLeez on October 05, 2017, 02:30:41 PM
Yep cron jobs were abolished many many versions back :)
Makes it much easier to set up now.

re the forecast. The template is reliant on weather underground and we know how flakey they can be.
Currently I have no weather forecast so I presume they have issues once again.

I agree with Paul. I also do the same, look and see if yesterdays forecast was what we actually had.

Usually is :)
Title: Re: Home Weather Station Dashboard 3.4 - forecast
Post by: TonyC on October 05, 2017, 07:26:28 PM

My forecast has been coming in reliably since I updated the script to reload on launch.
Also the WD forecast matches the Met one for Kaikoura.

cheers
Tony C