Author Topic: Integrate meteobridge live data to WordPress blog  (Read 1029 times)

0 Members and 1 Guest are viewing this topic.

Offline fuerteventuraplayas

  • Member
  • *
  • Posts: 1
    • fuerteventuraplayas.com
Integrate meteobridge live data to WordPress blog
« on: March 31, 2023, 02:04:07 PM »
Hi,
I have a Davis Vantage Vue weather station connected to Meteobridge PRO.
At the moment I can see data on meteotemplate and on windguru.

What is the best way to integrate the live datas to a WordPress blog?

Offline jasonmfarrow

  • Member
  • *
  • Posts: 10
  • JMFweather
    • JMFweather
Re: Integrate meteobridge live data to WordPress blog
« Reply #1 on: May 05, 2023, 09:01:38 AM »
It is possible...but takes some custom effort. I have not found a generally available widget or plugin for Wordpress that will take a feed from Meteobridge or elsewhere and display this on Wordpress. There are weather plugins but they will use publicly available data.

If you are using Brian's Weather34 Template (mentioned elsewhere on this website and on https://forum.meteohub.de/viewforum.php?f=56) then you can use the already uploaded weather data in conjunction with a plugin like "Insert PHP Code Snippet". (note: using dodgy PHP code in that plugin can crash your Wordpress site. Recovery could be interesting.)

With the right PHP code (the example below uses an edited snippet from the Weather34 template) you can read the weather data and present whatever data you wish. e.g.
Code: [Select]
<?php 
########################################################
# CREATED FOR WEATHER34 Aurora MKII TEMPLATE                                                                                                                           
Release: December 2020 Version Aurora MKII. Revised: January 2022                                               
########################################################
$livedata "../mbridge/MBrealtimeupload.txt";
$file_live file_get_contents($livedata);
$meteobridgeapi explode(" "$file_live);
$meteobridgeapi str_replace("--""0.0"$meteobridgeapi);
 
$year substr($meteobridgeapi[0], 6);
$weather["temp"]               = $meteobridgeapi[2];
$weather["humidity"]           = number_format($meteobridgeapi[3], 0);
$weather["wind_speed"]         = $meteobridgeapi[5];
$weather["wind_gust_speed"]    = $meteobridgeapi[6];
$weather["wind_direction"]     = number_format($meteobridgeapi[7], 0);
$weather["rain_rate"]          = $meteobridgeapi[8];
$weather["barometer"]          = $meteobridgeapi[10];
$weather["wind_speed_bft"]     = $meteobridgeapi[12];
$weather["barometer_units"]    = $meteobridgeapi[15];
$weather["rain_units"]         = $meteobridgeapi[16]; 
$weather["rain_today"]         = $meteobridgeapi[9];
$weather["rain_lasthour"]      = $meteobridgeapi[47];
$weather["rain_month"]         = $meteobridgeapi[19];
$weather["rain_year"]          = $meteobridgeapi[20];
$weather["temp_units"]         = "C"

$recordDate mktime(substr($meteobridgeapi[1],0,2),substr($meteobridgeapi[1],3,2),substr($meteobridgeapi[1],6,2),substr($meteobridgeapi[0],3,2),substr($meteobridgeapi[0],0,2),$year);
$weather["date"]               = date("Y-m-d"$recordDate);
$weather["time"]               = date("h:i:s"$recordDate);

echo 
"<p>Date: ".$weather["date"]." Time: ".$weather["time"];
echo 
"<p>Temperature: <b>".$weather["temp"]."</b> ".$weather["temp_units"];
echo 
"<p>Humidity: <b>".$weather["humidity"]."</b>%";
echo 
"<p>Pressure: <b>".$weather["barometer"]."</b> ".$weather["barometer_units"];
echo 
"<p>Rain Today: <b>".$weather["rain_today"]."</b> ".$weather["rain_units"];
echo 
"<p>Rain this Month: <b>".$weather["rain_month"]."</b> ".$weather["rain_units"];
echo 
"<p>Rain this Year: <b>".$weather["rain_year"]."</b> ".$weather["rain_units"];
echo 
"<p>Wind Speed: <b>Force ".$weather["wind_speed_bft"]."</b>, Direction: <b>".$weather["wind_direction"]."</b>&deg;";

?>

As long as you can get some weather data exported to your wordpress website (in a readable format) then it will be possible to input and present that data.

Formatting and further clever things requires more coding and experimentation. If you are not a coder and knowledgable about the inner workings of Wordpress then this may be beyond you.
JMFweather.uk

Offline WsGraveNL

  • Member
  • *
  • Posts: 7
Re: Integrate meteobridge live data to WordPress blog
« Reply #2 on: July 18, 2023, 12:25:01 AM »
Hey guys, I have a Wordpress website and a Vantage Pro 2 with Meteobridge uploadserver.
I have created my own html (template) pages, where I use the codes for the different weather data.
Meteobridge uploads those templates with the codes replaced by the actual data and the html page is uploaded to a seperate folder on my website, for example domein.com/weather2/.
Then I use the Pageview plugin to embed those pages into a Wordpress page.
Works fine for me and I have all liberty I want to display my data.
The same way I created a small widget with temp, pressure, rainfall, etc. and I also created a few pages for mobile viewing.
Like I said, much freedom in how you use it.

There is also a pugin Weather Station that allows you to show the data of your weather station, but it saves all data to the WP database and I didn't want that (because of the size of my website (not only weather)). But maybe it's a solution for you?

Good luck with your project !

Offline jasonmfarrow

  • Member
  • *
  • Posts: 10
  • JMFweather
    • JMFweather
Re: Integrate meteobridge live data to WordPress blog
« Reply #3 on: July 18, 2023, 04:43:14 AM »
Sounds great. Can you point us to your website so we can see the output, please.
JMFweather.uk

Offline WsGraveNL

  • Member
  • *
  • Posts: 7
Re: Integrate meteobridge live data to WordPress blog
« Reply #4 on: July 18, 2023, 05:10:15 AM »
This is the frontpage of my weather website (weerstation Grave):
(the page starts with a synopsis (written weather description with Meteobridge data)
https://www.bommeltje.nl/website/weerstation-grave/

This is the next page with detailed weather data:
https://www.bommeltje.nl/website/weerstation-grave/actueel/

and on all the other pages I have a small widget with most recent weather data for temp, pressure, rain, etc.
See for example this page: https://www.bommeltje.nl/website/weerstation-grave/wolken-atlas/

I also have some Meteobridge graphs on this page:
https://www.bommeltje.nl/website/weerstation-grave/weergrafieken/

 

anything