PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)

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

PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)

Post by MonyMony » Wed Nov 27, 2019 2:00 am

Hello All,

While I cringe with what has become of WeatherUnderground these days, there was one block I did like to use on my homepage that pulled WU data to show both my dad and father-in-law weatherstations. The PartnerStation block was a quick way to show this information so I spend a little time and reworked a bit of Jachym's code to make it compatible with the recent changes. The changes update the URL the codes uses along with changes for the new XML format WU puts out. I also added to the path the required API key variable you now need to gather the data.

To use this you can just replace your existing v3.0 version of the partnerStationBlock.php file with the attached update (other files in the block remain the same). Just remember that you need to make sure that in your Meteotemplate Main Setup configuration settings that you include your WU API key. If you upload your data to WU then this key is free and available under your account information.

Maybe this might be of use to someone. Enjoy!

p.s. To see an example of this block 'in action' check out my site (www.cecilweather.com) and look to the bottom-left of the page.
Attachments
partnerStationsBlock.php.zip
Update partnerStationBlock.php file
(2.81 KiB) Downloaded 134 times
Last edited by MonyMony on Wed Feb 26, 2020 1:28 pm, edited 1 time in total.
Image

User avatar
John B
Forecaster
Forecaster
Posts: 211
Joined: Sun Aug 20, 2017 11:59 pm
Location: Blaxland, N.S.W., Australia
Station model: La Crosse WS2355
Software: Weather Display
Contact:

Re: PartnerStation Block - Fixes for WU API Changes

Post by John B » Thu Nov 28, 2019 1:25 am

Blimey, MonyMony, IF it helps someone? It certainly did for this little black duck.

Thank you, sir, for your time and trouble in researching the WU site and then amending the Meteotemplate file to suit. Your amended file worked 'out of the box' for me. I have only two 'partner' stations, one of which is that of my son (who lives about 750 metres above me farther up the mountains) and an old acquaintance's site (who runs one of the local official sites for the Australian Bureau of Meteorology); I am ever so pleased to regain access to their data within Meteo Template.

Again, my thanks.

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

Re: PartnerStation Block - Fixes for WU API Changes

Post by MonyMony » Sat Dec 07, 2019 3:05 pm

John B,

Glad my edits were helpful for someone!

It sounds like you just as I have two partner sites you typically display. While not included in my original upload, I did make a small edit so that the block shows both of my partner sites by default (i.e. the 'ALL' option). I did this by going to the end of the partnerStationBlock.php code and making the following changes:

Original Code:

Code: Select all

	<script>
		$("#partnerStationSelector").change(function(){
			id = $("#partnerStationSelector").val();
			if(id != "all"){
				$(".partnerStationClass").hide();
				$("#partnerStation" + id).show();
			}
			else{
				$(".partnerStationClass").show();
			}
		})
		$("#partnerStationSelector").val(0);
		$("#partnerStation0").show();
	</script>
Updated Code:

Code: Select all

	<script>
		$("#partnerStationSelector").change(function(){
			id = $("#partnerStationSelector").val();
			if(id != "all"){
				$(".partnerStationClass").hide();
				$("#partnerStation" + id).show();
			}
			else{
				$(".partnerStationClass").show();
			}
		})
		$("#partnerStationSelector").val('all');
		$(".partnerStationClass").show();
	</script>

The key points are to change the line $("#partnerStationSelector").val(0); to $("#partnerStationSelector").val(all); (This is the drop-down list entry) and to change the next line from $("#partnerStation0").show(); to $(".partnerStationClass").show();.

Figured I would pass this on as well.

Jay

After Code Update
After Code Update
Screen Shot 2019-12-07 at 10.01.31 AM.png (91.11 KiB) Viewed 5688 times
Image

MJW
Advisor
Advisor
Posts: 60
Joined: Sun Dec 24, 2017 2:22 pm
Station model: AW WS-2000ish
Software: Meteobridge/OIP/GW-1000
Contact:

Re: PartnerStation Block - Fixes for WU API Changes

Post by MJW » Fri Feb 07, 2020 2:10 pm

Thanks for this, I will be implementing it on my site soon. Quick question - are you using a custom RadarUS block? I like how yours includes the WU and visible satellite images but that does not appear in the stock block. If so, do you mind sharing?

thx

Mike
MonyMony wrote: Wed Nov 27, 2019 2:00 am Hello All,

...

Maybe this might be of use to someone. Enjoy!

p.s. To see an example of this block 'in action' check out my site (www.cecilweather.com) and look to the bottom-left of the page.
So many trees in NJ!

Image

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

Re: PartnerStation Block - Fixes for WU API Changes

Post by MonyMony » Tue Feb 25, 2020 2:39 pm

MJW wrote: Fri Feb 07, 2020 2:10 pm Quick question - are you using a custom RadarUS block?
Hi Mike,

The answer is 'kind of'. I changed a bunch of the links back with the new GOES satellites went online and got creative with some of the other links. Its been a while but I take a look at what I changed and try and post my suggestions soon.

Jay
Image

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

Re: PartnerStation Block - Fixes for WU API Changes

Post by MonyMony » Wed Feb 26, 2020 1:27 pm

Hi Mike,

I am attaching my modified radarUSBlock.php file to use as a reference. If you look to lines 86 thru 116 you can see the modifications I made for the drop-down lists. Most of the images come from https://cdn.star.nesdis.noaa.gov which if you poke around has a lot of options to pick from. The only non-public link I have is one from WeatherUnderground but as I still contribute data to them I believe it is still 'kosher' to link to (at least it used to be unless they changed something).

The odd thing with this block file is you have to made these modifications four times in the code as there are separate entries for each possible position/layout of the block. If you scroll down you will see things repeating and just have to repeat the same modifications for each section.

Hope this helps!

Jay
Attachments
radarUSBlock.php.zip
radarUSBlock.php with dropdown modifications
(7.33 KiB) Downloaded 93 times
Image

User avatar
John B
Forecaster
Forecaster
Posts: 211
Joined: Sun Aug 20, 2017 11:59 pm
Location: Blaxland, N.S.W., Australia
Station model: La Crosse WS2355
Software: Weather Display
Contact:

Re: PartnerStation Block - Fixes for WU API Changes

Post by John B » Sat Mar 07, 2020 2:42 am

MonyMony wrote: Sat Dec 07, 2019 3:05 pm I did this by going to the end of the partnerStationBlock.php code and making the following changes:

Original Code:

Code: Select all

	<script>
		$("#partnerStationSelector").change(function(){
			id = $("#partnerStationSelector").val();
			if(id != "all"){
				$(".partnerStationClass").hide();
				$("#partnerStation" + id).show();
			}
			else{
				$(".partnerStationClass").show();
			}
		})
		$("#partnerStationSelector").val(0);
		$("#partnerStation0").show();
	</script>
Updated Code:

Code: Select all

	<script>
		$("#partnerStationSelector").change(function(){
			id = $("#partnerStationSelector").val();
			if(id != "all"){
				$(".partnerStationClass").hide();
				$("#partnerStation" + id).show();
			}
			else{
				$(".partnerStationClass").show();
			}
		})
		$("#partnerStationSelector").val('all');
		$(".partnerStationClass").show();
	</script>

The key points are to change the line $("#partnerStationSelector").val(0); to $("#partnerStationSelector").val(all); (This is the drop-down list entry) and to change the next line from $("#partnerStation0").show(); to $(".partnerStationClass").show();.
It's taken some months to get around to this modification, Jay, but it works like a charm. Thanks again for your efforts.

John

PCW
Observer
Observer
Posts: 41
Joined: Sat Mar 23, 2019 2:03 pm
Location: Covington, WA USA
Station model: Davis Pro2
Software: Meteobridge
Contact:

Re: PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)

Post by PCW » Sun Mar 08, 2020 6:42 pm

HI Jay,
Really like the modified radarUS block!! I think I made all the proper changes so it would display Geos 17 PNW satellite image/data.
I tried to modify the WU radar image so it would display the Seattle area rather than Dover. Can't seem to find the correct syntax. Need some help please.
How do you get the drop down menu to display "Visible Satellite-Pacific NW" since this is the default image?
When you have time.
Thanks
Paul
Image

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

Re: PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)

Post by MonyMony » Thu Mar 12, 2020 12:59 pm

PCW wrote: Sun Mar 08, 2020 6:42 pm When you have time.
Hi Paul,

When I can I will look at this. Crazy times with cancelling work trips due to CoVID-19 and dealing with the ramifications.

Jay
Image

MJW
Advisor
Advisor
Posts: 60
Joined: Sun Dec 24, 2017 2:22 pm
Station model: AW WS-2000ish
Software: Meteobridge/OIP/GW-1000
Contact:

Re: PartnerStation Block - Fixes for WU API Changes

Post by MJW » Thu Apr 02, 2020 1:29 pm

Thanks Jay, I will take a look at this and get it implemented on my site soon.
MonyMony wrote: Wed Feb 26, 2020 1:27 pm Hi Mike,

I am attaching my modified radarUSBlock.php file to use as a reference.
...
Hope this helps!

Jay
So many trees in NJ!

Image

Milt
Newbie
Newbie
Posts: 1
Joined: Sun Aug 16, 2020 3:43 am
Station model: AcuRite 5 in 1
Software: WU

Re: PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)

Post by Milt » Mon Sep 14, 2020 7:55 pm

Here is a little different look for Partner stations you might like!

https://www.mpgj.com/template/indexDesktop.php

Post Reply