Get radar forecasts

Use this action to get the rain radar forecast for one of your IRM KMI weather entities. Each entry is one radar frame with the expected rain rate, so you can see whether rain is coming and how heavy it will be.

The regular forecast from weather.get_forecasts covers hours and days. This action only covers precipitation, with one entry per radar frame. Use it for short-term decisions, for example to skip watering the garden when a shower is coming.

This action returns data that you can use in later steps of the same automation or script.

Using this action from the user interface

If you prefer building automations and scripts visually, Home Assistant walks you through this action step by step. You pick what to target, tweak a few options, and save. No YAML knowledge required.

To get the radar forecast from an automation or a script:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation or script, or select Create automation > Create new automation.
  3. If you’re setting up a new automation, add a trigger in the When section. Scripts don’t need a trigger. They run when something else calls them.
  4. In the Then do section, select Add action.
  5. Select what you want to control. Under By target (see Targets), pick the IRM KMI weather entity you want the forecast for.
  6. From the actions shown for that target, select Royal Meteorological Institute of Belgium: Get radar forecasts.
  7. In the Response variable field, enter a name to store the data in, such as radar.
  8. Select Save.

Options in the UI

Include past forecasts (Optional)

Whether to also return the radar frames before the current one. The current frame is always returned. Disabled by default.

Using this action in YAML

If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required. For how an automation or a script is built in YAML, refer to Automations in YAML and Scripts.

In YAML, refer to this action as irm_kmi.get_forecasts_radar. Because it returns data, store the result in a response variable so you can use it in later steps:

ActionAn action makes Home Assistant do something, for example, turn on a light, send a notification, or activate a scene. Automations and scripts run a list of actions. [Learn more]
action: irm_kmi.get_forecasts_radar
target:
  entity_id: weather.brussels
response_variable: radar

This stores the radar forecast for weather.brussels in radar.

Options in YAML

include_past_forecasts boolean (Optional, default: false)

Whether to also return the radar frames before the current one. The current frame is always returned.

Targets of the action

This action requires a target. The target is the object of the action. You can point the action at a single entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more], a device, an area, a floor, or a label, and Home Assistant will run the action on every matching IRM KMI weather entity behind that target.

  • Entity: one specific IRM KMI weather entity, such as weather.brussels.
  • Device: every IRM KMI weather entity that belongs to a device.
  • Area: every IRM KMI weather entity in a room or area.
  • Floor: every IRM KMI weather entity on a floor.
  • Label: every IRM KMI weather entity that shares a label.

You can also select different target types in one action. For example, you can add a specific entity and an area as targets in the same action to run the action on both of them at once.

To learn which entities Home Assistant includes for a device, area, floor, or label, and how it handles several entities, refer to Automation targets.

To leave out some of these entities, refer to Excluding targets. For example, you can leave out one IRM KMI weather entity in an area.

Response data

This action always returns data, so the response variable is required. If you leave it out, the action fails when it runs. Use the response variable to store the data for later steps of the same automation or script. For details, refer to Action response data.

The response is keyed by the entity ID of each targeted weather entity. For every entity, the response contains a forecast list with one entry per radar frame, oldest first. Each entry has these fields:

  • datetime: when the radar frame starts.
  • precipitation: the expected rain rate, in mm/h. It is null when the provider reports no rate for the frame.
  • rain_forecast_min and rain_forecast_max: the lower and upper bound of the expected rain rate, in mm/h.
  • might_rain: whether rain is possible during the frame.
  • unit: the unit of the rain rates, mm/h.

A shortened example response looks like this:

weather.brussels:
  forecast:
    - datetime: "2023-12-28T15:10:00+01:00"
      precipitation: 0.6
      rain_forecast_min: 0.3
      rain_forecast_max: 0.9
      might_rain: true
      unit: mm/h
    - datetime: "2023-12-28T15:20:00+01:00"
      precipitation: 0.3
      rain_forecast_min: 0.0
      rain_forecast_max: 0.6
      might_rain: true
      unit: mm/h

Good to know

  • Without past forecasts, the first entry is the radar frame that covers the current time. Its datetime is the start of that frame, so it can be several minutes in the past.
  • Frames are 10 minutes apart in Belgium and Luxembourg, and 5 minutes apart in the Netherlands. Don’t count on a fixed number of frames.
  • The action uses the radar data from the last update of the integration. It does not send a new request to the provider.
  • If the provider has no radar data for the location, the action fails with the error “The rain radar reported no forecast for this location”. Try again after the next update.

Try it yourself

Ready to test this? Open Settings > Tools > Actions, search for this action, fill in the fields, and select Perform action. You see what happens on your actual entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more] without writing a line of YAML.

More examples

Real scenarios where this action shows up in automations and scripts. Copy any example and adapt it to your setup. In the visual editor, select the UI options listed in the example or paste the YAML code.

Tip

You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the visual automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.

Automation: Skip the sprinklers when rain is on the way

Before the evening watering run, check the radar and only turn on the sprinklers when no rain shows up in any of the frames.

  • Trigger: Time, 20:00:00
  • Action: Get radar forecasts
    • Target: Brussels (weather.brussels)
    • Response variable: radar
  • Condition: Template, no frame has rain
  • Action: Turn on switch
    • Target: Sprinklers (switch.sprinklers)
YAML example for skipping the sprinklers when rain is coming
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Water the garden unless rain is coming"
triggers:
  - trigger: time
    at: "20:00:00"
actions:
  - action: irm_kmi.get_forecasts_radar
    target:
      entity_id: weather.brussels
    response_variable: radar
  - condition: template
    value_template: >
      {{ radar['weather.brussels'].forecast
         | map(attribute='precipitation')
         | reject('none')
         | select('gt', 0)
         | list
         | count == 0 }}
  - action: switch.turn_on
    target:
      entity_id: switch.sprinklers

Automation: Get a heads-up before rain starts

Check the radar every 10 minutes, and send a notification when it is dry now but rain shows up in a later frame. You may get the same heads-up more than once while the rain comes closer.

  • Trigger: Time pattern, every 10 minutes
  • Action: Get radar forecasts
    • Target: Brussels (weather.brussels)
    • Response variable: radar
  • Condition: Template, the current frame is dry and a later frame has rain
  • Action: Send a notification message
    • Target: My Device (notify.my_device)
YAML example for a heads-up before rain starts
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Warn me before rain starts"
triggers:
  - trigger: time_pattern
    minutes: /10
actions:
  - action: irm_kmi.get_forecasts_radar
    target:
      entity_id: weather.brussels
    response_variable: radar
  - variables:
      rates: >
        {{ radar['weather.brussels'].forecast
           | map(attribute='precipitation')
           | list }}
  - condition: template
    value_template: >
      {{ rates[0] == 0
         and rates | reject('none') | select('gt', 0) | list | count > 0 }}
  - action: notify.send_message
    target:
      entity_id: notify.my_device
    data:
      message: "Rain is on its way."

Still stuck?

To test the action on its own, run it in the automation editor with Run action, and check the message that it shows. To see what the action did when the automation ran, open the trace of that run. For details, refer to Testing automations. For common problems and their solutions, refer to Troubleshooting automations.

If that doesn’t help, the Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the action you’re calling and what you expected to happen, or share on our subreddit /r/homeassistant.

Tip

AI assistants like ChatGPT or Claude can also explain actions or suggest the right one when you describe what you want in plain language.

Related actions

Explore related actions: