Local Weather and Aviation METAR Cards

Here are two weather cards that I created with much reading from different searches.

I have an extensive SmartThings deployment and was looking for something that would extend the feature/functionality of my current ST deployment and allow me to consolidate 12 Raspberry Pi into HA. Ultimately, my goal is to supplant ST with HA.

I am not a programmer by trade but can hold my own. I had no prior experience with YAML, json, or MQTT.

For my first production dashboard, I focused on weather. Being a private pilot, I wanted to display METAR information but found no working integrations. This started me down the path of leveraging APIs. I also have an AmbientWeather station on my roof and wanted to create a different card for that.

I am currently wading through different hardware approaches to have HA specific displays, particularly for my bedstand and office. I’m finding this to be the biggest challenge. I am testing a repurposed Raspberry Pi with the 7” display, so screen real estate is at a premium

These cards use mushroom-template-badge cards enveloped in a stack-in-card. I use horizontal-stack cards to delineate lines of related data that I wanted to keep together.

Both cards use dynamic icon colors.

The METAR card border will change with the current flight conditions (green = VFR, blue = MVFR, red = IFR, and magenta = LIFR. The top row of cards (flight rules, cloud layers and visibility all change colors to reflect the current flight rules. Gusting wind conditions, when present. The cloud layers in row 1 come and go based on their presence.

I use two API sources: one from NWS and the other from AVWX.rest. Each provides slightly different info that made my programming life easier. Node Red to create the flow and create sensors.

Live Weather card has six rows of information. When present, it will show NWS weather alerts on the first row (if present). Row 2: temperatures. Row 3: winds and sky conditions (sky conditions via OpenWeather). Row 4: precipitation when there is an active event. I show rate rate/hr and Rain Event. Row 5: Weekly, Monthly and Annual rain. Color coded for my area’s expected rain within those categories. Row 6: AQI and Fire Risk. AQI via PurpleAir unit and EcoWitt (Ecowitt2mqtt) for inside AQI. Fire risk via PirateWeather.

Using the ambient2mqtt integration. It provided me with some entities that the AmbientWeather integration didn’t.

The most fun I had was integrating the NWS Alerts into a mushroom-template-badge card. I only want it to appear when there are active alerts, but more importantly, I didn’t want to go to another card to get the alert into.

I integrated the NWS alert data into a popup card (browser-mod). When there is an alert, I post the alert title and quantity of alerts. Click on the badge and a popup appears with all of the NWS alert into.

I may augment my weather card with pollen info next…

The integrations in play:
• Browser Mod - NWS popup display
• MQTT / Ambient2mqtt – pull weather station data
• Node Red – easily pull METAR API data and stuff into sensors
• OpenWeatherMap – sky conditions
• PurpleAir – AQI info
• NWS Alerts – manage NWS alerts

Cards:
• Stack-in-card
• Mushroom-title-card
• Card-mod
• Horizontal-stack
• Mushroom-template-badge

METAR YAML

type: custom:stack-in-card
card_mod:
  style: |
    ha-card {
    padding-bottom: 8px !important;
    padding-right: 8px;
    padding-left: 8px;
      border: 3.5px solid
        {% if 'MVFR' in states('sensor.flight_rules') %}
        darkblue
        {% elif 'VFR' in states('sensor.flight_rules') %}
        darkgreen
        {% elif 'LIFR' in states('sensor.flight_rules') %}
        darkmagenta
        {% elif 'IFR' in states('sensor.flight_rules') %}
        darkred
        {% endif %}
        !important;
        background: url('/local/sky-vfr.jpg')
        }
cards:
  - type: custom:mushroom-title-card
    title: KABE METAR
    card_mod:
      style: |
        ha-card {
        padding-top: 6px !important;
        --title-color: gray;
        --subtitle-font-size: 12px;
        --subtitle-color:
        skyblue
        }
    alignment: left
    subtitle: "Age: {{ states ('sensor.aviation_gov_metar_age') }}"
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.flight_rules') }}"
        icon: mdi:airplane
        color: |
          {% if 'MVFR' in states('sensor.flight_rules') %}
          blue
          {% elif 'VFR' in states('sensor.flight_rules') %}
           green
          {% elif 'LIFR' in states('sensor.flight_rules') %}
          magenta
          {% elif 'IFR' in states('sensor.flight_rules') %}
          red
          {% endif %}
        entity: sensor.flight_rules
        label: KABE
      - type: custom:mushroom-template-badge
        content: "{{ (states ('sensor.clouds_kabe') | float * 100)  }}"
        icon: mdi:cloud
        color: |
          {% if 'MVFR' in states('sensor.flight_rules') %}
          blue
          {% elif 'VFR' in states('sensor.flight_rules') %}
          green
          {% elif 'LIFR' in states('sensor.flight_rules') %}
          magenta
          {% elif 'IFR' in states('sensor.flight_rules') %}
          red
          {% endif %}
        entity: sensor.flight_rules
        tap_action:
          action: more-info
        visibility:
          - condition: state
            entity: sensor.metar_sky
            state_not: CLR
        label: "{{ states ('sensor.cloud1_type_kabe') }}"
      - type: custom:mushroom-template-badge
        content: "{{ (states ('sensor.cloud2_alt_kabe') | float * 100) }}"
        icon: mdi:cloud
        color: |
          {% if 'MVFR' in states('sensor.flight_rules') %}
          blue
          {% elif 'VFR' in states('sensor.flight_rules') %}
          green
          {% elif 'LIFR' in states('sensor.flight_rules') %}
          magenta
          {% elif 'IFR' in states('sensor.flight_rules') %}
          red
          {% endif %}
        label: "{{ states ('sensor.cloud2_type_kabe')}}"
        entity: sensor.cloud2_alt_kabe
        tap_action:
          action: more-info
        visibility:
          - condition: numeric_state
            entity: sensor.nodered_8989ebdce7216303
            above: 1
            below: 4
      - type: custom:mushroom-template-badge
        icon: mdi:cloud
        content: "{{ (states ('sensor.clouds_alt_layer3_kabe') | float * 100) }}"
        color: |
          {% if 'MVFR' in states('sensor.flight_rules') %}
          blue
          {% elif 'VFR' in states('sensor.flight_rules') %}
          green
          {% elif 'LIFR' in states('sensor.flight_rules') %}
          magenta
          {% elif 'IFR' in states('sensor.flight_rules') %}
          red
          {% endif %}
        label: "{{ states ('sensor.cloud_type_layer_3_kabe') }}"
        tap_action:
          action: more-info
        entity: sensor.clouds_alt_layer3_kabe
        visibility:
          - condition: state
            entity: sensor.nodered_8989ebdce7216303
            state: "3"
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.visibility_kabe') }}"
        icon: mdi:weather-fog
        color: |-
          {% if 'MVFR' in states('sensor.flight_rules') %}
          blue
          {% elif 'VFR' in states('sensor.flight_rules') %}
          green
          {% elif 'LIFR' in states('sensor.flight_rules') %}
          magenta
          {% elif 'IFR' in states('sensor.flight_rules') %}
          red
          {% endif %}
        entity: sensor.visibility_kabe
        label: Visibility
        tap_action:
          action: more-info
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.avwx_temp_kabe') }}°C"
        icon: mdi:thermometer
        color: blue
        label: Temp
        entity: sensor.avwx_temp_kabe
        tap_action:
          action: more-info
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.dewpoint_c_kabe') }}°C"
        icon: mdi:thermometer
        color: blue
        label: Dew
        entity: sensor.dewpoint_c_kabe
        tap_action:
          action: more-info
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.kabe_relative_humidity') }}% "
        icon: mdi:thermometer
        color: blue
        label: Humidity
        entity: sensor.kabe_relative_humidity
        tap_action:
          action: more-info
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.pressure_kabe') | round(2) }}'' "
        icon: mdi:thermometer
        color: blue
        label: Pressure
        entity: sensor.pressure_kabe
        tap_action:
          action: more-info
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-badge
        content: >
          {% if states('sensor.wind_speed_kabe') | float == 0 %} Calm {% elif
          is_state('sensor.nodered_dea7a79f1301dfbf', 'VRB') %} Variable @ {{
          states ('sensor.wind_speed_kabe') }} Knots

          {% elif states('sensor.wind_speed_kabe') | float > 0 and
          states('sensor.nwswind_gust_array_size') | float == 0 %} {{ states
          ('sensor.nodered_dea7a79f1301dfbf') }}° @ {{ states
          ('sensor.wind_speed_kabe') }} Knots

          {% elif states('sensor.wind_speed_kabe') | float > 0 and
          states('sensor.nwswind_gust_array_size') | float > 0 %}

          {{ states ('sensor.nodered_dea7a79f1301dfbf') }}° @ {{ states
          ('sensor.wind_speed_kabe') }} Knots - Gust {{states
          ('sensor.wind_gust') }} Knots {% endif %}
        icon: mdi:windsock
        color: gold
        label: Winds
        entity: sensor.wind_speed_kabe
        tap_action:
          action: more-info

Live Weather YAML:

type: custom:stack-in-card
card_mod:
  style: |
    ha-card {
    padding-bottom: 8px !important;
    padding-right: 8px;
    padding-left: 8px;
      border: 3.5px groove
          {% if is_state('sensor.nws_alerts_are_active', 'True') %}
          tomato
          {% else %}
          rgb(120,120,120)
          {% endif %}
          !important;
          background: url('/local/sky-vfr6.jpg')
          }
cards:
  - type: custom:mushroom-title-card
    title: |
      {% if is_state('sensor.nws_alerts_are_active', 'True') %}
      Live Weather - NWS Alerts!
      {% else %}
      Live Weather
      {% endif %}
    card_mod:
      style: |
        ha-card {
        padding-top: 6px !important;
        --title-color: 
          {% if is_state('sensor.nws_alerts_are_active', 'True') %}
          tomato;
          {% else %}
          gray !important;
          {% endif %}
        --subtitle-font-size: 20px;
        --subtitle-color:
          {% if is_state('sensor.nws_alerts_are_active', 'True') %}
          red !important;
          {% else %}
          transparent
          {% endif %}
          }
    alignment: center
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-badge
        content: >-
          {% if is_state('sensor.nws_alerts_are_active', 'True') %}

          ⚠️ {{ state_attr('sensor.nws_alerts','Alerts')[0].Event }} - {{
          states('sensor.nws_alerts') | int }} Active  ⚠️

          {% else %}
            NWS: Clear
          {% endif %}
        icon: |-
          {% if is_state('sensor.nws_alerts_are_active', 'True') %}
            mdi:
          {% else %}
            mdi:emoticon-happy-outline
          {% endif %}  
        color: |-
          {% if is_state('sensor.nws_alerts_are_active', 'True') %}
            #D60E30
          {% else %}
            green
          {% endif %}
        entity: sensor.nws_alerts
        label: |
          {% if is_state('sensor.nws_alerts_are_active', 'True') %}

          {% else %}
           Woohoo!
          {% endif %}
        visibility:
          - condition: state
            entity: sensor.nws_alerts_are_active
            state: "True"
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.popup
            data:
              title: NWS Alert Detail
              target:
                device_id: browser_mod_9658740a_e102002b
              content:
                type: custom:layout-card
                cards:
                  - type: entity
                    entity: sensor.nws_alerts
                    name: National Weather Service
                    theme: ios-dark-mode
                    state_color: true
                    icon: mdi:weather-lightning-rainy
                    unit: Active Alert(s)
                  - type: conditional
                    conditions:
                      - entity: sensor.nws_alerts
                        state_not: "0"
                    card:
                      card_mod:
                        style: |
                          ha-card {
                          color: red
                          } 
                      type: markdown
                      content: >
                        {% set num_alerts = states('sensor.nws_alerts') | int 
                        %}

                        {% for alert_num in range(num_alerts) %}

                        ---

                        ## {{ state_attr('sensor.nws_alerts',
                        'Alerts')[alert_num].Event }}

                        ___

                        {{ state_attr('sensor.nws_alerts',
                        'Alerts')[alert_num].Description }}

                        {% endfor %}
                      theme: Caule Dark Pink
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-badge
        content: >-
          {{states('sensor.ambientweather2mqtt_temperatureoutdoor') |round(1)
          }}°F 
        icon: mdi:thermometer
        color: >-
          {% if states('sensor.ambientweather2mqtt_temperatureoutdoor') | float
          >= 90 %} maroon {% elif
          states('sensor.ambientweather2mqtt_temperatureoutdoor') | float >= 80
          and states('sensor.ambientweather2mqtt_temperatureoutdoor') | float <=
          89.9 %} red {% elif
          states('sensor.ambientweather2mqtt_temperatureoutdoor') | float < 80
          and states('sensor.ambientweather2mqtt_temperatureoutdoor') | float
          >=75 %} lightpink {% elif
          states('sensor.ambientweather2mqtt_temperatureoutdoor') | float >= 65
          and states('sensor.ambientweather2mqtt_temperatureoutdoor') | float <
          75 %} orange {% elif
          states('sensor.ambientweather2mqtt_temperatureoutdoor') | float >= 55
          and states('sensor.ambientweather2mqtt_temperatureoutdoor') | float <
          65 %} gold {% elif
          states('sensor.ambientweather2mqtt_temperatureoutdoor') | float >= 32
          and states('sensor.ambientweather2mqtt_temperatureoutdoor') | float <
          55 %} blue {% elif
          states('sensor.ambientweather2mqtt_temperatureoutdoor') | float < 32
          %} skyblue {% endif %}
        entity: sensor.ambientweather2mqtt_temperatureoutdoor
        label: Temp
        tap_action:
          action: more-info
      - type: custom:mushroom-template-badge
        content: "{{states('sensor.ambientweather2mqtt_dewpoint') |round(1)}}°F"
        icon: mdi:thermometer-water
        color: >-
          {% if states('sensor.ambientweather2mqtt_dewpoint') | float >= 75 %}
          maroon  {% elif states('sensor.ambientweather2mqtt_dewpoint') | float
          < 75 and states('sensor.ambientweather2mqtt_dewpoint') | float >= 67
          %} red  {% elif states('sensor.ambientweather2mqtt_dewpoint') | float
          < 67 and states('sensor.ambientweather2mqtt_dewpoint') | float >= 64
          %} orange  {% elif states('sensor.ambientweather2mqtt_dewpoint') |
          float < 64 and states('sensor.ambientweather2mqtt_dewpoint') | float >
          59 %} gold  {% elif states('sensor.ambientweather2mqtt_dewpoint') |
          float <= 59 %}  green  {% endif %}
        entity: sensor.ambientweather2mqtt_dewpoint
        label: DewPoint
        tap_action:
          action: more-info
      - type: custom:mushroom-template-badge
        content: "{{states('sensor.ambientweather2mqtt_feelslike') |round(1)}}°F"
        icon: mdi:thermometer-alert
        color: >-
          {% if states('sensor.ambientweather2mqtt_temperatureoutdoor') | float
          >= 90 %} maroon {% elif
          states('sensor.ambientweather2mqtt_temperatureoutdoor') | float >= 80
          and states('sensor.ambientweather2mqtt_temperatureoutdoor') | float <=
          89.9 %} red {% elif
          states('sensor.ambientweather2mqtt_temperatureoutdoor') | float < 80
          and states('sensor.ambientweather2mqtt_temperatureoutdoor') | float
          >=75 %} lightpink {% elif
          states('sensor.ambientweather2mqtt_temperatureoutdoor') | float >= 65
          and states('sensor.ambientweather2mqtt_temperatureoutdoor') | float <
          75 %} orange {% elif
          states('sensor.ambientweather2mqtt_temperatureoutdoor') | float >= 55
          and states('sensor.ambientweather2mqtt_temperatureoutdoor') | float <
          65 %} gold {% elif
          states('sensor.ambientweather2mqtt_temperatureoutdoor') | float >= 32
          and states('sensor.ambientweather2mqtt_temperatureoutdoor') | float <
          55 %} blue {% elif
          states('sensor.ambientweather2mqtt_temperatureoutdoor') | float < 32
          %} skyblue {% endif %}
        entity: sensor.ambientweather2mqtt_feelslike
        label: Feels Like
        tap_action:
          action: more-info
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-badge
        content: >
          {% if states('sensor.ambientweather2mqtt_windspeed') | float > 0 %} 
          {{states('sensor.ambientweather2mqtt_windspeed') + ' / '  +
          states('sensor.ambientweather2mqtt_windgust') }} {% elif
          states('sensor.ambientweather2mqtt_windspeed') | float <= 0 %}  Calm 
          {% endif %}
        icon: mdi:weather-windy
        color: >-
          {% if states('sensor.ambientweather2mqtt_windgust') | float > 20 %}
          maroon  {% elif states('sensor.ambientweather2mqtt_windgust') | float
          <= 20 and states('sensor.ambientweather2mqtt_windgust') | float > 15
          %}  red  {% elif states('sensor.ambientweather2mqtt_windgust') | float
          <= 15 and states('sensor.ambientweather2mqtt_windgust') | float > 10
          %}  orange  {% elif states('sensor.ambientweather2mqtt_windgust') |
          float <= 10 and states('sensor.ambientweather2mqtt_windgust') | float
          > 6 %}  gold  {% elif states('sensor.ambientweather2mqtt_windgust') |
          float <= 10 %}  green  {% endif %}
        label: Wind / Gust
        entity: sensor.ambientweather2mqtt_windspeed
        tap_action:
          action: more-info
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.ambientweather2mqtt_winddirection') }}°"
        icon: mdi:windsock
        color: gold
        label: Wind Dir
        entity: sensor.ambientweather2mqtt_winddirection
        tap_action:
          action: more-info
      - type: custom:mushroom-template-badge
        content: >-
          {% if is_state('sensor.openweathermapkabe_condition', 'fog') %} Fog {%
          elif is_state('sensor.openweathermapkabe_condition', 'rainy') %} Rainy
          {% elif is_state('sensor.openweathermapkabe_condition', 'snowy') %}
          Snowy {% elif is_state('sensor.openweathermapkabe_condition', 'hazy')
          %} Hazy   {% elif is_state('sensor.openweathermapkabe_condition',
          'cloudy') %} Cloudy {% elif
          is_state('sensor.openweathermapkabe_condition', 'sunny') %} Sunny {%
          elif is_state('sensor.openweathermapkabe_condition', 'clear-night') %}
          Clear Night {% elif is_state('sensor.openweathermapkabe_condition',
          'partlycloudy') %} Partly Cloudy {% endif %}  
        icon: >-
          {% if is_state('sensor.openweathermapkabe_condition', 'fog') %}
          mdi:weather-fog {% elif
          is_state('sensor.openweathermapkabe_condition', 'rainy') %}
          mdi:weather-rainy {% elif
          is_state('sensor.openweathermapkabe_condition', 'snowy') %}
          mdi:weather-snowy {% elif
          is_state('sensor.openweathermapkabe_condition', 'hazy') %}
          mdi:weather-hazy   {% elif
          is_state('sensor.openweathermapkabe_condition', 'cloudy') %}
          mdi:weather-cloudy {% elif
          is_state('sensor.openweathermapkabe_condition', 'sunny') %}
          mdi:weather-sunny {% elif
          is_state('sensor.openweathermapkabe_condition', 'clear-night') %}
          mdi:weather-night {% elif
          is_state('sensor.openweathermapkabe_condition', 'partlycloudy') %}
          mdi:weather-partly-cloudy  {% endif %}  
        color: blue
        label: Skies
        entity: sensor.openweathermapkabe_condition
        tap_action:
          action: more-info
      - type: custom:mushroom-template-badge
        content: >-
          {{states('sensor.ambientweather2mqtt_lightningcount') }} /
          {{states('sensor.ambientweather2mqtt_lightningdistance') }} mi
        icon: mdi:weather-lightning
        color: gold
        label: Strikes
        entity: sensor.ambientweather2mqtt_lightningcount
        tap_action:
          action: more-info
        visibility:
          - condition: numeric_state
            entity: sensor.ambientweather2mqtt_lightningcount
            above: 0
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.ambientweather2mqtt_rainhourly') +' in/hr'  }}"
        icon: mdi:weather-pouring
        color: >-
          {% if states('sensor.ambientweather2mqtt_rainhourly') | float > 1.0%}
          purple {% elif states('sensor.ambientweather2mqtt_rainhourly') | float
          >= 0.5 and states('sensor.ambientweather2mqtt_rainhourly') | float <=
          1.0%} red {% elif states('sensor.ambientweather2mqtt_rainhourly') |
          float >= 0.1 and states('sensor.ambientweather2mqtt_rainhourly') |
          float < 0.5 %} gold {% elif
          states('sensor.ambientweather2mqtt_rainhourly') | float < 0.1 %} green
          {% endif %}
        label: >
          {% if states('sensor.ambientweather2mqtt_rainhourly') | float > 1.0%}
          Run For The Hills! {% elif
          states('sensor.ambientweather2mqtt_rainhourly') | float >= 0.5 and
          states('sensor.ambientweather2mqtt_rainhourly') | float <= 1.0 %} 
          Holy Shit!  {% elif states('sensor.ambientweather2mqtt_rainhourly') |
          float >= 0.2 and states('sensor.ambientweather2mqtt_rainhourly') |
          float < 0.5 %}  Moderate Rain  {% elif
          states('sensor.ambientweather2mqtt_rainhourly') | float < 0.2 %} 
          Light Rain {% endif %}
        entity: sensor.ambientweather2mqtt_rainhourly
        tap_action:
          action: more-info
        visibility:
          - condition: numeric_state
            entity: sensor.ambientweather2mqtt_rainhourly
            above: 0
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.ambientweather2mqtt_rainevent') +'\"' }}"
        icon: mdi:weather-pouring
        color: >-
          {% if states('sensor.ambientweather2mqtt_rainevent') | float >= 2  %}
          red {% elif states('sensor.ambientweather2mqtt_rainevent') | float < 2
          and states('sensor.ambientweather2mqtt_rainevent') | float >= 1.5 %}
          orange {% elif states('sensor.ambientweather2mqtt_rainevent') | float
          < 1.5 and states('sensor.ambientweather2mqtt_rainevent') | float >=
          1.0 %} gold {% elif states('sensor.ambientweather2mqtt_rainevent') |
          float < 1 and states('sensor.ambientweather2mqtt_rainevent') | float
          >= 0 %} green {% endif %}
        entity: sensor.ambientweather2mqtt_rainevent
        label: Event Rain
        hold_action:
          action: toggle
        tap_action:
          action: more-info
        visibility:
          - condition: numeric_state
            entity: sensor.ambientweather2mqtt_rainevent
            above: 0
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.ambientweather2mqtt_raindaily') |round(2)}}\""
        icon: mdi:weather-pouring
        color: >-
          {% if states('sensor.ambientweather2mqtt_raindaily') | float >= 0  and
          states('sensor.ambientweather2mqtt_raindaily') | float < 0.1 %} red {%
          elif states('sensor.ambientweather2mqtt_raindaily') | float >= 0.1 and
          states('sensor.ambientweather2mqtt_raindaily') | float < 0.25 %}
          orange {% elif states('sensor.ambientweather2mqtt_raindaily') | float
          > 0.25 and states('sensor.ambientweather2mqtt_raindaily') | float <
          0.5 %} gold {% elif states('sensor.ambientweather2mqtt_raindaily') |
          float > 0.5 %} green {% endif %}
        entity: sensor.ambientweather2mqtt_raindaily
        label: Daily Rain
        hold_action:
          action: toggle
        tap_action:
          action: more-info
        visibility:
          - condition: numeric_state
            entity: sensor.ambientweather2mqtt_raindaily
            above: 0
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.ambientweather2mqtt_rainweekly')|round(2)}}\""
        icon: mdi:weather-pouring
        color: >-
          {% if states('sensor.ambientweather2mqtt_rainweekly') | float >= 0 and
          states('sensor.ambientweather2mqtt_rainweekly') | float <= 0.25 %} red
          {% elif states('sensor.ambientweather2mqtt_rainweekly') | float > 0.25
          and states('sensor.ambientweather2mqtt_rainweekly') | float <= 0.5 %}
          orange {% elif states('sensor.ambientweather2mqtt_rainweekly') | float
          > 0.5 and states('sensor.ambientweather2mqtt_rainweekly') | float <=
          0.8 %} gold {% elif states('sensor.ambientweather2mqtt_rainweekly') |
          float > 0.8 %} green {% endif %}
        entity: sensor.ambientweather2mqtt_rainweekly
        label: Weekly Rain
        tap_action:
          action: more-info
        visibility:
          - condition: numeric_state
            entity: sensor.ambientweather2mqtt_rainweekly
            above: 0
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.ambientweather2mqtt_rainmonthly')|round(2)}}\""
        icon: mdi:weather-pouring
        color: >-
          {% if states('sensor.ambientweather2mqtt_rainmonthly') | float <1  %}
          red {% elif states('sensor.ambientweather2mqtt_rainmonthly') | float
          >= 1.0 and states('sensor.ambientweather2mqtt_rainmonthly') | float <=
          1.75 %} orange {% elif
          states('sensor.ambientweather2mqtt_rainmonthly') | float > 1.75 and
          states('sensor.ambientweather2mqtt_rainmonthly') | float <= 2.5 %}
          gold {% elif states('sensor.ambientweather2mqtt_rainmonthly') | float
          > 2.5 %} green {% endif %}
        label: Monthly Rain
        entity: sensor.ambientweather2mqtt_rainmonthly
        tap_action:
          action: more-info
        visibility:
          - condition: numeric_state
            entity: sensor.ambientweather2mqtt_rainmonthly
            above: 0
        hold_action:
          action: toggle
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.ambientweather2mqtt_yearlyrainin')|round(2)}}\""
        icon: mdi:weather-pouring
        color: >-
          {% if states('sensor.ambientweather2mqtt_yearlyrainin') | float <= 15 
          %} red {% elif states('sensor.ambientweather2mqtt_yearlyrainin') |
          float > 15 and states('sensor.ambientweather2mqtt_yearlyrainin') |
          float <= 25 %} orange {% elif
          states('sensor.ambientweather2mqtt_yearlyrainin') | float > 25 and
          states('sensor.ambientweather2mqtt_yearlyrainin') | float < 40 %} gold
          {% elif states('sensor.ambientweather2mqtt_yearlyrainin') | float >=
          40 %} green {% endif %}
        label: Annual Rain
        entity: sensor.ambientweather2mqtt_yearlyrainin
        tap_action:
          action: more-info
        visibility:
          - condition: numeric_state
            entity: sensor.ambientweather2mqtt_yearlyrainin
            above: 0
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-badge
        content: >-
          {{states('sensor.purpleair_outdoor_aqi_2_5_120s_moving_average_b') +'
          AQI' }}
        icon: mdi:air-filter
        color: "{{ states ('sensor.purpleair_outdoor_pm_2_5_aqi_rgb_color_b') }}"
        tap_action:
          action: more-info
        label: AQI Outdoor
        entity: sensor.purpleair_outdoor_aqi_2_5_120s_moving_average_b
      - type: custom:mushroom-template-badge
        content: "{{states('sensor.ambientweather2mqtt_aqi_pm25_aqin') +' AQI' }}"
        icon: mdi:air-filter
        color: >
          {% if states('sensor.ambientweather2mqtt_aqi_pm25_aqin') | float > 300
          %} maroon {% elif states('sensor.ambientweather2mqtt_aqi_pm25_aqin') |
          float > 200 and states('sensor.ambientweather2mqtt_aqi_pm25_aqin') |
          float < 301 %} purple {% elif
          states('sensor.ambientweather2mqtt_aqi_pm25_aqin') | float > 150 and
          states('sensor.ambientweather2mqtt_aqi_pm25_aqin') | float < 201 %}
          red {% elif states('sensor.ambientweather2mqtt_aqi_pm25_aqin') | float
          > 100 and states('sensor.ambientweather2mqtt_aqi_pm25_aqin') | float <
          151 %} orange {% elif
          states('sensor.ambientweather2mqtt_aqi_pm25_aqin') | float > 50 and
          states('sensor.ambientweather2mqtt_aqi_pm25_aqin') | float < 101 %}
          yellow {% elif states('sensor.ambientweather2mqtt_aqi_pm25_aqin') |
          float < 51 %} green  {% endif %}
        tap_action:
          action: more-info
        label: AQI Indoor
        entity: sensor.ambientweather2mqtt_aqi_pm25_aqin
      - type: custom:mushroom-template-badge
        content: "{{ states ('sensor.pirateweather_fire_risk_level') }}"
        entity: sensor.pirateweather_fire_risk_level
        label: Fire Risk
        icon: >-
          {% if is_state('sensor.pirateweather_fire_risk_level', 'Low') %}
           mdi:fire-hydrant
          {% elif is_state('sensor.pirateweather_fire_risk_level', 'Moderate')
          %}
           mdi:fire-hydrant-alert
          {% elif is_state('sensor.pirateweather_fire_risk_level', 'High') %}
           mdi:fire
          {% elif is_state('sensor.pirateweather_fire_risk_level', 'Very High')
          %}
           mdi:fire-alert
          {% elif is_state('sensor.pirateweather_fire_risk_level', 'Extreme') %}
           mdi:fire-truck
          {% endif %}  
        tap_action:
          action: more-info
        color: >
          {% if is_state('sensor.pirateweather_fire_risk_level', 'Low') %}
            green
          {% elif is_state('sensor.pirateweather_fire_risk_level', 'Moderate')
          %}
            gold
          {% elif is_state('sensor.pirateweather_fire_risk_level', 'High') %}
            orange
          {% elif is_state('sensor.pirateweather_fire_risk_level', 'Very High')
          %}
            red
          {% elif is_state('sensor.pirateweather_fire_risk_level', 'Extreme') %}
            purple
          {% endif %} 
        visibility:
          - condition: state
            entity: sensor.pirateweather_fire_risk_level
            state_not: N/A

This pic shows the Fire Risk status.