Dutch precipitation forecast based on buienradar.nl

Part of an on-going process of learning Python I made a small python3 module that gets the GPS location based precipitation forecast provided by buienradar.nl

Combined with some python mqtt code i now have a MQTT sensor that will notify me if there is significant precipitation in a configurable future.
I plan to use this in my irrigation systems next summer :slight_smile: but the uses for this are not limited to thisā€¦

I now there are similar solutions, but for me the buienradar.nl predictions have proven to be the most accurateā€¦

python module and MQTT example can be found here:

*** feedback on the module is appreciated!
**** next i will try to make a HASS sensor based on this

6 Likes

Nice work Koen,
Ik ga het proberen :slight_smile: Bedankt voor het gedane werk.

Cool (Koel!). I was looking for something like this for my irrigation. As I have no idea how to use it like it is now, I will wait for a HASS sensor

Initial sensor is working as of yesterday :slight_smile:
if i find out how to get the lat & long from the hass config and read a config key from the configuration.yaml i will release something on my github page.

planning within a week or so.

My native hass sensor is ready :slight_smile:

Add the following file to your custom_components/sensor/ directory:

and add this to your configuration.yaml

sensor:
  platform: buienradar
  name: "Buienradar"
  timeframe: 3600

name: = friendly name
timeframe: = somewhere between 300 (seconds) and 7200 (seconds)

the update interval is 5 minutes

1 Like

new version!!
better calculations, if f*ckd up the rounding (i rounded before calculating averages).

place the buienradar.py in the custom_components/sensor directory and restart hass.
the new python module (pybuienradar v.0.5) will be loaded automatically.

1 Like

@Koen: would love to use this, but need a bit more help (Iā€™m new). Installed HA on a Raspberry using the all-in-one installer. Where do I put the buienradar.py file? Donā€™t have this custom_component directory. Thanks

@Felix
if you changed nothing with the all in one installer the custom_components directory will be in /home/hass/.homeassistant/

you can make it by doing a
sudo mkdir -p /home/hass/.homeassistant/custom_components/sensor

hi @koen01

nice project. even more nice that buienradar also gives data for Germany. (and more i didnt check)
i made the buienradar.py in the custom component dir, but the configuration in the yaml seems to give me trouble.

if i put this:

sensor:
  platform: buienradar
  name: "Buienradar"
  timeframe: 3600 

in my config or this:

sensor 5:
  platform: buienradar
  name: "Buienradar"
  timeframe: 3600

all my sensors disappear

i also tried this:

  - platform: buienradar
    name: "Buienradar"
    timeframe: 3600

in my sensors.yaml but gives the same problem.

i am not sure where i go wrong.

@ReneTode
Thatā€™s not supposed to happen.
What does the log file say?
Is the file in the ā€˜sensorā€™ directory of custom_components?

If so:
I suspect the pybuienradar.py module isnā€™t downloaded / installed correctly.

i suspected something like that too.
so i dowloaded pybuienradar and run the setup.

i changed my logger so i could see error and it gives:

16-10-20 22:28:16 homeassistant.loader: Unable to find component sensor.buienradar
16-10-20 22:28:16 homeassistant.bootstrap: Unable to find platform sensor.buienradar
16-10-20 22:28:16 homeassistant.loader: Unable to find component sensor.buienradar
16-10-20 22:28:16 homeassistant.bootstrap: Unable to find platform sensor.buienradar

I what directory did you put the buienradar.py file?

the buienradar.py is in the custom_components dir.

You must put in in a sub folder named sensor

https://raw.githubusercontent.com/koen01/hass/master/custom_components/sensor/buienradar.py

thx. that did the trick :wink:

you have a setting timeframe.
what does it exactly set? the amount of time in advance, or the amount of time it will measure the rain expectation, or ā€¦?

i just want to know exactly how to interpret the mm/H

Iā€™m struggling with that too to provide useful data.
For now itā€™s the average rain within the timeframe
ā€œā€ā€˜time the sensor is updatedā€™ + seconds in timeframe value.""

I.e : Timeframe 600 will give you the average (and total) mm/h within the next 10 minutes after last updating the sensor.

I use the data thatā€™s also visible in the horizontal graph on their website:

thx. thats usefull info.

i dont see that graph on my pc but i guess it gives the data anyway :wink:
right now i have it set to 3600 so if i am correct the value it gives would be the amount off mm i can expect in the next hour.

lets see if it is a bit accurate for this region too :wink:

in the near future i will get an rainmeter too, so then i can really compare things :wink:

if they are a bit accurate maybe in the future you could expand youre code to give the temp, felt temp and amount of sun also :wink:

youre code has a hardcoded 5 min check time.
cant you change that to set the time in the yaml?

@koen01 Thanks! Getting the file in the right directory did the trick. Works great (in Germany).I understand your calculation logic!

Does this sensor take the coordinates (lat, long) from the configuration file or do we have to input them manually somewhere

they are taken from the config file.

I thought about making this an option but opted for this method.
Reasoning behind this was, why would you need to monitor precipitation for homeautomation purposes at another location than home?

If i ever find time to adjust the code that you can add multiple buienradar sensors than this will have to change :slight_smile:

@ReneTode; i chose the hardcoded update time because the sourcefile is (only) updated every 5 minutes.