Hourly weather condition in Dashboard from AccuWeather integration using API Key

I tried to generate a Weather Dashboard with hourly condition using AccuWeather api. No luck to put a package together using REST platform. I even try to ask ChatGPT for help, no luck. Totally lost. This is what Chat GPT recommend it:

my_accuweather_package:
  sensor:
    - platform: rest
      name: "AccuWeather Raw JSON"
      resource: "https://dataservice.accuweather.com/forecasts/v1/hourly/12hour/329305?apikey=API_KEY&metric=true"
      method: GET
      scan_interval: 1800 
      
    - platform: template
      sensors:
        accuweather_json:
          friendly_name: "AccuWeather JSON"
          value_template: >
            {% set raw = states('sensor.accuweather_raw_json') %}
            {% if raw %}
              {{ (raw | from_json)[0].DateTime }}
            {% else %}
              unavailable
            {% endif %}
          attribute_templates:
            hourly: >
              {% set raw = states('sensor.accuweather_raw_json') %}
              {% if raw %}
                {{ raw | from_json }}
              {% else %}
                []
              {% endif %}


I know, I shouldn’t ask ChatGPT, but I am not a programmer and can work only with simple code( sometimes :grimacing:) . Please, if some one can help me with that will be great. TY

Why not just use the AccuWeather - Home Assistant integration.

Hourly forecasts should be available in HA version 2025.10.0 and later.


I do,but how I can see hourly forecast in my Dashboard like it’s in integration?

Use the weather.get_forecasts service

template:
  - trigger:
    - platform: time_pattern
      hours: /1
    - platform: homeassistant
      event: start
    action:
      - service: weather.get_forecasts
        data:
          type: hourly
        target:
          entity_id: weather.accuweather
        response_variable: hourly
    sensor:
      - name: Weather Forecast Hourly
        unique_id: weather_forecast_hourly
        icon: mdi:weather-cloudy
        state: "{{ hourly['weather.accuweather'].forecast[0].condition }}"
        attributes:
          forecast: "{{ hourly['weather.accuweather'].forecast }}"
1 Like

Set the forecast_type to hourly Weather forecast card - Home Assistant

Thank you, that look closer to what I try to accomplish.


I guess the rest of information I can get using separate cards.
TY

It’s funny, I got this code in my templates for years for non working weather integration and totally forget about it. TY

Thank you, guys for your help. This is what I was trying to accomplish for 7-inch tablet in my wife bathroom .

type: vertical-stack
cards:
  - type: custom:paper-buttons-row
    styles:
      justify-content: flex-start
      flex-wrap: wrap
      font-size: 1.5em
      line-height: 1em
      margin: 6px 0 12px 0
      width: 100%
    buttons:
      - layout: name
        entity: sensor.greeting_message
        name: "{{ states(config.entity) }}"
        styles:
          button:
            flex-basis: 1
            flex-shrink: 0
          name:
            color: white
      - layout: name
        entity: sensor.greeting_message_2
        name: "{{ states(config.entity) }}"
        styles:
          button:
            flex-basis: 1
            flex-shrink: 0
          name:
            color: white
      - layout: name
        entity: sensor.greeting_message_3
        name: "{{ states(config.entity) }}"
        styles:
          button:
            flex-basis: 1
            flex-shrink: 0
          name:
            color: white
  - show_current: true
    show_forecast: true
    type: weather-forecast
    entity: sensor.weather_forecast_hourly
    forecast_type: legacy
    theme: ios-dark-mode
    forecast_slots: 6
    name: Rockville, MD
    tap_action:
      action: more-info
    card_mod:
      style: |
        ha-card {
          background-color: rgba(0,0,0,0) !important;
          box-shadow: none;
          }
  - show_current: false
    show_forecast: true
    type: weather-forecast
    entity: weather.myha
    forecast_type: daily
    theme: ios-dark-mode
    name: Daily
    forecast_slots: 6
    card_mod:
      style: |
        ha-card {
          background-color: rgba(0,0,0,0) !important;
          box-shadow: none;
          }
  - type: custom:bubble-card
    styles: |
      ha-card {
        --bubble-main-background-color: none !important;
            --bubble-button-icon-background-color: none !important;
      }
    card_type: button
    name: "Environmental allergies:"
    sub_button:
      - name: AQI
        show_name: true
        show_background: false
        icon: ios:aqi-high
        tap_action:
          action: navigate
          navigation_path: "#aqi"
        visibility:
          - condition: or
            conditions:
              - condition: state
                entity: sensor.nash_dom_air_quality_0d
                state_not: good
              - condition: state
                entity: sensor.nash_dom_air_quality_1d
                state_not: good
              - condition: state
                entity: sensor.nash_dom_air_quality_2d
                state_not: good
              - condition: state
                entity: sensor.nash_dom_air_quality_3d
                state_not: good
              - condition: state
                entity: sensor.nash_dom_air_quality_4d
                state_not: good
      - name: Tree Pollen
        icon: ios:tree-fill
        show_background: false
        tap_action:
          action: navigate
          navigation_path: "#treepollen"
        visibility:
          - condition: or
            conditions:
              - condition: numeric_state
                entity: sensor.nash_dom_tree_pollen_0d
                above: 14
              - condition: numeric_state
                entity: sensor.nash_dom_tree_pollen_1d
                above: 14
              - condition: numeric_state
                entity: sensor.nash_dom_tree_pollen_2d
                above: 14
              - condition: numeric_state
                entity: sensor.nash_dom_tree_pollen_3d
                above: 14
              - condition: numeric_state
                entity: sensor.nash_dom_tree_pollen_4d
                above: 14
      - name: Grass Pollen
        icon: mdi:grass
        show_background: false
        tap_action:
          action: navigate
          navigation_path: "#grasspollen"
        visibility:
          - condition: or
            conditions:
              - condition: numeric_state
                entity: sensor.nash_dom_grass_pollen_0d
                above: 4
              - condition: numeric_state
                entity: sensor.nash_dom_grass_pollen_1d
                above: 4
              - condition: numeric_state
                entity: sensor.nash_dom_grass_pollen_2d
                above: 4
              - condition: numeric_state
                entity: sensor.nash_dom_grass_pollen_3d
                above: 4
              - condition: numeric_state
                entity: sensor.nash_dom_grass_pollen_4d
                above: 4
      - name: Mold
        icon: mdi:blur
        show_name: true
        show_background: false
        tap_action:
          action: navigate
          navigation_path: "#mold"
        visibility:
          - condition: or
            conditions:
              - condition: numeric_state
                entity: sensor.nash_dom_mold_pollen_0d
                above: 6499
              - condition: numeric_state
                entity: sensor.nash_dom_mold_pollen_1d
                above: 6499
              - condition: numeric_state
                entity: sensor.nash_dom_mold_pollen_2d
                above: 6499
              - condition: numeric_state
                entity: sensor.nash_dom_mold_pollen_3d
                above: 6499
              - condition: numeric_state
                entity: sensor.nash_dom_mold_pollen_4d
                above: 6499
      - name: Ragweed
        icon: mdi:sprout
        show_name: true
        show_background: false
        tap_action:
          action: navigate
          navigation_path: "#ragweed"
        visibility:
          - condition: or
            conditions:
              - condition: numeric_state
                entity: sensor.nash_dom_ragweed_pollen_0d
                above: 20
              - condition: numeric_state
                entity: sensor.nash_dom_ragweed_pollen_1d
                above: 20
              - condition: numeric_state
                entity: sensor.nash_dom_ragweed_pollen_2d
                above: 20
              - condition: numeric_state
                entity: sensor.nash_dom_ragweed_pollen_3d
                above: 20
              - condition: numeric_state
                entity: sensor.nash_dom_ragweed_pollen_4d
                above: 20
    modules:
      - subbutton_ig_ic_colors
    button_type: name
    icon: ios:allergens-fill
    subbutton_ig_ic_colors:
      subbutton1:
        defaults:
          default_bg_color: none
        primary_overrides:
          icon_color: deep-orange
          condition:
            - condition: or
              conditions:
                - condition: state
                  entity: sensor.nash_dom_air_quality_0d
                  state_not: good
                - condition: state
                  entity: sensor.nash_dom_air_quality_1d
                  state_not: good
                - condition: state
                  entity: sensor.nash_dom_air_quality_2d
                  state_not: good
                - condition: state
                  entity: sensor.nash_dom_air_quality_3d
                  state_not: good
                - condition: state
                  entity: sensor.nash_dom_air_quality_4d
                  state_not: good
      subbutton2:
        defaults:
          default_bg_color: none
        primary_overrides:
          icon_color: deep-orange
          condition:
            - condition: or
              conditions:
                - condition: numeric_state
                  entity: sensor.nash_dom_tree_pollen_0d
                  above: 14
                - condition: numeric_state
                  entity: sensor.nash_dom_tree_pollen_1d
                  above: 14
                - condition: numeric_state
                  entity: sensor.nash_dom_tree_pollen_2d
                  above: 14
                - condition: numeric_state
                  entity: sensor.nash_dom_tree_pollen_3d
                  above: 14
                - condition: numeric_state
                  entity: sensor.nash_dom_tree_pollen_4d
                  above: 14
      subbutton3:
        defaults:
          default_bg_color: none
        primary_overrides:
          icon_color: deep-orange
          condition:
            - condition: or
              conditions:
                - condition: numeric_state
                  entity: sensor.nash_dom_grass_pollen_0d
                  above: 4
                - condition: numeric_state
                  entity: sensor.nash_dom_grass_pollen_1d
                  above: 4
                - condition: numeric_state
                  entity: sensor.nash_dom_grass_pollen_2d
                  above: 4
                - condition: numeric_state
                  entity: sensor.nash_dom_grass_pollen_3d
                  above: 4
                - condition: numeric_state
                  entity: sensor.nash_dom_grass_pollen_4d
                  above: 4
      subbutton4:
        defaults:
          default_bg_color: none
        primary_overrides:
          icon_color: deep-orange
          condition:
            - condition: or
              conditions:
                - condition: numeric_state
                  entity: sensor.nash_dom_mold_pollen_0d
                  above: 6499
                - condition: numeric_state
                  entity: sensor.nash_dom_mold_pollen_1d
                  above: 6499
                - condition: numeric_state
                  entity: sensor.nash_dom_mold_pollen_2d
                  above: 6499
                - condition: numeric_state
                  entity: sensor.nash_dom_mold_pollen_3d
                  above: 6499
                - condition: numeric_state
                  entity: sensor.nash_dom_mold_pollen_4d
                  above: 6499
      subbutton5:
        defaults:
          default_bg_color: none
        primary_overrides:
          color: none
          icon_color: deep-orange
          condition:
            - condition: or
              conditions:
                - condition: numeric_state
                  entity: sensor.nash_dom_ragweed_pollen_0d
                  above: 20
                - condition: numeric_state
                  entity: sensor.nash_dom_ragweed_pollen_1d
                  above: 20
                - condition: numeric_state
                  entity: sensor.nash_dom_ragweed_pollen_2d
                  above: 20
                - condition: numeric_state
                  entity: sensor.nash_dom_ragweed_pollen_3d
                  above: 20
                - condition: numeric_state
                  entity: sensor.nash_dom_ragweed_pollen_4d
                  above: 20
  - type: horizontal-stack
    cards:
      - type: custom:ring-tile
        entity: sensor.nash_dom_pressure
        name: Air Pressure
        min: 12.6
        max: 15.7
        ring_type: open
        ring_size: 2
        indicator: pointer
        icon: mdi:gauge
        scale: ticks_with_labels
        top_element: icon
        middle_element: value
        bottom_element: unit
        hide_state: true
        card_mod:
          style: |
            ha-card {
              background-color: rgba(0,0,0,0) !important;
              box-shadow: none;
              }
      - type: custom:ring-tile
        entity: sensor.nash_dom_humidity
        name: Humidity
        min: 0
        max: 100
        ring_type: open
        ring_size: 2
        indicator: pointer
        scale: ticks_with_labels
        top_element: icon
        middle_element: value
        bottom_element: unit
        hide_state: true
        card_mod:
          style: |
            ha-card {
              background-color: rgba(0,0,0,0) !important;
              box-shadow: none;
              }
      - type: custom:ring-tile
        entity: sensor.kgai_wind_speed
        marker: sensor.kgai_wind_direction
        ring_type: compass_nesw
        ring_size: 2
        top_element: marker_dir
        middle_element: value_with_unit
        name: Wind Speed & Direction
        hide_state: true
        card_mod:
          style: |
            ha-card {
              background-color: rgba(0,0,0,0) !important;
              box-shadow: none;
              }
      - type: custom:ring-tile
        entity: sensor.openweathermap_visibility
        name: Visibility
        min: 0
        max: 10
        ring_type: open
        ring_size: 2
        indicator: pointer
        scale: ticks_with_labels
        top_element: icon
        middle_element: value
        bottom_element: unit
        hide_state: true
        card_mod:
          style: |
            ha-card {
              background-color: rgba(0,0,0,0) !important;
              box-shadow: none;
              }
  - type: horizontal-stack
    cards:
      - type: custom:ring-tile
        entity: switch.master_bathroom_towels_warmer
        name: Towel Warmer
        ring_size: 1
        ring_type: none
        middle_element: icon
        top_element: name
        tap_action:
          action: toggle
        icon_tap_action:
          action: toggle
        card_mod:
          style:
            .: |
              ha-card {               
                {% if states('switch.master_bathroom_towels_warmer') == 'on' %}
                box-shadow: 0px 0px 5px 5px #CBC3E3 !important;
                {% else %}
                box-shadow: 5px 10px 5px -3px rgba(0,0,0,0.75);
                {% endif %}      
                {% if is_state('switch.master_bathroom_towels_warmer', 'on') %}
                background: rgba(255, 152, 0, 0.8) !important;
                {% endif %}
                background: dark_grey !important;
                width: 140px !important;
                margin-left: 7px;
                }
              * {        
                 --rt-icon-color: {{ 
                    "red" 
                  if states("switch.master_bathroom_towels_warmer") == "on"
                else "white" 
                }};  
              }
      - type: custom:ring-tile
        entity: light.master_bathroom_fan_light_switch
        name: Fan/Light
        tap_action:
          action: toggle
        icon_tap_action:
          action: toggle
        middle_element: icon
        ring_size: 1
        ring_type: none
        card_mod:
          style:
            .: |
              ha-card {               
                {% if states('light.master_bathroom_fan_light_switch') == 'on' %}
                box-shadow: 0px 0px 5px 5px #CBC3E3 !important;
                {% else %}
                box-shadow: 5px 10px 5px -3px rgba(0,0,0,0.75);
                {% endif %}      
                {% if is_state('light.master_bathroom_fan_light_switch', 'on') %}
                background: rgba(255, 152, 0, 0.8) !important;
                {% endif %}
                background: dark_grey !important;
                width: 140px !important;
                margin-left: 7px;
                }
              * {        
                 --rt-icon-color: {{ 
                    "red" 
                  if states("light.master_bathroom_fan_light_switch") == "on"
                else "white" 
                }};  
              }    
      - type: custom:ring-tile
        entity: light.master_bathroom_vanity_light
        name: Vanity Light
        tap_action:
          action: toggle
        icon_tap_action:
          action: toggle
        middle_element: icon
        ring_size: 1
        ring_type: none
        card_mod:
          style:
            .: |
              ha-card {               
                {% if states('light.master_bathroom_vanity_light') == 'on' %}
                box-shadow: 0px 0px 5px 5px #CBC3E3 !important;
                {% else %}
                box-shadow: 5px 10px 5px -3px rgba(0,0,0,0.75);
                {% endif %}      
                {% if is_state('light.master_bathroom_vanity_light', 'on') %}
                background: rgba(255, 152, 0, 0.8) !important;
                {% endif %}
                background: dark_grey !important;
                width: 140px !important;
                margin-left: 7px;
                }
              * {        
                 --rt-icon-color: {{ 
                    "red" 
                  if states("light.master_bathroom_vanity_light") == "on"
                else "white" 
                }};  
              }        
  - type: grid
    columns: 3
    grid_options:
      columns: 6
      rows: auto
    square: true
    cards:
      - type: custom:ring-tile
        entity: switch.master_bathroom_towels_warmer
        name: Warmer
        tap_action:
          action: toggle
        icon_tap_action:
          action: toggle
        ring_size: 1
        ring_type: none
        middle_element: icon
        card_mod:
          style:
            .: |
              ha-card {               
                {% if states('switch.master_bathroom_towels_warmer') == 'on' %}
                box-shadow: 0px 0px 5px 5px #CBC3E3 !important;
                {% else %}
                box-shadow: 5px 10px 5px -3px rgba(0,0,0,0.75);
                {% endif %}      
                {% if is_state('switch.master_bathroom_towels_warmer', 'on') %}
                background: rgba(255, 152, 0, 0.8) !important;
                {% endif %}
                background: dark_grey !important;
                width: 140px !important;
                height: 140px !important;
                margin-left: 7px;
                }
              * {        
                 --rt-icon-color: {{ 
                    "red" 
                  if states("switch.master_bathroom_towels_warmer") == "on"
                else "white" 
                }};  
              }
      - type: custom:ring-tile
        entity: switch.master_bathroom_fan_light_switch
        name: Fan/Light
        tap_action:
          action: toggle
        icon_tap_action:
          action: toggle
        middle_element: icon
        ring_size: 1
        ring_type: none
        card_mod:
          style:
            .: |
              ha-card {               
                {% if states('light.master_bathroom_fan_light_switch') == 'on' %}
                box-shadow: 0px 0px 5px 5px #CBC3E3 !important;
                {% else %}
                box-shadow: 5px 10px 5px -3px rgba(0,0,0,0.75);
                {% endif %}      
                {% if is_state('light.master_bathroom_fan_light_switch', 'on') %}
                background: rgba(255, 152, 0, 0.8) !important;
                {% endif %}
                background: dark_grey !important;
                width: 140px !important;
                height: 140px !important;
                margin-left: 7px;
                }
              * {        
                 --rt-icon-color: {{ 
                    "red" 
                  if states("light.master_bathroom_fan_light_switch") == "on"
                else "white" 
                }};  
              }     
      - type: custom:ring-tile
        entity: light.master_bathroom_vanity_light
        name: Vanity Light
        tap_action:
          action: toggle
        icon_tap_action:
          action: toggle
        middle_element: icon
        ring_size: 1
        ring_type: none
        card_mod:
          style:
            .: |
              ha-card {               
                {% if states('light.master_bathroom_vanity_light') == 'on' %}
                box-shadow: 0px 0px 5px 5px #CBC3E3 !important;
                {% else %}
                box-shadow: 5px 10px 5px -3px rgba(0,0,0,0.75);
                {% endif %}      
                {% if is_state('light.master_bathroom_vanity_light', 'on') %}
                background: rgba(255, 152, 0, 0.8) !important;
                {% endif %}
                background: dark_grey !important;
                width: 140px !important;
                height: 140px !important;        
                margin-left: 7px;
                }
              * {        
                 --rt-icon-color: {{ 
                    "red" 
                  if states("light.master_bathroom_vanity_light") == "on"
                else "white" 
                }};  
              }         
  - type: vertical-stack
    cards:
      - type: custom:bubble-card
        card_type: pop-up
        hash: "#treepollen"
      - type: custom:auto-entities
        card:
          type: entities
          title: Tree Pollen
          card_mod:
            class: class-header-margin
            style:
              hui-sensor-entity-row:
                $: |
                  hui-generic-entity-row {
                    height: 25px;
                    padding: 0px 16px;
                    border-radius: var(--ha-card-border-radius);
                    border: 1px groove var(--primary-color);
                    
                  }
              .: |
                ha-card {
                  color: vcar(--primary-color);
                  /*--mdc-icon-size: 40px;*/
                  font-weight: 400;
                  background: none !important
                }
                .card-content {
                  max-height: 6000px;
                 # overflow-y: scroll;
                }
          state_color: false
          show_header_toggle: false
        filter:
          include:
            - options:
                card_mod:
                  style: |
                    hui-generic-entity-row {
                      background:
                        {% set grains = states(config.entity) | int %}
                        {% if grains <= 14 %}
                          {% set value = 25 %}
                          {% set bar = '0,128,0' %}          /* green */
                        {% elif grains <= 89 %}
                          {% set value = 50 %}
                          {% set bar = '204,204,0' %}        /* yellow */
                        {% elif grains <= 1499 %}
                          {% set value = 75 %}
                          {% set bar = '255,165,0' %}        /* orange */
                        {% else %}
                          {% set value = 100 %}
                          {% set bar = '255,0,0' %}          /* red */
                        {% endif %}
                        linear-gradient(to right,
                          rgb({{bar}}) 0%,
                          rgb({{bar}}) {{value}}%,
                          rgba({{bar}},0.15) {{value}}%,
                          rgba({{bar}},0.05) 100%);

                    :host {
                      --card-mod-icon-color:
                        {% set grains = states(config.entity) | int %}
                        {% if grains <= 14 %}
                          {% set value = 25 %}
                          {% set bar = '0,128,0' %}          /* green */
                        {% elif grains <= 89 %}
                          {% set value = 50 %}
                          {% set bar = '204,204,0' %}        /* yellow */
                        {% elif grains <= 1499 %}
                          {% set value = 75 %}
                          {% set bar = '255,165,0' %}        /* orange */
                        {% else %}
                          {% set value = 100 %}
                          {% set bar = '255,0,0' %}          /* red */
                        {% endif %}
                        linear-gradient(to right,
                          rgb({{bar}}) 0%,
                          rgb({{bar}}) {{value}}%,
                          rgba({{bar}},0.15) {{value}}%,
                          rgba({{bar}},0.05) 100%);
                    }
              entity_id: sensor.nash_dom_tree_pollen*
              state: ">14"
          exclude: null
        sort:
          method: state
          numeric: true
          reverse: false
        show_empty: false