Buienalarm custom_component

Thanks Giel

There should be a new version available through HACS.

What’s the default scan_interval at the moment?
And what timeframe do you recommend with the default scan_interval?

Is there a way to get only notifications from a minimal value of rain?

I think the default scan_interval is 30sec
init.py

It depends if you want to know if it starts to rain within x minutes

Something like this?

  trigger:
    - platform: numeric_state
      entity_id: sensor.ba_precipitation
      above: xx
  action:
    - service: notify.mobile_app_xx

Thx @gieljnssns for this component, works nicely!

It looks like timeframe isn’t working… I always get the current precipitation, not the precipitation in 10 minutes from the current time.
Also scan_interval is 5 minutes (300 seconds), but I set it to 1 minute (60).
What’s going wrong?

My configuration:

  • platform: buienalarm
    timeframe: 10
    scan_interval: 60
    name: buienalarm
    monitored_conditions:
    • temperature
    • precipitation
    • precipitation_forecast_average
    • precipitation_forecast_total

That’s what I noticed as well. N is never >0.
It’s -1 or 0.

monitored_conditions
 - next_rain_forecast

values for next_rain_forecast can be:

  • -1 No rain forecast withing timeframe
  • 0 It is currently raining
  • N Rain is forecast within N minutes

@behtjes @erik7

Are you using the last version?
In fact scan_interval is useless, the data on the buien alarm website is refreshed in 5 minutes, but timeframe is working.
I made sensors with 15 and 30 minutes timeframe.

You can see those give different values.

This is my config

- platform: buienalarm
  timeframe: 15
  # name: buienalarm
  monitored_conditions:
    - temperature
    - precipitation
    - precipitation_forecast_average
    - precipitation_forecast_total
    - next_rain_forecast

- platform: buienalarm
  timeframe: 30
  name: ba_30
  monitored_conditions:
    - temperature
    - precipitation
    - precipitation_forecast_average
    - precipitation_forecast_total
    - next_rain_forecast

I used these files:

When I use your config, I get a config error on next_rain_forecast:

Invalid config for [sensor.buienalarm]: value is not allowed @ data['monitored_conditions'][4]. Got 'next_rain_forecast'. (See ?, line ?). Invalid config for [sensor.buienalarm]: value is not allowed @ data['monitored_conditions'][4]. Got 'next_rain_forecast'. (See ?, line ?).

What’s going wrong here?

You can install it through

1 Like

Shoot me. I’ve installed v 1.3 via HACS, used your config:

sensor:
  - platform: buienalarm
    timeframe: 15
    # name: buienalarm
    monitored_conditions:
      - temperature
      - precipitation
      - precipitation_forecast_average
      - precipitation_forecast_total
      - next_rain_forecast
  - platform: buienalarm
    timeframe: 30
    name: ba_30
    monitored_conditions:
      - temperature
      - precipitation
      - precipitation_forecast_average
      - precipitation_forecast_total
      - next_rain_forecast

And added it to my lovelace interface, but 15 and 30 minutes forecast / precipitation is exactly the same:

(the green line is behind the red one, you can’t see it in the picture, but it’s there)

The next_rain_forecast and precipitation should always be the same.

For the other sensors, can you wait for the next rain.
When you restarted HA it started to rain in 2 or 3 minutes, so the forecast_total on the next 15 and 30 minutes are the same…

I totally misunderstood the timeframe setting haha. I thought it would look for the precipitation 10 minutes from now with timeframe=10, and 30 when I set it timeframe=30.

I would like to create a trigger when the precipitation is for example >3mm 10 minutes from now. So not based on average or total.

My thought about the timeframe setting was exactly the same. :upside_down_face:
I removed the scan_interval and created sensors with 15 min timeframe.
I’ll keep an eye on it.

1 Like

@gieljnssns, I stumbled on your work by searching how to use Buienalarm in HA :slightly_smiling_face:
There are two GitHub repositories:

In one of the above posts I saw that I could install the custom component via HACS.
You should update the readme in both GitHub repos! :wink:
My config:

# Buienalarm
- platform: buienalarm
  timeframe: 15
  monitored_conditions:
    - temperature
    - precipitation
    - precipitation_forecast_average
    - precipitation_forecast_total
    - next_rain_forecast

This above config is in the sensor part of the configuration.

When HA is starting I see in the log that the custom_component buienalarm is starting and that a sensor.buienalarm is created.

2020-10-24 22:11:33 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for buienalarm which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experienc$
…
2020-10-24 22:11:33 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.buienalarm
...

But I don’t see the sensor in my list of available sensors…
In the lovelace screen I see : Entity not available: sensor.buienalarm

I verified if pybuienalarm is installed and yes it is.
Am I doing something wrong?

EDIT
Of course after posting, I saw that the sensor names are sensor.ba_xxxx
Maybe upgrading the docs could be helpful :wink:

@evb
I have changed the first post of this topic.
I have added a link to the custom_component repo that has to be installed trough HACS.
I’ve also added the default name in the readme of that repo

2 Likes

@gieljnssns, I still don’t think I fully understand how timeframe interacts with precipitation_forecast_average and precipitation_forecast_total.

Imagine that I look at all the sensor values at 08:00 and use a timeframe of 15.
My understanding is that the sensors will show:

  • precipitation: How hard it is raining at exactly 08:00 (shown in mm/h). This is not affected by timeframe.
  • next_rain_forecast: Also unaffected by timeframe. The description of this on is quite clear.
  • precipitation_forecast_total: I have no clue
  • precipitation_forecast_average: How hard it is predicted to rain at exactly 08:15 (shown in mm/h).

Alternative interpretations for the last two:

  • precipitation_forecast_total: How much it will rain in total between 08:00 and 08:15 (in mm).
  • precipitation_forecast_average: The total mentioned above divided by 15 minutes (therefore shown in mm/h)

Let me finish by giving you a big thanks for creating this!

It should be like this