Add precipitation % to openweathermap integration

I integrated openweathermap and added a weather card for it on my custom dashboard. How do I add the chance of rain (%) to the card? I see precipitation value but that is mm of actual rainfall.

Go to settings —> entities and check if the precipitation sensor is activated.

Yes but doesnt that refer to the amount of actual precipitation that has fallen (measured in mm) instead of the % chance of rain? Im looking for the latter.


sensor.openweathermap_forecast_precipitation_probability

gives you the percentage value.

ok i see it. and how would i go about adding it to the default card. You mentioned something about settings but I can’t find any settings link on the card view.

I mean your Home Assistant settings: sidebar —> settings —> entities

yes that sensor is there (configuration>entities) and enabled.

How do I get it onto the dashboard weather card?

Not at all I think, if it is not available as a secondary_info_attribute

It doesnt appear in the UI dropdown of the weather card itself. Would it be possible to add it manually in code:

I think, that is only possible with something like Custom Button Card which allows you to define several cards in one.

Does it all have to be on one card?

If you make the card background transparent in your theme (or the same colour as your primary background colour) they all merge together.

  # BACKGROUND COLOURS ###############################

  # Main display area

  primary-background-color: "#000000"               #black
  card-background-color: "#000000"                  # black
  # card-background-color: rgba(0,0,0,0)              # transparent

The above dashboard is a vertical stack with each layer containing a horizontal stack, but you could get a similar effect with a grid card. With a normal background it looks like this:

No not at all. I just need to know how you got “Chance of Rain” there?

type: vertical-stack
cards:
  - type: horizontal-stack
    cards:
      - type: weather-forecast
        entity: weather.openweathermap
      - type: entities
        entities:
          - entity: sensor.openweathermap_forecast_precipitation_probability
            name: Chance of rain
          - entity: sensor.openweathermap_feels_like_temperature
            name: Feels like
          - entity: sensor.openweathermap_wind_speed
        show_header_toggle: false
        state_color: true
        title: Today

Ok that sorta works…it gives me the % chance of rain for the current day. So I would have to make another card with the forecast 5 days and their forecast_precipitation-probability?

Really like the look of this, mind if I ask how you are storing the outside temperature? Is this from a cloud service like Openweathermap or do you have your own weather station? I can’t find a way to graph the past weather in HA?!

I like your weather card. did you get it to work? if so can you share please?

Hi, I like your weather dashboard. Do you like to share your code for this?
Thanks

It’s changed a bit since then.

But here’s the current code:

type: vertical-stack
cards:
  - type: conditional
    conditions:
      - entity: sensor.weather_alerts
        state_not: '0'
    card:
      type: markdown
      card_mod:
        style:
          .: |
            ha-card {
              --mdc-icon-size: 40px;
            }
          ha-markdown:
            $: |
              td {
                vertical-align: top;
              }
      content: |
        {% if state_attr('sensor.weather_alerts','entries') != 0 %}
          {% for item in state_attr('sensor.weather_alerts','entries') %}
            {% for type, icon in [('rain', 'weather-pouring'), ('thunderstorms', 'weather-lightning-rainy'),
                                  ('wind', 'weather-windy'), ('snow', 'weather-snowy-heavy'), ('snow, ice', 'weather-snowy-heavy'), 
                                  ('lightning', 'weather-lightning'), ('ice', 'car-traction-control'),
                                  ('fog', 'weather-fog'), ('extreme heat', 'weather-sunny-alert'), ('thunderstorm', 'weather-lightning')] if type == item.summary | regex_findall_index('.*warning of (.*) affecting.*', ignorecase=True) %}
              {% set color = item.summary.split(' ')[0] %}
              {% set summary = item.summary | regex_findall_index('(.*) affecting South West England: (.*) valid from (.*) to (.*)', ignorecase=True) %}
              {% set time_from = as_timestamp(strptime(summary[2], "%H%M %a %d %b")) | timestamp_custom("%H:%M %d/%m") %}
              {% set time_to = as_timestamp(strptime(summary[3], "%H%M %a %d %b")) | timestamp_custom("%H:%M %d/%m") %}
        | | | |
        | --- | --- | --- |
        | <font color = {%- if 'Yellow' == color %}'gold'
                        {%- elif 'Amber' == color %}'darkorange'
                        {%- else %}'firebrick'
                        {%- endif %}><ha-icon icon={{ "'mdi:" + icon + "'" }}></ha-icon></font> | | **{{ summary[0] | title }}**<br />{{ time_from }} - {{ time_to }}<br />{{ summary[1] }} |
            {% endfor %}
          {% endfor %}
        {% endif %}
  - type: horizontal-stack
    cards:
      - type: weather-forecast
        entity: weather.met_office_blandford_forum_3_hourly
      - show_current: true
        show_forecast: true
        type: weather-forecast
        entity: weather.met_office_blandford_forum_daily
  - type: horizontal-stack
    cards:
      - type: entity
        entity: sensor.blandford_forum_wind_speed_3_hourly
        name: Wind speed
      - type: entity
        entity: sensor.blandford_forum_wind_gust_3_hourly
        name: Wind gust
      - type: entity
        entity: sensor.blandford_forum_feels_like_temperature_3_hourly
        name: Feels like...
      - type: entity
        entity: sensor.blandford_forum_probability_of_precipitation_3_hourly
        name: Chance of rain
  - type: horizontal-stack
    cards:
      - type: custom:vertical-stack-in-card
        cards:
          - type: entity
            name: 'Outside temperature:'
            entity: sensor.outdoor_temperature
          - type: custom:mini-graph-card
            name: 'Last 5 days:'
            hours_to_show: 120
            entities:
              - entity: sensor.outdoor_temperature
              - color: gray
                entity: counter.night_time
                name: Night
                show_line: false
                show_points: false
                show_legend: false
                y_axis: secondary
            line_width: 2
            font_size_header: 12
            show:
              labels: true
              points: true
              state: false
              icon: false
      - type: custom:vertical-stack-in-card
        cards:
          - type: entity
            name: 'Outside humidity:'
            entity: sensor.humidity
          - type: custom:mini-graph-card
            name: 'Last 5 days:'
            hours_to_show: 120
            entities:
              - entity: sensor.humidity
              - color: gray
                entity: counter.night_time
                name: Night
                show_line: false
                show_points: false
                show_legend: false
                y_axis: secondary
            line_width: 2
            font_size_header: 12
            show:
              labels: true
              points: true
              state: false
              icon: false
      - type: custom:vertical-stack-in-card
        cards:
          - type: entity
            name: 'Rainfall:'
            entity: sensor.hourly_rain_rate
          - type: custom:mini-graph-card
            name: 'Last 5 days:'
            hours_to_show: 120
            entities:
              - entity: sensor.hourly_rain_rate
              - color: gray
                entity: counter.night_time
                name: Night
                show_line: false
                show_points: false
                show_legend: false
                y_axis: secondary
            line_width: 2
            font_size_header: 12
            show:
              labels: true
              points: true
              state: false
              icon: false
      - type: custom:vertical-stack-in-card
        cards:
          - type: entity
            entity: sensor.relative_pressure
            name: 'Barometer:'
          - type: custom:mini-graph-card
            name: 'Last 5 days:'
            hours_to_show: 120
            entities:
              - entity: sensor.relative_pressure
              - color: gray
                entity: counter.night_time
                name: Night
                show_line: false
                show_points: false
                show_legend: false
                y_axis: secondary
            line_width: 2
            font_size_header: 12
            show:
              labels: true
              points: true
              state: false
              icon: false
  - type: horizontal-stack
    cards:
      - type: horizontal-stack
        cards:
          - type: entity
            entity: sensor.sunrise
            name: Sunrise
            icon: mdi:weather-sunset-up
          - type: entity
            entity: sensor.sunset
            name: Sunset
            icon: mdi:weather-sunset-down
      - type: entity
        entity: sensor.today
        name: Today
        icon: mdi:calendar

Data in the top two rows come from the UK Met Office.

There’s a conditional card that appears at the top (not in this image) when the Met Office issues a severe weather warning. There’s a how-to post about it here.

Data in the third row comes from an Ecowitt weather station.

1 Like