Buienalarm custom_component

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

Many thanks Giel!
I just want to correct myself as for the average I forgot to multiply by 60 minutes. The correct definition is:
precipitation_forecast_average: The total mentioned above divided by 15 minutes (therefore shown in mm/h) multiplied by 60 minutes.

These are the definitions I created for myself:
- temperature #what is the temperature right now
- precipitation #How hard it is raining right now (shown in mm/h). This is not affected by timeframe.
- precipitation_forecast_average #How much it will rain in total between right now and selected timeframe (in mm).
- precipitation_forecast_total #The total mentioned above divided by timeframe and multiplied by 60 minutes (therefore shown in mm/h)
- next_rain_forecast #-1 means no rain forecast within timeframe, 0 means it is currently raining, N means rain is forecast within N minutes. Impact of timeframe: if you set timeframe to 15 and it will rain in 16 minutes, the value will be -1 and then become 15 one minute later.

is there a way to get the times in the further? as the timing now doesn’t make sense…

exactly this. I’m looking for a graph which can display the upcoming rain, like the android app does.

e.g.:

tried several thins, but i don’t want the iframe work-around…

See here: Custom UI: Buienradar rain forecast graph
Best to use Spudjes updated version, down in the thread.

I have just installed this component a few days ago and noticed something odd.

It almost seems like the next_rain_forecast is always showing a value of “2021 min.” when rain is forecasted and it shows “Unknown” when there is no rain.

Has anyone seen this before? Any thoughts?

1 Like

Same here i reverted back to version 1.6

I am getting a lot of Bad Gateway errors in the log. Anyone else getting this?

Logger: custom_components.buienalarm
Source: helpers/update_coordinator.py:200
Integration: buienalarm (documentation)
First occurred: July 31, 2021, 13:18:10 (113 occurrences)
Last logged: 08:23:23

Same problem here, uninstall for now It makes HA very slow

Is there a solution on how @JJFourie did the bottom part of his setup with the picture element?

Hi I`m really new with this. I have installed buienalarm via ssh and the custom component via hacs. I also added the sensor template in configuration.yaml however am getting an error on restart:

ValueError: Template error: as_timestamp got invalid input 'unknown' when rendering template '{% if as_timestamp(states('sensor.buienalarm_next_rain_forecast')) %}
  {{ ( ( as_timestamp(states('sensor.buienalarm_next_rain_forecast')) - as_timestamp(now()) ) / 60 ) | round }}
{% else %}
  {{ states('nonexistent') }}
{% endif %}' but no default was specified

No clue what I did wrong.

@Culemsao
In my configuration.yaml file I have an entry

template: !include templates.yaml

In that templates.yaml file I’ve created the following:

- sensor:
    - name: "Buienalarm Next rain forecast (min)"
      unique_id: buienalarm_next_rain_forecast
      device_class: duration
      unit_of_measurement: m
      state: >
        {% if states('sensor.buienalarm_next_rain_forecast')=="unknown" %}
          {{ 0.0 }}
        {% else %}
          {{((as_timestamp(states('sensor.buienalarm_next_rain_forecast'))-as_timestamp(now()))/60)|round(2)}}
        {% endif %}
      icon: >
        {% if states('sensor.buienalarm_next_rain_forecast')=='unknown' %}
        mdi:weather-cloudy
        {% else %}
        mdi:weather-rainy
        {% endif %}

If your configuration.yaml entry is like “template:” then you create the sensor under that “branch” like such:

template:
  - sensor:
      - name: "Buienalarm Next rain forecast (min)"
        unique_id: buienalarm_next_rain_forecast
        device_class: duration
        unit_of_measurement: m
        state: >
          {% if states('sensor.buienalarm_next_rain_forecast')=="unknown" %}
            {{ 0.0 }}
          {% else %}
            {{((as_timestamp(states('sensor.buienalarm_next_rain_forecast'))-as_timestamp(now()))/60)|round(2)}}
          {% endif %}
        icon: >
          {% if states('sensor.buienalarm_next_rain_forecast')=='unknown' %}
          mdi:weather-cloudy
          {% else %}
          mdi:weather-rainy
          {% endif %}

Hi all,

I’m also really new to Home Assistant. But I’d really like the integration of Buienalarm. Anybody created a good automation on this sensor to check if it will go rain? I don’t want to be disturbed via messages (notify service) every minute of course when it will start raining :slight_smile:

Hopefully somebody has a good idea or has something implemented already.

Regards,
Pieter