San Jose UI Yaml


Referring page: Dynamic Weather Dashboard



This is the main block of UI code for the San Jose portion of the weather dashboard I discuss in my [blog post](insert link).

UI YAML:

#############################################################
title: Climate
id: climate
icon: mdi:weather-partly-cloudy

#background: >-
#    center / cover no-repeat fixed
#    url('https://mthamilton.ucolick.org/hamcam/Cam1.ts.JPG')


panel: true
cards:
#- type: custom:layout-card
#  layout: horizontal
#  min_columns: 1
#  max_columns: 3
#  #column_num: 3
#  sidebar_column: false
#  cards:

- type: custom:tabbed-card

  tabs:
      
    #BEGIN SAN JOSE
    - card:

        type: custom:layout-card
        layout: horizontal
        min_columns: 1
        max_columns: 2
        column_num: 2
        sidebar_column: false

        cards:
          - type: custom:stack-in-card
            mode: horizontal
            cards:         
            - type: custom:layout-card
              layout_type: grid
              layout:
                grid-template-columns: 50% 50%
                grid-template-rows: 1
                grid-template-areas: |
                  "z01 z02"

              cards:
              - type: custom:mushroom-template-card
                entity: sensor.gw1100b_outdoor_temperature
                primary: San Jose {{ states('sensor.outdoor_temperature_merged') }}°F
                secondary: |
                  {% set curr = states("sensor.outdoor_temperature_merged") | float() %}
                  {% set high = states("sensor.max_temperature_san_jose_today") | float() %}
                  {% set low = states("sensor.min_temperature_san_jose_today") | float () %}
                  {% set fcst = state_attr('sensor.weather_forecast_san_jose_daily','forecast')[0].temperature %}
                  {% set hour = now().strftime('%H') | int %}
                  {% set sol_noon_hour = as_timestamp (states("sensor.rancho_nacho_sun_solar_noon")) | timestamp_custom('%H') | int %}
                  {% set coverage = states('sensor.sky_coverage_san_jose') %}

                  {% from 'weather.jinja' import secondary_label_hi_lo_order %}
                  {{ secondary_label_hi_lo_order(curr, high, low, fcst, hour, sol_noon_hour, coverage) }} 
                multiline_secondary: true
                
                icon: |-
                  {% from 'weather.jinja' import icon_weather_type %}
                  {{ icon_weather_type('weather.pw_san_jose') }}
                icon_color: |-
                  {% from 'weather.jinja' import icon_color_temp %}
                  {{ icon_color_temp('sensor.outdoor_temperature_merged') }}  

                tap_action:
                  action: fire-dom-event
                  browser_mod:
                    service: browser_mod.popup
                    data:
                      title: San Jose Detail
                      content:
                        type: vertical-stack
                        cards:
                          !include weather/popup_stack_san_jose.yaml

              #begin mini graph
              - type: custom:decluttering-card
                template: mini_graph_title_card
                variables:
                  - entity_1: sensor.outdoor_temperature_merged
                  - entity_2: sensor.night_san_jose
                  - upper_bound: ~85
                  - lower_bound: ~50
                  - hours: 24
                view_layout:
                grid-area: z02                 

          # ***** BEGIN SAN JOSE ALERTS & NOTIFICATIONS *****

          - type: conditional
            conditions:
              - condition: numeric_state
                entity: sensor.pw_san_jose_alerts
                above: 0
                #below: 1
            card:
              type: custom:decluttering-card
              template: nws_weather_alert
              variables:
                - alert_sensor: sensor.pw_san_jose_alerts 

          - type: conditional
            conditions:
              - condition: state
                entity: binary_sensor.rain_forecasted_next_hour
                state: "on"
              - condition: numeric_state
                entity: sensor.gw1100b_rain_rate
                below: 0.01
            card:
              type: custom:decluttering-card
              template: weather_warning_card
              variables:
                - label: Possible rain in next hour
                - icon: 'mdi:weather-pouring'


          # ***** Begin San Jose Forecast
          - type: custom:vertical-stack-in-card
            cards:
              - type: custom:hourly-weather
                entity: weather.pw_san_jose
                num_segments: 12 # optional, defaults to 12
                name: #Next 12 hours # optional, defaults to "Hourly Weather"
                #show_wind: true
                icons: true
              #*** Begin SJ daily Forecast ***
              - type: custom:weather-chart-card
                entity: weather.pw_san_jose
                temp: sensor.outdoor_temperature_merged
                #title: San Jose
                show_main: false
                #show_time: true
                #show_day: true
                #show_date: true
                show_temperature: false
                show_attributes: false
                show_last_changed: true
                animated_icons: false
                icon_style: style2
                icon_size: 30
                forecast:
                  style: style2

              # ***** Begin San Jose Wind Stack *****
              - type: custom:vertical-stack-in-card
                cards:

                  - type: custom:decluttering-card
                    template: wind_detail_popup
                    variables:
                      - wind_speed: sensor.gw1100b_wind_speed
                      - wind_direction: sensor.gw1100b_wind_direction
                      - wind_gust: sensor.gw1100b_wind_gust
                      - gust_base: sensor.max_wind_gust_san_jose_today
                      - gust_base_attrib_tw: max_wind_gust_san_jose_this_week
                      - gust_base_attrib_tm: max_wind_gust_san_jose_this_month
                      - gust_base_attrib_ty: max_wind_gust_san_jose_this_year
                      - gust_base_attrib_at: max_wind_gust_san_jose_ath
                      - relative_pressure: sensor.gw1100b_relative_pressure
                      - windrose_image: /local/images/house_sat_view_v2.png
                  - type: custom:stack-in-card
                    cards:
                      - type: custom:layout-card
                        layout_type: grid
                        layout:
                          grid-template-columns: 10% 40% 40% 10%
                          grid-template-rows: 1
                          grid-template-areas: |
                            "zone1 zone2 zone3 zone4"
                        cards:
                          # ***** BEGIN AQI *****
                          - !include weather/san_jose_aqi_ui.yaml 
                          # ***** BEGIN Allergy Index *****
                          - !include weather/san_jose_allergy_index_ui.yaml

                  # ***** BEGIN RAIN STACK *****
                  - type: custom:vertical-stack-in-card
                    cards:
                      - type: custom:stack-in-card
                        mode: horizontal
                        cards:
                          - type: custom:mushroom-template-card
                            #entity: sensor.gw1100b_outdoor_temperature
                            primary: |-
                              {% set rt = states('sensor.rain_today_san_jose') | float() %}               
                              {% if rt > 0 %}                
                                Rain Today: {{ rt | round(2) }} in
                              {% else %}
                                Last Rain: {{ states('sensor.last_rain_san_jose') | round(2) }} in
                              {% endif%}                              
                            secondary: |-
                              {% set r_today = states('sensor.rain_today_san_jose') | float() %} 
                              {% set r_today_time = state_attr('sensor.rain_today_san_jose','last_updated') %}
                              {% set last_rain = state_attr('sensor.last_rain_san_jose','last_rain_updated') %}
                              {% set last_rain_date = as_datetime(last_rain).date() %}
                              {% set days_ago = (now().date() - last_rain_date).days %}

                              {% set hours_ago = (today_at() - as_datetime(r_today_time)).hours %}
                              {% set time_diff = now() - as_datetime(r_today_time) %}
                              {% set mins_diff = (time_diff.total_seconds() / 60) | round(0) %}

                              {% if days_ago >= 2 and r_today == 0 %}                
                                {{ days_ago }} days ago, on {{ as_timestamp(last_rain) | timestamp_custom('%B %-d @%-I:%M %p') }}
                              {% elif days_ago == 1 and r_today == 0 %}
                                Yesterday {{ as_timestamp(last_rain) | timestamp_custom('@%-I:%M %p') }}
                              {% elif r_today > 0 and mins_diff >= 60 %}
                                {% set hours_diff = (mins_diff / 60 ) | round (0,'floor') %}
                                {% if mins_diff - (hours_diff * 60)  <= 15 %}
                                  {{ hours_diff }} hours ago at {{ as_timestamp(r_today_time) | timestamp_custom('@%-I:%M %p') }}
                                {% else %}
                                  {{ hours_diff }}+ hours ago at {{ as_timestamp(r_today_time) | timestamp_custom('@%-I:%M %p') }}
                                {% endif %}
                              {% elif r_today > 0 and mins_diff >= 15 %}
                                {{ mins_diff }} minutes ago at {{ as_timestamp(r_today_time) | timestamp_custom('@%-I:%M %p') }}
                              {% else%}
                                Raining Now
                              {% endif%}

                            icon: mdi:weather-rainy
                            icon_color: |-
                              {% set rt = states('sensor.rain_today_san_jose') | float() %}               
                              {% if rt > 0 %}            
                                  blue
                                {% else%}
                                  grey
                                {% endif %}

                            tap_action:
                              action: fire-dom-event
                              browser_mod:
                                service: browser_mod.popup
                                data:
                                  title: Rain Detail
                                  content:
                                    type: vertical-stack
                                    cards:
                                      - type: custom:decluttering-card
                                        template: rain_detail
                                        variables:
                                           - rain_today: sensor.rain_today_san_jose
                                           - rain_base: sensor.last_rain_san_jose
                                           - rbase_attr01: total_rain_san_jose_this_week
                                           - rbase_attr02: total_rain_san_jose_this_month
                                           - rbase_attr03: total_rain_san_jose_this_season
                                           - rain_daily_history: sensor.gw1100b_daily_rain_rate
                                           - web_link_01: "[Saratoga Weather Gauges](https://saratoga-weather.org/gauges.php)"
                                           - web_link_02: "[Seasonal Rain from GGW](https://ggweather.com/seasonal_rain.htm)"
                                           - web_link_03: "[Saratoga Creek @ Saratoga](https://water.noaa.gov/gauges/SOGC1)"
                                           - web_link_04: "[San Thomas Aquino Creek @ Williams Road](https://water.noaa.gov/gauges/TMSC1)" 
                                           - web_link_05: "[Los Gatos Creek @ Lark Ave](https://water.noaa.gov/gauges/LRKC1)"

                            # *** HUMIDITY ***
                            card_mod:
                              style:
                                mushroom-shape-icon$: |
                                  {% set last_rain = state_attr('sensor.last_rainfall','last_updated') %}
                                  {% set time_diff = now() - as_datetime(last_rain) %}                          
                                  {% set mins_diff = (time_diff.total_seconds() / 60) | round(0) %}
                                
                                  {% if mins_diff <= 15 %} 
                                    .shape {
                                      --shape-animation: ping 2s infinite;
                                    }
                                    @keyframes ping {
                                        0% {box-shadow: 0 0 0 0 rgba(var(--rgb-red), 0.7);}
                                        70% {box-shadow: 0 0 0 10px transparent;}
                                        100% {box-shadow: 0 0 0 0 transparent;}
                                    }         
                                  {% endif %}

                          - type: conditional
                            conditions:
                              - condition: numeric_state
                                entity: sensor.gw1100b_daily_rain_rate
                                above: 0.05
                            card:
                              type: custom:decluttering-card
                              template: rain_mini_graph_pacific
                              variables:
                                - entity_rain: sensor.gw1100b_daily_rain_rate

                  #begin Humidity
                  - type: custom:stack-in-card
                    cards:
                      - type: custom:layout-card
                        layout_type: grid
                        layout:
                          grid-template-columns: 10% 18% 24% 24% 24%
                          grid-template-rows: 1
                          grid-template-areas: |
                            "zone1 zone2 zone3 zone4 zone5"
                        cards:
                          - type: custom:mushroom-chips-card
                            chips:
                              #*** Humidity ***
                              - type: template
                                entity: sensor.gw1100b_uv_index
                                #icon: mdi:water-percent
                                #icon_color: blue
                                content: 'Humidity:'                            
                                tap_action:
                                  action: more-info
                                  entity: sensor.gw1100b_uv_index

                                card_mod:
                                  style:
                                    mushroom-state-info$: |
                                    .: |
                                      ha-card {
                                        border: none !important;
                                        box-shadow: none !important;
                                      }  
                            view_layout:
                              grid-area: zone2           
                          - type: custom:mushroom-chips-card
                            chips:
                              - type: template
                                entity: sensor.gw1100b_indoor_humidity
                                icon: mdi:water-percent
                                icon_color: blue
                                content: | 
                                  Office: {{ states('sensor.gw1100b_indoor_humidity')}}%                              
                                tap_action:
                                  action: more-info
                                  entity: sensor.gw1100b_indoor_humidity

                                card_mod:
                                  style:
                                    mushroom-state-info$: |
                                    .: |
                                      ha-card {
                                        border: none !important;
                                        box-shadow: none !important;
                                      }  
                            view_layout:
                              grid-area: zone3     

                          - type: custom:mushroom-chips-card
                            chips:
                              - type: template
                                entity: sensor.ecobee_humidity
                                icon: mdi:water-percent
                                icon_color: blue
                                content: | 
                                  House: {{ states('sensor.ecobee_humidity')}}%                              
                                tap_action:
                                  action: more-info
                                  entity: sensor.ecobee_humidity

                                card_mod:
                                  style:
                                    mushroom-state-info$: |
                                    .: |
                                      ha-card {
                                        border: none !important;
                                        box-shadow: none !important;
                                      }  
                            view_layout:
                              grid-area: zone4

                          - type: custom:mushroom-chips-card
                            chips:
                              - type: template
                                entity: sensor.gw1100b_humidity
                                icon: mdi:water-percent
                                icon_color: blue
                                content: | 
                                  Outside: {{ states('sensor.gw1100b_humidity')}}%                              
                                tap_action:
                                  action: more-info
                                  entity: sensor.gw1100b_humidity

                                card_mod:
                                  style:
                                    mushroom-state-info$: |
                                    .: |
                                      ha-card {
                                        border: none !important;
                                        box-shadow: none !important;
                                      }  
                            view_layout:
                              grid-area: zone5

                  # ***** Begin San Jose Sun Section *****
                  - type: custom:mushroom-template-card
                    #entity: sensor.gw1100b_outdoor_temperature
                    primary: |-
                      {% set elev = states("sensor.sun_solar_elevation") | float() %}
                      {% if elev >= 0 %}
                        Sunset {{ states("sensor.sunset_today") }}
                      {% else %}
                        Sunrise {{ states("sensor.sunrise_today") }}
                      {% endif %}
                      
                    icon: |-
                      {% set elev = states("sensor.sun_solar_elevation") | float() %}
                      {% if elev >= 0 %}
                        mdi:weather-sunset-down
                      {% else %}
                        mdi:weather-sunset-up
                      {% endif %}
                    icon_color: |-
                      {% set elev = states("sensor.sun_solar_elevation") | float() %}
                      {% if elev >= 0 %}
                        #FF8C00
                      {% else %}
                        grey
                      {% endif %}
                    secondary: |-
                      {% set daylight_left = states("sensor.hours_until_next_sun_event")  %}
                      {% set last_light = states("sensor.dusk_today") %}
                      {% set night_left = states("sensor.hours_until_next_sun_event") %}
                      {% set first_light = states("sensor.dawn_today") %}
                      {% set elev = states("sensor.sun_solar_elevation") | float() %}
                      {% if elev >= 0 %}
                        In: {{ daylight_left }}, Last Light: {{ last_light }}
                      {% else %}
                        In: {{ daylight_left }}, First Light: {{ first_light }}
                      {% endif %}
                    tap_action:
                      action: fire-dom-event
                      browser_mod:
                        service: browser_mod.popup
                        data:
                          title: Sun Details
                          content:
                            type: vertical-stack
                            cards:
                              #- type: custom:mushroom-title-card
                              #  title: Now
                                #subtitle: ""


                              - type: custom:horizon-card
                                entity: Sun
                                moon: true
                                refresh_period: 60
                                fields:
                                  sunrise: false
                                  sunset: false
                                  dawn: false
                                  noon: false
                                  dusk: false
                                  #azimuth: true
                                  #sun_azimuth: true
                                  #moon_azimuth: true
                                  #elevation: true
                                  #sun_elevation: true
                                  #moon_elevation: true
                                  moonrise: false
                                  moonset: false
                                  moon_phase: false
                                southern_flip: false
                                moon_phase_rotation: -30
                                language: en
                                time_format: 12
                                number_format: comma_decimal
                                #downtown SJ
                                latitude: 37.3337
                                longitude: -121.8907
                                #latitude: !secret latitude_home
                                #longitude: !secret longitude_home
                                elevation: 200
                                time_zone: America/Los Angeles
                                #now: 2023-09-24T17:54:05                              
                                card_mod:
                                    style:
                                      mushroom-state-info$: |
                                      .: |
                                        ha-card {
                                          border: none !important;
                                          box-shadow: none !important;
                                        }         
                              - square: false
                                columns: 2
                                type: grid
                                cards:
                                  - type: custom:mushroom-entity-card
                                    entity: sensor.sun_solar_azimuth
                                    secondary: >-
                                      {{ sensor.sun_solar_azimuth }}
                                    name: Azimuth
                                    icon: mdi:compass-outline
                                    icon_color: blue
                                    card_mod:
                                      style:
                                        mushroom-state-info$: |
                                        .: |
                                          ha-card {
                                            border: none !important;
                                            box-shadow: none !important;
                                          }   
   
                                  - type: custom:mushroom-entity-card
                                    entity: sensor.sun_solar_elevation
                                    secondary: >-
                                      {{ sensor.sun_solar_elevation }}
                                    name: Elevation
                                    icon: mdi:sun-angle
                                    icon_color: blue
                                    card_mod:
                                      style:
                                        mushroom-state-info$: |
                                        .: |
                                          ha-card {
                                            border: none !important;
                                            box-shadow: none !important;
                                          } 

                                  #hide next two if the sun is below the horizon as their values will be zero
                                  #- type: conditional
                                  #  conditions:
                                  #    - condition: numeric_state
                                  #      entity: sensor.sun_solar_elevation
                                  #      above: 0
                                  #  card:
                                  - type: custom:mushroom-entity-card
                                    entity: sensor.gw1100b_solar_radiation
                                    secondary: >-
                                      {{ sensor.gw1100b_solar_radiation }}
                                    icon_color: blue
                                    card_mod:
                                      style:
                                        mushroom-state-info$: |
                                        .: |
                                          ha-card {
                                            border: none !important;
                                            box-shadow: none !important;
                                          } 


                                  - type: custom:mushroom-entity-card
                                    entity: sensor.illuminance
                                    secondary: >-
                                      {{ sensor.illuminance }}
                                    icon_color: blue
                                    card_mod:
                                      style:
                                        mushroom-state-info$: |
                                        .: |
                                          ha-card {
                                            border: none !important;
                                            box-shadow: none !important;
                                          } 

                              - type: entities
                                title: Today
                                entities:
                                - entity: sensor.dawn_today
                                  name: First Light
                                - entity: sensor.sunrise_today
                                  name: Sunrise
                                - entity: sensor.solar_noon_today
                                  name: Solar Noon                      
                                - entity: sensor.sunset_today
                                  name: Sunset
                                - entity: sensor.dusk_today
                                  name: Last Light
                                
                                - entity: sensor.daylight_length_converted
                                  name: "Total Daylight:"
                                card_mod:
                                  style:
                                    mushroom-state-info$: |
                                    .: |
                                      ha-card {
                                        border: none !important;
                                        box-shadow: none !important;
                                      } 

                              - type: entities
                                title: Tomorrow
                                entities:
                                - entity: sensor.dawn_tomorrow
                                  name: First Light
                                - entity: sensor.sunrise_tomorrow
                                  name: Sunrise
                                - entity: sensor.sunset_tomorrow
                                  name: Sunset
                                - entity: sensor.dusk_tomorrow
                                  name: Last Light
                                card_mod:
                                  style:
                                    mushroom-state-info$: |
                                    .: |
                                      ha-card {
                                        border: none !important;
                                        box-shadow: none !important;
                                      } 
                            card_mod:
                              style: |
                                :host {#
                                  /* Remove border from poup */
                                  --popup-padding-x: 0px;
                                  --popup-padding-y: 0px;
                                  --popup-min-width: 450px;
                                }

                  - type: conditional
                    conditions:
                      - condition: state
                        entity: sun.sun
                        state: "above_horizon"
                    card:
                      type: custom:stack-in-card
                      cards:
                        - type: custom:layout-card
                          layout_type: grid
                          layout:
                            grid-template-columns: 10% 80% 10%
                            grid-template-rows: 1
                            grid-template-areas: |
                              "zone1 zone2 zone3"
                          cards:
                            - type: custom:mushroom-chips-card
                              chips:
                                #*** UV Index ***
                                - type: template
                                  entity: sensor.gw1100b_uv_index
                                  icon: mdi:sun-wireless
                                  icon_color: |-
                                    {% set uv_index=states(entity) | int %}
                                    {% if uv_index >= 10 %}
                                      #B54CFF
                                    {% elif uv_index >= 9 %}
                                      #FF0099
                                    {% elif uv_index >= 8 %}
                                      #D8001D
                                    {% elif uv_index >= 7 %}
                                      #E82C0E
                                    {% elif uv_index >= 6 %}
                                      #F85900
                                    {% elif uv_index >= 5 %}
                                      #F88700
                                    {% elif uv_index >= 4 %}
                                      #F8B600
                                    {% elif uv_index >= 3 %}
                                      #F7E400
                                    {% elif uv_index >= 2 %}
                                      #A0CE00  
                                    {% else %}
                                      #4EB400 
                                    {% endif %}
                                  content: | 
                                    {% set uv_index=states(entity) | int %}
                                    {% if uv_index >= 9 %}
                                      UV Index: {{ uv_index }} - Very High, Burn Time: 15-25 Mins
                                    {% elif uv_index >= 7 %}
                                      UV Index: {{ uv_index }} - High, Burn Time: 30 Mins
                                    {% elif uv_index >= 5 %}
                                      UV Index: {{ uv_index }} - Moderate, Burn Time: 45 Mins
                                    {% elif uv_index >= 2 %}
                                      UV Index: {{ uv_index }} - Low, Burn Time: 60 Mins
                                    {% else %}
                                      UV Index: {{ uv_index }} - Yer Good
                                    {% endif %}                                    
                                  tap_action:
                                    action: more-info
                                    entity: sensor.uv_index

                                  card_mod:
                                    style:
                                      mushroom-state-info$: |
                                      .: |
                                        ha-card {
                                          border: none !important;
                                          box-shadow: none !important;
                                        }  
                              view_layout:
                                grid-area: zone2

                  - type: custom:stack-in-card
                    cards:
                      - type: custom:layout-card
                        layout_type: grid
                        layout:
                          grid-template-columns: 10% 80% 10%
                          grid-template-rows: 1
                          grid-template-areas: |
                            "zone1 zone2 zone3"
                        cards:
                          - type: custom:mushroom-chips-card
                            chips:
                              #*** Moon Chip Card ***
                              - type: template
                                entity: sensor.moon
                                icon: |-
                                  {% set status = states('sensor.moonrise_status') %}
                                  {% set phase = states('sensor.moon') %}
                                  {% if status == 'above_horizon' %}
                                    {% if phase == "full_moon" %}
                                      mdi:moon-full
                                    {% elif phase == "waning_gibbous" %}
                                      mdi:moon-waning-gibbous
                                    {% elif phase == "last_quarter" %}
                                      mdi:moon-last-quarter
                                    {% elif phase == "waning_crescent" %}
                                      mdi:moon-waning-crescent
                                    {% elif phase == "new_moon" %}
                                      mdi:moon-new
                                    {% elif phase == "waxing_crescent" %}
                                      mdi:moon-waxing-crescent
                                    {% elif phase == "first_quarter" %}
                                      mdi:moon-first-quarter
                                    {% elif phase == "waxing_gibbous" %}
                                      mdi:moon-waxing-gibbous
                                    {% endif %}           
                                  {% else %}
                                    mdi:weather-moonset-up
                                  {% endif %}
                                icon_color: |-
                                  {% set sun_status = states('sun.sun') %}
                                  {% set moon_status = states('sensor.moonrise_status') %}
                                  {% if sun_status == 'above_horizon' and moon_status == 'above_horizon' %}
                                    yellow
                                  {% elif sun_status == 'below_horizon' and moon_status == 'above_horizon' %}
                                    blue
                                  {% else %}
                                    #808080
                                  {% endif %}

                                content: | 
                                  {% set full_m = states('sensor.days_until_full_moon') | float() | round(0) %}
                                  {% set status = states('sensor.moonrise_status') %}
                                  {% set m_rise = states('sensor.moonrise_today') %}
                                  {% set m_set = states('sensor.moonset_today') %}
                                  {% if status == 'above_horizon' and full_m >= 2 %}
                                    Moonset {{ m_set }}, Full Moon: {{ full_m }} days
                                  {% elif status == 'above_horizon' and full_m == 1 %}
                                    Moonset {{ m_set }}, Full Moon: Tomorrow
                                  {% elif status == 'above_horizon' and full_m == 0 %}
                                    Moonset {{ m_set }}, Full Moon: Today
                                  {% elif status == 'below_horizon' and full_m == 0 %}
                                    Moonrise {{ m_rise }}, Full Moon: Today
                                  {% elif status == 'below_horizon' and full_m == 1 %}
                                    Moonrise {{ m_rise }}, Full Moon: Tomorrow
                                  {% else %}
                                    Moonrise: {{ m_rise }}, Full Moon: {{ full_m }} days
                                  {% endif %}                                 
 
                                tap_action:
                                  action: fire-dom-event
                                  browser_mod:
                                    service: browser_mod.popup
                                    data:
                                      title: Moon Details
                                      content:
                                        type: vertical-stack
                                        cards:
                                          #- type: custom:mushroom-title-card
                                          #  title: Now
                                          #  #subtitle: ""

                                          #- type: custom:mushroom-title-card
                                          #  title: Now

                                          - type: custom:horizon-card
                                            entity: Sun
                                            moon: true
                                            refresh_period: 60
                                            fields:
                                              sunrise: false
                                              sunset: false
                                              dawn: false
                                              noon: false
                                              dusk: false
                                              #azimuth: true
                                              #sun_azimuth: true
                                              #moon_azimuth: true
                                              #elevation: true
                                              #sun_elevation: true
                                              #moon_elevation: true
                                              moonrise: false
                                              moonset: false
                                              moon_phase: false
                                            southern_flip: false
                                            moon_phase_rotation: -30
                                            language: en
                                            time_format: 12
                                            number_format: comma_decimal
                                            #downtown SJ
                                            latitude: 37.3337
                                            longitude: -121.8907
                                            #latitude: !secret latitude_home
                                            #longitude: !secret longitude_home
                                            elevation: 200
                                            time_zone: America/Los Angeles
                                            #now: 2023-09-24T17:54:05                              
                                            card_mod:
                                                style:
                                                  mushroom-state-info$: |
                                                  .: |
                                                    ha-card {
                                                      border: none !important;
                                                      box-shadow: none !important;
                                                    }                              


                                          - square: false
                                            columns: 2
                                            type: grid
                                            cards:
                                              - type: custom:mushroom-entity-card
                                                entity: sensor.moon_azimuth
                                                secondary: >-
                                                  {{ sensor.moon_azimuth }}
                                                name: Azimuth
                                                icon_color: blue
                                                tap_action:
                                                  action: more-info
                                                card_mod:
                                                    style:
                                                      mushroom-state-info$: |
                                                      .: |
                                                        ha-card {
                                                          border: none !important;
                                                          box-shadow: none !important;
                                                        }    


                                              - type: custom:mushroom-entity-card
                                                entity: sensor.moon_elevation
                                                secondary: >-
                                                  {{ sensor.moon_elevation }}
                                                name: Elevation
                                                icon_color: blue
                                                tap_action:
                                                  action: more-info
                                                card_mod:
                                                    style:
                                                      mushroom-state-info$: |
                                                      .: |
                                                        ha-card {
                                                          border: none !important;
                                                          box-shadow: none !important;
                                                        }    

                                          - square: false
                                            columns: 2
                                            type: grid
                                            cards:
                                              - type: custom:mushroom-entity-card
                                                entity: sensor.moonrise_today
                                                secondary: >-
                                                  {{ sensor.moonrise_today }}
                                                name: "Moonrise:"
                                                icon_color: blue
                                                tap_action:
                                                  action: more-info
                                                card_mod:
                                                  style:
                                                    mushroom-state-info$: |
                                                    .: |
                                                      ha-card {
                                                        border: none !important;
                                                        box-shadow: none !important;
                                                      }                      
                                              - type: custom:mushroom-entity-card
                                                entity: sensor.moonset_today
                                                secondary: >-
                                                  {{ sensor.moonset_today }}
                                                name: "Moonset:"
                                                icon_color: blue
                                                tap_action:
                                                  action: more-info
                                                card_mod:
                                                    style:
                                                      mushroom-state-info$: |
                                                      .: |
                                                        ha-card {
                                                          border: none !important;
                                                          box-shadow: none !important;
                                                        }

                                          - square: false
                                            columns: 2
                                            type: grid
                                            cards:
                                              - type: custom:mushroom-template-card
                                                #entity: sensor.gw1100b_outdoor_temperature
                                                primary: "Current Phase:"
                                                secondary: |-
                                                  {{ states('sensor.moon') | replace("_", " ") | title }}
                                                icon: |-
                                                  {% set status = states('sensor.moonrise_status') %}
                                                  {% set phase = states('sensor.moon') %}
                                                  {% if status == 'above_horizon' %}
                                                    {% if phase == "full_moon" %}
                                                      mdi:moon-full
                                                    {% elif phase == "waning_gibbous" %}
                                                      mdi:moon-waning-gibbous
                                                    {% elif phase == "last_quarter" %}
                                                      mdi:moon-last-quarter
                                                    {% elif phase == "waning_crescent" %}
                                                      mdi:moon-waning-crescent
                                                    {% elif phase == "new_moon" %}
                                                      mdi:moon-new
                                                    {% elif phase == "waxing_crescent" %}
                                                      mdi:moon-waxing-crescent
                                                    {% elif phase == "first_quarter" %}
                                                      mdi:moon-first-quarter
                                                    {% elif phase == "waxing_gibbous" %}
                                                      mdi:moon-waxing-gibbous
                                                    {% endif %}           
                                                  {% else %}
                                                    mdi:weather-moonset-up
                                                  {% endif %}
                                                icon_color: blue
                                                card_mod:
                                                  style:
                                                    mushroom-state-info$: |
                                                    .: |
                                                      ha-card {
                                                        border: none !important;
                                                        box-shadow: none !important;
                                                      }      

                                              - type: custom:mushroom-template-card
                                                #entity: sensor.gw1100b_outdoor_temperature
                                                primary: "Next Phase:"
                                                secondary: |-
                                                  {% set next_phase = state_attr('sensor.next_moon_phase_date', 'phase') %}
                                                  {% set next_date = states('sensor.next_moon_phase_date') %}
                                                  {{ next_phase }} on {{ next_date }}
                                                icon: |-
                                                  {% set status = states('sensor.moonrise_status') %}
                                                  {% set phase = state_attr('sensor.next_moon_phase_date', 'phase') | replace(" ", "_") | lower %}
                                                  {% if status == 'above_horizon' %}
                                                    {% if phase == "full_moon" %}
                                                      mdi:moon-full
                                                    {% elif phase == "waning_gibbous" %}
                                                      mdi:moon-waning-gibbous
                                                    {% elif phase == "last_quarter" %}
                                                      mdi:moon-last-quarter
                                                    {% elif phase == "waning_crescent" %}
                                                      mdi:moon-waning-crescent
                                                    {% elif phase == "new_moon" %}
                                                      mdi:moon-new
                                                    {% elif phase == "waxing_crescent" %}
                                                      mdi:moon-waxing-crescent
                                                    {% elif phase == "first_quarter" %}
                                                      mdi:moon-first-quarter
                                                    {% elif phase == "waxing_gibbous" %}
                                                      mdi:moon-waxing-gibbous
                                                    {% endif %}           
                                                  {% else %}
                                                    mdi:weather-moonset-up
                                                  {% endif %}
                                                icon_color: blue
                                                card_mod:
                                                  style:
                                                    mushroom-state-info$: |
                                                    .: |
                                                      ha-card {
                                                        border: none !important;
                                                        box-shadow: none !important;
                                                      }      

                            view_layout:
                              grid-area: zone2


          - type: custom:tabbed-card
            styles:
              '--mdc-theme-primary': orange
              '--mdc-tab-text-label-color-default': grey
              '--mdc-typography-button-font-size': 14px
              '--mdc-tab-stacked-height': 55px
              '--mdc-tab-height': 40px
            tabs:
              - card:
                  type: picture-entity
                  show_state: false
                  show_name: false
                  camera_view: auto
                  entity: image.noaa_psw_satellite
                attributes:
                  label: Satellite
              - card:
                  type: picture-entity
                  show_state: false
                  show_name: false
                  camera_view: auto
                  entity: camera.mthamilton_ucolick_org
                attributes:
                  label: Mt. Hamilton
              - card:
                  type: markdown
                  content: |
                    **External Resources**

                    **South Bay:**
                    <ha-icon icon="mdi:weather-hazy">  </ha-icon>  &nbsp; [Mt. Loma Prieta](https://ops.alertcalifornia.org/cam-console/2082)
                    <ha-icon icon="mdi:weather-hazy">  </ha-icon>  &nbsp; [Mt. Hamilton](https://ops.alertcalifornia.org/cam-console/2167)
                    <ha-icon icon="mdi:weather-hazy">  </ha-icon>  &nbsp; [Mt. Rodoni](https://ops.alertcalifornia.org/cam-console/2188)
                    <ha-icon icon="mdi:weather-hazy">  </ha-icon>  &nbsp; [San Jose Foothills](https://ops.alertcalifornia.org/cam-console/2348)
                    <ha-icon icon="mdi:weather-hazy">  </ha-icon>  &nbsp; [Mission Peak 1](https://ops.alertcalifornia.org/cam-console/2127)
                    <ha-icon icon="mdi:weather-hazy">  </ha-icon>  &nbsp; [Mt. Allison](https://ops.alertcalifornia.org/cam-console/2147)
                    <ha-icon icon="mdi:weather-hazy">  </ha-icon>  &nbsp; [Sunol Ridge](https://ops.alertcalifornia.org/cam-console/2600)

                    **San Francisco:**
                    <ha-icon icon="mdi:weather-hazy">  </ha-icon>  &nbsp; [SF - Sutro Tower 1](https://ops.alertcalifornia.org/cam-console/2428)
                    <ha-icon icon="mdi:weather-hazy">  </ha-icon>  &nbsp; [SF - Sutro Tower 2](https://ops.alertcalifornia.org/cam-console/242)

                  card_mod:
                    style:
                      mushroom-state-info$: |
                      .: |
                        ha-card {
                          margin-top: -0.3em !important;
                          border: none !important;
                          box-shadow: none !important;
                        }  
                attributes:
                  label: Links


          - type: conditional
            conditions:
              - condition: numeric_state
                entity: sensor.pw_san_jose_precip_probability
                above: 5
            card:
              type: custom:tabbed-card
              styles:
                '--mdc-theme-primary': orange
                '--mdc-tab-text-label-color-default': grey
                '--mdc-typography-button-font-size': 14px
                '--mdc-tab-stacked-height': 55px
                '--mdc-tab-height': 40px
              tabs:
                - card:
                    type: iframe
                    aspect_ratio: 90%
                    url: https://embed.windy.com/embed.html?type=map&location=coordinates&metricRain=default&metricTemp=default&metricWind=default&zoom=8&overlay=radar&product=radar&level=surface&lat=37.529&lon=-122.198&pressure=true&message=true&play=1
                  attributes:
                    label: Radar
                - card:
                    type: iframe
                    aspect_ratio: 90%
                    url: https://embed.windy.com/embed.html?type=map&location=coordinates&metricRain=default&metricTemp=default&metricWind=default&zoom=8&overlay=wind&product=ecmwf&level=surface&lat=37.529&lon=-122.198&pressure=true&message=true
                  attributes:
                    label: Wind
                - card:
                    type: iframe
                    aspect_ratio: 90%
                    url: https://embed.windy.com/embed2.html?lat=37.335480&lon=-121.893028&zoom=8&level=surface&overlay=temp&menu=&message=&marker=&calendar=&pressure=&type=map&location=coordinates&detail=&detailLat=39.028&detailLon=-124.585&metricWind=mph&metricTemp=%C2%B0F&radarRange=-1
                  attributes:
                    label: Region Temp

          - type: conditional
            conditions:
              - condition: numeric_state
                entity: sensor.pw_san_jose_cloud_coverage
                above: 10
            card:
              type: custom:tabbed-card
              styles:
                '--mdc-theme-primary': orange
                '--mdc-tab-text-label-color-default': grey
                '--mdc-typography-button-font-size': 14px
                '--mdc-tab-stacked-height': 55px
                '--mdc-tab-height': 40px
              tabs:
                - card:
                    type: iframe
                    aspect_ratio: 90%
                    url: https://embed.windy.com/embed.html?type=map&location=coordinates&metricRain=default&metricTemp=default&metricWind=default&zoom=8&overlay=clouds&product=clouds&level=surface&lat=37.529&lon=-122.198&pressure=true&message=true
                  attributes:
                    label: Clouds
                - card:
                    type: iframe
                    aspect_ratio: 90%
                    url: https://embed.windy.com/embed.html?type=map&location=coordinates&metricRain=default&metricTemp=default&metricWind=default&zoom=8&overlay=wind&product=ecmwf&level=surface&lat=37.529&lon=-122.198&pressure=true&message=true
                  attributes:
                    label: Wind
                - card:
                    type: iframe
                    aspect_ratio: 90%
                    url: https://embed.windy.com/embed2.html?lat=37.335480&lon=-121.893028&zoom=8&level=surface&overlay=temp&menu=&message=&marker=&calendar=&pressure=&type=map&location=coordinates&detail=&detailLat=39.028&detailLon=-124.585&metricWind=mph&metricTemp=%C2%B0F&radarRange=-1
                  attributes:
                    label: Region Temp

          - type: conditional
            conditions:
              - condition: numeric_state
                entity: sensor.outdoor_temperature_merged
                above: 75
            card:
              type: custom:tabbed-card
              styles:
                '--mdc-theme-primary': orange
                '--mdc-tab-text-label-color-default': grey
                '--mdc-typography-button-font-size': 14px
                '--mdc-tab-stacked-height': 55px
                '--mdc-tab-height': 40px
              tabs:
                - card:
                    type: iframe
                    aspect_ratio: 90%
                    url: https://embed.windy.com/embed2.html?lat=37.265480&lon=-121.953028&zoom=12&level=surface&overlay=temp&menu=&message=&marker=&calendar=&pressure=&type=map&location=coordinates&detail=&detailLat=39.028&detailLon=-124.585&metricWind=mph&metricTemp=%C2%B0F&radarRange=-1
                  attributes:
                    label: City Temp
                - card:
                    type: iframe
                    aspect_ratio: 90%
                    url: https://embed.windy.com/embed2.html?lat=37.335480&lon=-121.893028&zoom=8&level=surface&overlay=temp&menu=&message=&marker=&calendar=&pressure=&type=map&location=coordinates&detail=&detailLat=39.028&detailLon=-124.585&metricWind=mph&metricTemp=%C2%B0F&radarRange=-1
                  attributes:
                    label: Region Temp
                - card:
                    type: iframe
                    aspect_ratio: 90%
                    url: https://embed.windy.com/embed.html?type=map&location=coordinates&metricRain=default&metricTemp=default&metricWind=default&zoom=8&overlay=wind&product=ecmwf&level=surface&lat=37.529&lon=-122.198&pressure=true&message=true
                  attributes:
                    label: Wind
          - type: map
            name: Earthquakes
            geo_location_sources:
              - usgs_earthquakes_feed
            entities:
              - zone.home
            title: Earthquakes - Past Week

      attributes:
        label: San Jose