This is an automated archive made by the Lemmit Bot.

The original was posted on /r/homeassistant by /u/Koalamanx on 2025-06-16 06:00:40+00:00.


Hey all,

After a fair bit of going nuts, I finally got a dashboard card that I’m super happy with and wanted to share a full write-up in case anyone else wants to build it.

The goal was to have a clean, dynamic summary of the upcoming weather, personalised for my dashboard. Instead of just numbers, it gives a friendly, natural language forecast.

Here’s what the final result looks like, and thank you big time to /u/spoctoss for troubleshooting:

Dashboard containing the Weather Markdown Card

It’s all powered by the AI (GPT or Claude, etc.) integration, but it’s incredibly cheap because it uses the Haiku model or similar.

Here’s the step-by-step guide.

Part 1: The Foundation - A Trigger-Based Template Sensor

First things first, we need a place to store the long weather summary. A normal entity state is limited to 255 characters, (this really cost me some nerves) which is no good for us. The trick is to use a trigger-based template sensor and store the full text in an attribute. This way, the state can be a simple timestamp, but the attribute holds our long forecast.

Add this to your ⁠configuration.yaml (or a separate template YAML file if you have one):

                template:
                  - trigger:
                      # This sensor only updates when our automation fires the event.
                      - platform: event
                        event_type: set_ai_response
                    sensor:
                      - name: "AI Weather Summary"
                        unique_id: "ai_weather_summary_v1" # Make this unique to your system
                        state: "Updated: {{ now().strftime('%H:%M') }}"
                        icon: mdi:weather-partly-cloudy
                        attributes:
                          full_text: "{{ trigger.event.data.payload }}"

After adding this, remember to go to Developer Tools > YAML > Reload Template Entities.

Part 2: The Automation

This automation runs on a schedule, gets the latest forecast from your weather entity, sends it to the AI to be summarised, and then fires the ⁠set_ai_response event to update our sensor from Part 1.

Go to Settings > Automations & Scenes and create a new automation.

Switch to YAML mode and paste this in:

Remember to change the alias to something you like, I chose the alias: AI Weather Summary

description: Generate AI weather summaries throughout the day
trigger:
  # Set whatever schedule you want. I like a few times a day.
  - platform: time
    at: "07:30:00"
  - platform: time
    at: "10:00:00"
  - platform: time
    at: "14:00:00"
  - platform: time
    at: "18:00:00"
condition: []
action:
  # 1. Get the forecast data from your weather entity
  - service: weather.get_forecasts
    data:
      type: hourly
    target:
      # IMPORTANT: Change this to your own hourly weather entity!
      entity_id: weather.your_weather_entity_hourly
    response_variable: forecast

  # 2. Send the data to the AI with a specific prompt
  - service: conversation.process
    data:
      agent_id: conversation.claude
      # This is the fun part! You can change the AI's personality here.
      text: >-
        Generate a plain text response only. Do not use any markdown or tags.
        Start your response with a single emoji that reflects the
        overall weather. Follow it with one or two friendly sentences
        summarizing the weather for today in [Your Town/City] based on the data.

        Forecast Data:
        {% for f in forecast['weather.your_weather_entity_hourly'].forecast[:4] -%}
        - At {{ f.datetime[11:16] }} it will be {{ f.condition }}, {{ f.temperature | int }}°C, {{ f.precipitation_probability }}% rain chance, and a UV Index of {{ f.uv_index }}.
        {%- endfor %}
    response_variable: ai_output

  # 3. Fire the event to update our sensor from Part 1
  - event: set_ai_response
    event_data:
      # This cleans up any stray tags the AI might add, just in case.
      payload: "{{ ai_output.response.speech.plain.speech | string | replace('<result>', '') | replace('</result>', '') }}"
mode: single

Don’t forget to change ⁠weather.your_weather_entity_hourly to your actual weather entity in two places in the code above!

Part 3: The Markdown Card

This is the easy part. We just need a markdown card to display everything. I combined mine with a dynamic “Good Morning/Afternoon” greeting, which is a nice touch. Add a new Markdown card to your dashboard and paste this:

type: markdown
content: |
  # {% set hour = now().hour %} {% if 4 <= hour < 12 %}
    Good morning, [Your Name] ☀️
  {% elif 12 <= hour < 18 %}
    Good afternoon, [Your Name] 🌤️
  {% else %}
    Good evening, [Your Name] 🌙
  {% endif %}
  #### {{ now().strftime('%A, %d %B %Y') }}
  ---
  {{ state_attr('sensor.ai_weather_summary', 'full_text') }}

Part 4: Keeping API calls it CHEAP!

This uses the GPT or Anthropic integration, and by default, it might use a powerful (and expensive) model.

For a simple task like this, you want the cheapest and fastest model.

  1. Go to Settings > Devices & Services and click Configure on the Anthropic integration.

  2. Uncheck the box that says “Recommended model settings”.

  3. In the Model field that appears, paste this exact model name:

⁠claude-3-haiku-20240307

Hit Submit!

This will ensure your costs are literally cents a month. My usage for 5 calls a day is less than a cent.

And that’s it!

Let me know if you have any questions or ideas to improve it. Hope this helps someone and put’s a smile on your face :)