Buienradar, a Dutch website who provide weather forecasting and radar images (for The Netherlands only). They have a seperate page for providing such data, for free, at your own website (non-commercial). Besides the out-of-the-box images (gif), or XML, the precipitation forecast can be viewed as well, based on your coordinates/location. Your coordinates (longitude/latitude) can be found easily on Google maps. Find your location on Google Maps and get the LAT and LON values from the url in the address bar. For the script below, get all decimal values as displayed in the url, just 2 decimal values is not enough to measure your exact location.

For a long time, I’m using the free plugin of “Stefxx” in Homeseer 3, to retrieve the Buienradar precipitation forecast. in most of the cases it’s working fine. Sometimes with violent forecast, the plugin receive incorrect data for unknown reason, maybe because the hostingserver of Buienradar will get many request from other users, and can’t provide data at that moment…I’m not sure.

Main reason the get rid of this plugin is that Buienradar is changing the weburl from time to time (which is providing the forecast data). When I use the Homeseer plugin, I’m not able to switch to another url. When I’m in charge of my own script, I can check the output of the weburl and act on that (switch to another url, etc). Benefit of this script, is to extend my programming skills for several languages, use external data, and creating charts for it.

Let’s start

It’s all starting with having your coordinates (latitude and longitude). As writte above, you can find it for example on Google Maps. Copy the two decimals values (use as much as possible the decimal digits !!) after the @ sign from the url.

An example could be as:

  • https://www.google.nl/maps/@52.2662487,5.1394323,10z
  • where lat = 52.2662487
  • where lon = 5.1394323

The currenly provide weburl is: https://gpsgadget.buienradar.nl/data/raintext?lat=51&lon=3, (I’m using the example here form the Buienradar website itself, so no decimals are used here). The result of the url will be something like:

057|22:50
057|22:55
057|23:00
057|23:05
057|23:10
057|23:15
035|23:20
057|23:25
035|23:30
035|23:35
035|23:40
035|23:45
035|23:50
057|23:55
057|00:00
035|00:05
035|00:10
035|00:15
035|00:20
000|00:25
000|00:30
000|00:35
000|00:40
000|00:45

The first 3 digits will present the precipitation/rain forecast. Followed by the More/dividing character, the last 5 characters mention the timestamp for that precipitation forecast (in 24 hours timestamp))

  • Value 000 means zero precipitation.
  • Value 255 means violent precipitation.

The forecast value has to be recalculated to the millimeter per hour (mm/h). They provide a formula for this:  “10^((value-109)/32)“. To check your formula: value 77 should result in a 0.1 mm/h.

Scripting

The purpose of the script is to define:

  • The formula to recalculate into mm/h
  • The first start of the precipitation, which will result in a timestamp (precipitation > 0)
  • Intensity of the forecast (none, low, average, hard or violent)
  • The minmum rain forecast in mm/h
  • The maximum rain forecast in mm/h
  • An array will be created for mm/h values and timestamp, so it can be used in one of many free tools to create charts (Google Charts, Highcharts, CanvasJS, etc)

At the bottom of the page, the php script files can be downloaded. Besided the php script a local javascript file could be necessary. I’m using CanvasJS for created the chart, and because of using the local file, you don’t see the “Trial version” in the bottom left corner of the chart. In case you want to use the external js file, just uncomment the external link and comment the local file.

In the script, $debug variable is set to 1, so it will show some data, as provided in above bullit list

In case you want to use an external plaform to save you variables to (Homeseer, Domoticz, etc), you have to set the varibale $homeseer to value 1 and change the param1 values (device-reference) accordingly en for non Homeseer, the urls has to be changed too ofcourse.

I’ve added as many comment as necessary.

The chart will be generated automatically and is saved too to your default browser download folder.

Rainfall

Improvements to do

  • Currenlty I’m not able to manage it to have a change in the storing location of the chart image by the script. I actually want to save it somewhere on the server (locally) and delete the file when the script is started, so the filename remain te same and don’t extend the name with an increased counter (Buienradar (1).png).
  • Check the several mention websites at top of the script and act on result. If an url don’t provide the requested data, check the next website, etc.

Downloads:

  Buienradar.zip (3.0 KiB, 637 hits)

 

Source: Buienradar: https://www.buienradar.nl/overbuienradar/gratis-weerdata

 

Privacy Preference Center