WeatherFlow API - 2 useful Scripts in PHP
(Another donateWare script from MRE Software)

 

(1.) My old weather station doesn't have any solar sensors for UV Index, Luminance, or Irradiance but my neighbor recently installed a WeatherFlow Tempest station that does.  With her permission I am accessing the solar values from her station and displaying them on my weather site.  I decided to publish the PHP script below that I am using to accomplish this task.  It was written specifically to access the solar data but should serve as a template for anyone wanting to access the API and pull any observation data.  For more information about the WeatherFlow API and how to obtain an access token click this link: https://weatherflow.github.io/Tempest/api/

This script returns a Javascript document.write() statement containing the value requested.  Example usage in html page: <script type="text/javascript" src="UV_js.php?val=lum"></script>


(2.) The second script is designed to run as a cron job every 10 minutes or so.  What it does is read the current conditions from the WeatherFlow API, translates them, and sends the results to PWSweather.com in their station format.  It creates a way to add your tempest station to PWSweather.com.  In order to use this script you will need three things. 1. Access to the WeatherFlow API.  2. A weather station setup on PWSweather.com.  3. A computer or web server that can run a cron job written in PHP.

You enter your credentials for both the WeatherFlow API and the PWSweather.com station into the script and set it up to run as a cron job every 10 minutes.  You also need to create a folder named tmp in the same folder where the script is installed and give it write permissions (755) on your server.  If you install it in the same folder as the script above they can share the tmp folder and also the cache file.


 
 

 
If you find this code of value, donate a little to the cause.  Think of the time you just saved!
USE AT YOUR OWN RISK!

Questions / Comments?  Email me.

MRE Logo