Buienradar Rain 1d

QQ for verification: Buienradar has very many sensors, but I am interested in these:

  • Rain 1d, Rain 2d, Rain 3d, Rain 4d, Rain 5d

Are these backward looking? Meaning do they tell how much rain fell yesterday, day before yesterday, etc?

Looking to this to maybe assist me in determining whether to turn on sprinklers

According to the documentation these look forward. For backward values you can use the history of the Rain last 24h

Thanks, your empirical highness!

So this is a running total…

If I would like to 1) check every day at 20:00 (irrigation after dark, but to be decided when I’m still awake), what the 2) total rain was for the last 5 days. Preferably not by using an automation but by some sort of statistics sensor?

Hello Spiffo,

Personally, I look at yesterdays rain by storing the value in a helper just before midnight, then use that to vary the amount of time the sprinkler is on the next day. The compensation Integration calculates the number based on my parameters.
This is the 3 chunks of code for that:

I think this is possible with a statistics sensor like this:

sensor:
  - platform: statistics
    name: "Rain last five days"
    unique_id: uid_rain_last_five_days
    entity_id: sensor.rain_last_24h
    state_characteristic: sum_differences_nonnegative
    max_age:
      days: 5

This uses the “Rain last 24h” sensor from Buienradar, and sums all the values from the last five days.

Hmmm… I have to come back on this, because it isn’t functioning like I expected.
This statistics sensor works perfectly with my Netatmo rain sensor, but apparently the Buienradar 24h sensor behaves differently.
The Netatmo sensor counts the total precipitation for the current day, and this value is reset at 00:00 every day:

The statistics sensor handles that correctly, showing the total amount of precipitation for the last five days:

However, the Buienradar sensor gives the total amount of precipitation for each last 24 hours:

And the statistics sensor also counts the values when the amount goes down:

I did expect that only the values going up would be counted (nonnegative), but apparently it doesn’t work like that.

Perhaps it is possible to use the Buienradar sensor “Rain 1d” with a statistics sensor like this?
Anyhow, it of course is better to use real measured precipitation values, like with a Netatmo sensor, and not use predicted values like the Buienradar sensors.

Did you find a solution? Im facing the same issue.

I considered creating a helper that stores the maximum value of last 24hr, reset that daily, then use the sum_differences_nonnegative statistics sensor on that. But that wouldnt work either, because around midnight, the max of the past day would be applied to the current day as buienradar uses a rolling 24hr time window.

edit: I have a work around I think. Just create a helper that tracks total rainfall. Then an automation that runs once per day, that adds the rainfaill of the past 24 hr to that input number helper. Then you can use the statistics sensor on that helper to track the increment over the past x days.

Its not perfect, if its raining, it will only be correct the moment the helper is updated, 12 hours later it will not be updated with more recent rainfaill, but you can pick whatever time to run the automation, and thats good enough for my uses. I suppose you could also run an automation once per hour that looks at the “rain last hour” sensor if you need more granularity.

edit bis
This seems to work. Simple enough, runs every 30 minutes to increment a helper called “Total Rain” by half the value of “Rain Last Hour” (since that is also a rolling time window). Then you can configure a statistics sensor based on that

alias: Calculate total Rain
description: ""
triggers:
  - trigger: time_pattern
    minutes: /30
conditions: []
actions:
  - action: input_number.set_value
    metadata: {}
    data:
      value: >
        {{states('sensor.rain_last_hour') | float /2 +
        states('input_number.total_rain')| float  }}
    target:
      entity_id: input_number.total_rain
mode: single

As a test I created a statistical sensor from the Buienradar 1d sensor, using the sum_differences_nonnegative characteristic for the statistical sensor:

sensor:
  - platform: statistics
    name: "Rain 1d five days"
    unique_id: uid_rain_1d_five_days
    entity_id: sensor.rain_1d
    state_characteristic: sum_differences_nonnegative
    max_age:
      days: 5

This is the output from the Buienradar 1d sensor and the statistics sensor for the last two weeks:

It is shown that the Buienradar 1d sensor is not reset to zero every day, and the resulting statistics sensor does not give the correct output.

Like I wrote before, it of course is better to use real measured values, so I am now using the values from my own Netatmo Rain Today sensor to do the same.
This sensor indeed is reset to zero every night at 00:00
This is the result of the Netatmo Rain Today sensor and the statistical sensor for the last two weeks:

This statistical sensor indeed gives exactly the correct amount of rain that was fallen in the last five days.

So to correctly use this statistical sensor you indeed need a sensor that only is increasing during the day, and that is reset to zero at the end of each day.

You may have missed my updates. Ive made a sensor that calculates total cumulative rainfall based on buienradar 1h. Im pretty sure I can use that as base for a statistics helper to get rainfall in the last x days, but Ill need a bit more rainfall and data to be sure.

Yes, I did miss your second edit, but I don’t think it makes a difference to my response.
I suppose that you are referring to the Buienradar Rain last hour sensor?

It is not clear to me how often the Buienradar sensors are updated.
That could make a difference to the results that you get, doesn’t it?

Wouldn’t it be more easy to use the Buienradar sensor Rain last 24h as input?
You could write that value at 00:00 to the input_number sensor, and than use that input_number as input for the statistical sensor?

Something like this for the automation:

alias: Calculate total Rain
description: ""
triggers:
  - trigger: time
    at: "00:00:00"
conditions: []
actions:
  - action: input_number.set_value
    metadata: {}
    data:
      value: >
        {{ states( 'sensor.rain_last_24h' ) | float(0) }}
    target:
      entity_id: input_number.total_rain
mode: single

And then for the statistical sensor:

sensor:
  - platform: statistics
    name: "Rain last five days"
    unique_id: uid_rain_five_days
    entity_id: input_number.total_rain
    state_characteristic: sum_differences_nonnegative
    max_age:
      days: 5

I did set this up now as well, so lets wait and see what the results will be compared to my own Netatmo sensor results.

I have to come back on this, because it appears that many of the Buienradar weather stations do not provide the Rain Last 24h data, although these sensors are delivered (deactivated by default) by the Home Assistant Buienradar Integration.
Originally I did use my own GPS location for the Buienradar sensors, and therefore the chosen weather station was Stavoren. However, it appears that this weather station does not provide the Rain Last 24h data.
So I now have chosen to use the Leeuwarden weather station instead, which is on a larger distance, but does provide the Rain Last 24h data.
I had to start from scratch with the statistical sensor, so again have to wait now to see what the result will be compared to the Netatmo sensor.

To check for the availability of the Rain Last 24h data you can have a look at the Buienradar JSON feed, and search for the rainFallLast24Hour data under actual → stationmeasurements

“rain last hour” is updated every 10 minutes for me.

You could, but in fringe cases it wouldnt be accurate, since the sensor only updates every day. So if there is a microburst at 6am, my sprinklers might still think it has rained in 5 days. Of course you could check for that, but I think my solution is simpler and more universal.