Skip to content

Instantly share code, notes, and snippets.

@peyanski
Last active April 9, 2026 05:54
Show Gist options
  • Select an option

  • Save peyanski/125ee19e4837784110e412adc322a950 to your computer and use it in GitHub Desktop.

Select an option

Save peyanski/125ee19e4837784110e412adc322a950 to your computer and use it in GitHub Desktop.
# Automation YAML: AI Moon Daily Insights # This automation runs every evening and sends # moon phase data + sun context to AI for a fun # nightly briefing with interesting Moon facts. # # REQUIREMENTS: # 1. Moon integration added (Settings > Devices & Services > Add Integration > Moon) # 2. Sun integration (built-in, already there) # 3. AI Task…
alias: AI Moon Daily Insights
description: >-
Every evening, this automation gathers moon phase data and sun context, sends
it to AI for a fun summary with interesting facts about the Moon, and creates
a persistent notification.
WHAT TO CHANGE:
1. entity_id: replace with YOUR ai_task entity
2. Time trigger: change "20:30:00" to your preferred evening time
3. Time zone line: change "Bulgarian time" to YOUR time zone (or remove it)
triggers:
- trigger: time
at: "20:30:00"
- trigger: sun
event: sunset
offset: "00:30: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 Moon Daily Insights
instructions: >-
Here is the current Moon and Sun data from Home Assistant: Moon phase:
{{ states('sensor.moon_phase') }} Sun state: {{ states('sun.sun') }}
Next sunrise: {{ state_attr('sun.sun', 'next_rising') }} Next sunset: {{
state_attr('sun.sun', 'next_setting') }} Sun elevation: {{
state_attr('sun.sun', 'elevation') }} Today's date: {{
now().strftime('%A, %B %d, %Y') }} Based on this data, write a fun,
positive, and educational evening briefing about the Moon. Include:
1. What the current moon phase is, explained in simple words
2. When the next full moon or new moon is, estimate based on the
current phase.
3. One interesting or surprising fact about the Moon that relates
to the current phase, today's date, or the current season.
4. Optionally, a short fun historical fact, a piece of mythology,
or a cool science fact about the Moon.
Keep it under 120 words. Use a friendly style that a 10-year-old child
could understand. Do not use emojis. Make it enjoyable, magical, and
positive — like telling a bedtime story.Convert times to Bulgarian time,
but don't say there is time conversion.
response_variable: ai_response
- action: persistent_notification.create
data:
title: 🌙 Your Evening Moon Briefing
message: "{{ ai_response.data | default('No AI Moon Summary Available.') }}"
notification_id: ai_moon_daily
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment