Outlook block

Post Reply
blainec
Observer
Observer
Posts: 13
Joined: Sun Aug 20, 2017 2:02 pm
Location: Calgary, Alberta
Station model: Davis Pro 2
Software: Weather Display
Contact:

Outlook block

Post by blainec » Fri Dec 22, 2017 8:17 pm

Icon not changing to dark color when background is light

User avatar
meteocaldas
Language Admin
Language Admin
Posts: 111
Joined: Fri Aug 25, 2017 7:56 pm
Location: Caldas da Rainha, Portugal
Station model: OS WMR-88A
Software: Cumulus
Contact:

Re: Outlook block

Post by meteocaldas » Fri Dec 22, 2017 11:01 pm

For those of you that are using light backgrounds and while Jachym doesn't release an update, you can solve this icon color issue by just replacing /dark/ by /<?php echo $theme?>/ in line 84 and line 140 of the outlook.php script.

Line 84
<img src="homepage/blocks/outlook/icons/dark/<?php echo $hourly['icon']. '.png'?>" width="40px">
should be
<img src="homepage/blocks/outlook/icons/<?php echo $theme?>/<?php echo $hourly['icon']. '.png'?>" width="40px">

Line 140
<img src="homepage/blocks/outlook/icons/dark/<?php echo $hourlyIcon?>.png" width="19px">
should be
<img src="homepage/blocks/outlook/icons/<?php echo $theme?>/<?php echo $hourlyIcon?>.png" width="19px">


http://www.meteocaldas.com/mtp
Image

User avatar
BobW55
Forecaster
Forecaster
Posts: 115
Joined: Thu Sep 28, 2017 11:43 pm
Location: Michigan USA
Station model: Davis Pro2
Software: Cumulus
Contact:

Re: Outlook block

Post by BobW55 » Mon Dec 25, 2017 2:10 am

Snow reported in cm not in inches.
Outlook
Snow (2–7 cm.) until tonight, starting again tomorrow afternoon, and breezy starting tonight, continuing until tomorrow evening.


Everything else appears to be working well.
http://melvinweather.com/template/indexDesktop.php
Davis Vantage Pro2 wired
Solar/UV sensors
Sky Cam
Ham radio K8pos

User avatar
MonyMony
Forecaster
Forecaster
Posts: 192
Joined: Sun Aug 20, 2017 12:54 pm
Location: Elkton, Maryland, US
Station model: Davis Pro 2
Software: WeatherCat/Meteobridge
Contact:

Re: Outlook block

Post by MonyMony » Fri Dec 29, 2017 7:45 pm

BobW55 wrote: Mon Dec 25, 2017 2:10 am Snow reported in cm not in inches.
Same here... an option to show in inches would be a great addition.
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: Outlook block

Post by Jachym » Fri Dec 29, 2017 8:06 pm

Im not sure if this can be translated. These summary strings are written by real humans and are dynamic, it is not a predefined list of sentences which could be translated/converted

User avatar
meteocaldas
Language Admin
Language Admin
Posts: 111
Joined: Fri Aug 25, 2017 7:56 pm
Location: Caldas da Rainha, Portugal
Station model: OS WMR-88A
Software: Cumulus
Contact:

Re: Outlook block

Post by meteocaldas » Fri Dec 29, 2017 11:00 pm

BobW55 wrote: Mon Dec 25, 2017 2:10 am Snow reported in cm not in inches.
Outlook
Snow (2–7 cm.) until tonight, starting again tomorrow afternoon, and breezy starting tonight, continuing until tomorrow evening.
MonyMony wrote: Fri Dec 29, 2017 7:45 pm Same here... an option to show in inches would be a great addition.
Hi guys,
I checked darksky and to solve this issue just replace units=si by units=us in this line of outlook.php:

Code: Select all

$fIOURL = "https://api.darksky.net/forecast/".$fIOKey."/".$stationLat.",".$stationLon."?units=si&lang=".$fIOLanguage;
For outlook text with US units it should be

Code: Select all

$fIOURL = "https://api.darksky.net/forecast/".$fIOKey."/".$stationLat.",".$stationLon."?units=us&lang=".$fIOLanguage;
This way, you will get snow outlook text in inches instead of cm.
I tried it myself for cecilweather.com lat and long and I got: "Snow (< 1 in.) tomorrow morning."

The problem with changing units to US is that the darksky .json will now display temperature in ºF, wind speed in mph, rain/snow in inches but baro in hPa!!
I didn't take this into account when I proposed the creation of this block to Jachym, so the outlookBlock script was all build around a .json in SI units (that are converted to US units after beeing parsed as SI). Parsing the .json directly in US units, will probably result in a general error in your outlook weather values, but I am not sure. Could you guys test it?
This seems to be an issue requiring good imagination and expert skills to be solved :-)

Jachym, could you please use your imagination and your skills to take this into account in a future outlookBlock update? Thank you soooo much!

Image

User avatar
BobW55
Forecaster
Forecaster
Posts: 115
Joined: Thu Sep 28, 2017 11:43 pm
Location: Michigan USA
Station model: Davis Pro2
Software: Cumulus
Contact:

Re: Outlook block

Post by BobW55 » Wed Jan 03, 2018 4:24 pm

Just changed mine to US units.
Still reports pressure in inches Hg.
outlook.PNG
outlook.PNG (16.26 KiB) Viewed 25572 times
Great work,

Thank you

EDIT: Will have to see where the API for darksky thinks I am located. I wish it were that warm here.
http://melvinweather.com/template/indexDesktop.php
Davis Vantage Pro2 wired
Solar/UV sensors
Sky Cam
Ham radio K8pos

User avatar
meteocaldas
Language Admin
Language Admin
Posts: 111
Joined: Fri Aug 25, 2017 7:56 pm
Location: Caldas da Rainha, Portugal
Station model: OS WMR-88A
Software: Cumulus
Contact:

Re: Outlook block

Post by meteocaldas » Thu Jan 04, 2018 1:19 am

BobW55 wrote: Wed Jan 03, 2018 4:24 pm Just changed mine to US units.
Still reports pressure in inches Hg.
EDIT: Will have to see where the API for darksky thinks I am located. I wish it were that warm here.
Hi there,
Everything is according to what I said in previous post.
When you changed to US units, darksky changed everything to US units except pressure that remaind in hPa (odd isn't it?).
So now you have correct text, correct pressure and correct humidity, all the rest are wrong values.
Why? Because outlookBlock script was done supposing that everybody was going to use Si and then, according to the units preferences of each site, SI is converted to the choosen units and it works perfectly.
but... using US units, messes it alll up (except for pressure that is still in hPa), because the US values that are parsed from darksky, will be converted to other values by the conversion scales used in the script.
Example: using US units, you will get wind 2mph, but the script will think this value is 2km/h and will give a final result of 3.2mph. Same goes for temperature.
The only way to solve the problem is to update the script to take into account that user can choose US units instead of SI, so that in such case no conversion would be necessary.
While Jachym doesn't come up with a solution, I will try to check if there is an easy way to cool down your summer temperatures :D

EDIT: Trying to solve this prob, I have just realized that when choosing SI, darksky outputs wind speed in m/s not in Km/h. That is the reason why in outlook block speed values shown in km/h are so low and always about 3.6 times less than forecasted values by WU or meteoBlue! Jachym, please Help!!!!!!!! looks like the script has to be rewritten taking all these factors into account. :)
Image
Last edited by meteocaldas on Thu Jan 04, 2018 10:51 am, edited 2 times in total.

User avatar
BobW55
Forecaster
Forecaster
Posts: 115
Joined: Thu Sep 28, 2017 11:43 pm
Location: Michigan USA
Station model: Davis Pro2
Software: Cumulus
Contact:

Re: Outlook block

Post by BobW55 » Thu Jan 04, 2018 2:18 am

No, the script and everything else is running just fine, at least on my end.
Problem is my API key from Darksky, it contains a GPS (Lat/log) for your location.

Here is mine: https://api.darksky.net/forecast/YOUR API KEY HERE/37.8267,-122.4233
The listed Latitude and Longitude for my location is way off, they should be 43.1836669 and -82.86149069999999

So no wonder my temperatures are off, they are from California.
Have already sent an email to DarkSky.
http://melvinweather.com/template/indexDesktop.php
Davis Vantage Pro2 wired
Solar/UV sensors
Sky Cam
Ham radio K8pos

User avatar
meteocaldas
Language Admin
Language Admin
Posts: 111
Joined: Fri Aug 25, 2017 7:56 pm
Location: Caldas da Rainha, Portugal
Station model: OS WMR-88A
Software: Cumulus
Contact:

Re: Outlook block

Post by meteocaldas » Thu Jan 04, 2018 2:45 am

Well, I may be wrong, but API key has nothing to do with lat and long, and that is why in the outlookBlock script you have to state what latitude and longitude you want to get the data from. API key is just for them to make sure that you do not exceed a certain maximum number of requests per day.

Code: Select all

	$fIOURL = "https://api.darksky.net/forecast/".$fIOKey."/".$stationLat.",".$stationLon."?units=si&lang=".$fIOLanguage;
In all requests to darksky, you always need to speccify lat and long.

The script is working fine but all the values you are getting, (except humidity and pressure) are wrong because the script makes an unnecessary conversion of US units (thinking they are SI units) to US units. :-)
I am going to send you a outlookBlock.php script with directly parsed US units, (and no conversion) and you will see that everything will be fine and that it has nothing to do with your lat and long.
Just let me finish it and test it, before I go to sleep, it is 3AM here :-)

Image

User avatar
BobW55
Forecaster
Forecaster
Posts: 115
Joined: Thu Sep 28, 2017 11:43 pm
Location: Michigan USA
Station model: Davis Pro2
Software: Cumulus
Contact:

Re: Outlook block

Post by BobW55 » Thu Jan 04, 2018 3:47 am

When I log on to DARKSKY, it shows me my key, along with a URL to show what RAW data is sent back.
It has been many years since I logged into DarkSky and received my key, I do not remember if I had to provide my Lat/Lon at that time.
I double checked my settings in Meteotemplate main set up, and the Lat/Lon are correct there.
http://melvinweather.com/template/indexDesktop.php
Davis Vantage Pro2 wired
Solar/UV sensors
Sky Cam
Ham radio K8pos

User avatar
meteocaldas
Language Admin
Language Admin
Posts: 111
Joined: Fri Aug 25, 2017 7:56 pm
Location: Caldas da Rainha, Portugal
Station model: OS WMR-88A
Software: Cumulus
Contact:

Re: Outlook block

Post by meteocaldas » Thu Jan 04, 2018 3:55 am

Well, I see what you mean, and that is a very specific problem to mess things even more :-)
Anyway, I've just sent you a PM with an outlookBlock.php for you to test. It parses directly from US units. Please check the values you get and let me know the result.

http://www.meteocaldas.com/mtp

User avatar
BobW55
Forecaster
Forecaster
Posts: 115
Joined: Thu Sep 28, 2017 11:43 pm
Location: Michigan USA
Station model: Davis Pro2
Software: Cumulus
Contact:

Re: Outlook block

Post by BobW55 » Fri Jan 05, 2018 5:50 am

meteocaldas
Not sure just what all you changed, But everything is now displaying properly. I have the correct imperial units, and data is matching my location.

The old PHP displayed this:
outlookold.PNG
outlookold.PNG (38.94 KiB) Viewed 25489 times

The new PHP displays this:
Newoutlook.PNG
Newoutlook.PNG (40.96 KiB) Viewed 25489 times
I really appreciate your efforts in this matter.

Bob
http://melvinweather.com/template/indexDesktop.php
Davis Vantage Pro2 wired
Solar/UV sensors
Sky Cam
Ham radio K8pos

User avatar
meteocaldas
Language Admin
Language Admin
Posts: 111
Joined: Fri Aug 25, 2017 7:56 pm
Location: Caldas da Rainha, Portugal
Station model: OS WMR-88A
Software: Cumulus
Contact:

Re: Outlook block

Post by meteocaldas » Fri Jan 05, 2018 11:40 am

BobW55 wrote: Fri Jan 05, 2018 5:50 am meteocaldas
Not sure just what all you changed, But everything is now displaying properly. I have the correct imperial units, and data is matching my location.
Hi Bob, thank you so much for your testing and I am very glad to see that units and values are displaying correctly now, and that your future snow forecasts will be in inches instead of cm :-)
I am sending you a new php to correct the small ºF issue in the first line.
Regards
Paulo
Image
http://www.meteocaldas.com/mmtp

User avatar
BobW55
Forecaster
Forecaster
Posts: 115
Joined: Thu Sep 28, 2017 11:43 pm
Location: Michigan USA
Station model: Davis Pro2
Software: Cumulus
Contact:

Re: Outlook block

Post by BobW55 » Fri Jan 05, 2018 3:22 pm

All problems solved.
Correct Units.
Correct Data
No more ? on the first line.

Thank you

Bob
http://melvinweather.com/template/indexDesktop.php
Davis Vantage Pro2 wired
Solar/UV sensors
Sky Cam
Ham radio K8pos

User avatar
MrData
Observer
Observer
Posts: 39
Joined: Tue Oct 31, 2017 3:02 pm
Location: Southeast Wisconsin, USA
Station model: Davis Vantage Pro II
Software: Meteobridge
Contact:

Re: Outlook block

Post by MrData » Tue Mar 13, 2018 3:57 pm

I'm still trying to ge the OUTLOOK block to work on my site.
For some reason, CURRENT.TXT has never appeared in my forecast/cache folder.
I have reset my darksky api key a few times and it is apparently working because
if I run this from the browser, I get what appears to be accurate (but metric) data returned....


But if I run this from the browser, I get bogus data
https://humdrums.net/WX/ocon/homepage/b ... kBlock.php
I just noticed at the top of the page that gets returned and on each line, there is supposed to be an icon
When I look at the image info for the icons, they seem to have a tangled url...
https://humdrums.net/WX/ocon/homepage/b ... /dark/.png

Not sure if nothing is being sent to DarkSky or if something is blocking the return info from DarkSky
or if it's trying to write to a folder that doesn't exist.
Maybe I have something out of whack in my initial setup or something inadvertantly disabled.

I hope someone has an idea or two that I could try......
HEALTH WARNING: Caution...these posts may contain traces of nut.
Image
My Meteotemplate Weather Station

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: Outlook block

Post by Jachym » Tue Mar 13, 2018 8:50 pm

Hi,

firstly - I deleted the link from your post as it contained your private API key

What I would do is wait to see if it is just a caching issue, alternatively it could be that your browser is able to load the data, but not your server, servers load a page slightly differently and it could be blocked too, it is very rare, but is possible

Post Reply