Skip to content

Instantly share code, notes, and snippets.

@peyanski
Created March 16, 2026 10:04
Show Gist options
  • Select an option

  • Save peyanski/9acc62ba75fc68bc5c05dcf6197f8085 to your computer and use it in GitHub Desktop.

Select an option

Save peyanski/9acc62ba75fc68bc5c05dcf6197f8085 to your computer and use it in GitHub Desktop.
Every day at 8:05am or 15mins after sunrise (disabled by default), this automation gathers sun data from the Sun integration, sends it to AI for a fun summary with interesting facts, and creates a persistent notification.
alias: AI Sun Daily Insights
description: >-
Every day at 8:05am or 15mins after sunrise (disabled by default), this
automation gathers sun data from the Sun integration, sends it to AI for a fun
summary with interesting facts, and creates a persistent notification.
triggers:
- trigger: time
at: "08:05:00"
- trigger: sun
event: sunrise
offset: "00:15:00"
enabled: false
conditions: []
actions:
- action: ai_task.generate_data
data:
entity_id: ai_task.ollama_ai_task_gpt_oss_120b_cloud
task_name: AI Sun Daily Insights
instructions: >-
Here is the current Sun data from Home Assistant: Sun state: {{
states('sun.sun') }} Next sunrise: {{ states('sensor.sun_next_rising')
}} Next sunset: {{ states('sensor.sun_next_setting') }} Next dawn: {{
states('sensor.sun_next_dawn') }} Next dusk: {{
states('sensor.sun_next_dusk') }} Next noon (solar noon): {{
states('sensor.sun_next_noon') }} Next midnight (solar midnight): {{
states('sensor.sun_next_midnight') }} Sun elevation (degrees above
horizon): {{ state_attr('sun.sun', 'elevation') }} Sun azimuth (compass
direction): {{ state_attr('sun.sun', 'azimuth') }} Today's date: {{
now().strftime('%A, %B %d, %Y') }} Based on this data, write a fun,
positive, and educational morning briefing about the Sun. Include: 1.
When the sun rose today and when it will set (say the times only, no
dates). 2. How many hours of daylight there are today. 3. One
interesting or surprising fact about the Sun that relates to
today's data or the current season.
4. Optionally, a short fun historical fact or a piece of trivia
about the Sun.
Keep it under 120 words. Use a friendly style that a child could
understand. Do not use emojis. Make it enjoyable and positive. Convert
times to Bulgarian time, but don't say there is time conversion
response_variable: ai_response
- action: persistent_notification.create
data:
title: ☀️ Your Daily Sun Briefing
message: "{{ ai_response.data | default('No AI Sun Summary Available.') }}"
notification_id: ai_sun_daily
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment